防止扩大tikz图片来包装文字
问题描述:
我是Tikz的新手,无法弄清楚为什么会有小幅度的tikzpictures将宽度扩展到整个页面。 由于我希望我的文字在这些数字周围浮动,因此知道如何防止它们扩大是非常有用的。防止扩大tikz图片来包装文字
这里是我的问题的代码和图片,你可以看到它不是由长字幕引起的,我的第一个想法是什么。
\section{demo}
\begin{figure}[h]
\tdplotsetmaincoords{60}{25}
\begin{tikzpicture}[tdplot_main_coords, scale=1]
\coordinate (o) at (0,0,0);
\coordinate (x) at (4,0,0);
\coordinate (y) at (0,0,4);
\coordinate (z) at (0,-4,0);
\node[above] at (x) {x};
\node[above] at (y) {y};
\node[above] at (z) {z};
\draw[red, -latex] (o) -- (x);
\draw[green, -latex] (o) -- (y);
\draw[blue, -latex] (o) -- (z);
\end{tikzpicture}
\caption{far to long caption for this kind of sensless figure created just for demonstrationg tikzpicture expand their width}
\end{figure}
\begin{figure}[h]
%[... same code as above ...]
\end{figure}
。你们有什么建议,以适应tikzpicture范围的内容是什么?
谢谢。
答
这是默认行为。您可以使用wrapfigure
包以包裹tikz图文字:
\begin{wrapfigure}{r}{0.4\textwidth}
\tdplotsetmaincoords{60}{25}
\begin{tikzpicture}[tdplot_main_coords, scale=1]
...
\end{tikzpicture}
\caption{far to long caption for this kind of sensless figure created just for demonstrationg tikzpicture expand their width}
\end{wrapfigure}
在\begin{wrapfigure}{r}{0.4\textwidth}
,第一个参数是位置(r
右),第二个参数是wrapfigure的大小(这里40%的页面宽度符合tikz的数字)。
是的。谢谢。使用wrapfig packege'\ usepackage {wrapfig}'后可以正常工作。 –