TikZpictures 与 multicol 环境内的图形环境中的列一样宽吗?

TikZpictures 与 multicol 环境内的图形环境中的列一样宽吗?

我一直在写一份包含一堆几何图形的文档。每个几何图形都附有一些注释。注释总是紧接着(IE(出现在上方)它们所涉及的图形。我使用这种方法\begin{figure}[H] <remarks, in English> <geometric figure> \end{figure}是为了强制每个几何图形始终与我对它们的注释出现在同一页上,因为我更喜欢这种风格。如果很重要,我的图形就会写在环境中tikzpicture

最近,我决定让文档采用双栏格式看起来更好,所以我使用了multicols。所以我们得到了tikzpicture里面 里面figuremulticol我的问题是:如何使每个几何图形符合其所在列的宽度?如何针对特定数字做到这一点?如何针对全局做到这一点?

以防万一,我的代码看起来像这样,但为了简洁起见,我只包含了我的一个几何图形:

\documentclass{article}
\usepackage{tikz}
\usepackage{float}
\usepackage{multicol}
-----------------------
\begin{document}
\begin{multicols}{2}

\begin{figure}[H]
Below are two concentric circular arcs, blah blah blah...\\

\begin{tikzpicture}[scale=.75, >=Stealth]
    \draw [gray, very thin] (-4, -4) grid (4, 4);
    \draw [<->, blue, semithick] (-4.5, 0) -- (4.5, 0);
    \draw [<->, blue, semithick] (0, -4.5) -- (0, 4.5);
    \draw [red] (4, 0) arc [start angle=0, end angle=230, radius=4];
    \draw [purple] (.5, 0) arc [start angle=0, end angle=315, radius=.5];
\end{tikzpicture}
\end{figure}

\end{multicols}
\end{document}

谢谢你!

答案1

有点粗鲁的解决方案,但它有效......

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{float}
\usepackage{multicol}
\newlength\picwidth

\usepackage{lipsum}

\begin{document}
\begin{multicols}{2}
\lipsum[1]

\begin{figure}[H]
\centering
\setlength\picwidth{9cm} % max. width of image
\begin{tikzpicture}[scale=\linewidth/\picwidth, % ratio column width/image width
                    >=Stealth]
    \draw [gray, very thin] (-4, -4) grid (4, 4);
    \draw [<->, blue, semithick] (-4.5, 0) -- (4.5, 0);
    \draw [<->, blue, semithick] (0, -4.5) -- (0, 4.5);
    \draw [red] (4, 0) arc [start angle=0, end angle=230, radius=4];
    \draw [purple] (.5, 0) arc [start angle=0, end angle=315, radius=.5];
\end{tikzpicture}
\end{figure}
\lipsum[2-4]
\end{multicols}
\end{document}

在此处输入图片描述

相关内容