我正在尝试弄清楚如何更改以下内容。当我编写以下代码时,我会在图像底部获得第二个问题标签。如果我在第二个问题之后的第一个问题之前添加 // 以使网格位于另一行,我会收到错误,即这里没有行可以结束,这是可以理解的。这是 MWE。
\documentclass{exam}
\usepackage{multicol,tikz}
\begin{document}
Instructions here.
\begin{questions}
\begin{multicols}{2}
\question
First Question
\columnbreak
\question
\begin{tikzpicture} [xscale=0.35, yscale=0.35] %Change size of grid
\draw[help lines] (-10,-10) grid (10,10);
\draw[<->, ultra thick] (-10,0) -- (10,0); %x-axis
\draw[<->, ultra thick] (0,-10) -- (0,10); %y-axis
\node[right] at (10,0) {$x$}; %label x-axis
\node[above] at (0,10) {$y$}; %label y-axis
\end{tikzpicture}
\end{multicols}
\end{questions}
\end{document}
我可以通过添加如下文本来解决这个问题,但这不是一个理想的解决方案。
\documentclass{exam}
\usepackage{multicol,tikz}
\begin{document}
Instructions here.
\begin{questions}
\begin{multicols}{2}
\question
First Question
\columnbreak
\question
Here's some text\\
\begin{tikzpicture} [xscale=0.35, yscale=0.35] %Change size of grid
\draw[help lines] (-10,-10) grid (10,10);
\draw[<->, ultra thick] (-10,0) -- (10,0); %x-axis
\draw[<->, ultra thick] (0,-10) -- (0,10); %y-axis
\node[right] at (10,0) {$x$}; %label x-axis
\node[above] at (0,10) {$y$}; %label y-axis
\end{tikzpicture}
\end{multicols}
\end{questions}
\end{document}
如果可能的话,我确信我需要更改某些属性。我只是在 multicol 或 TikZ 的文档中找不到它。如能提供任何帮助,我将不胜感激!
答案1
baseline
您可以更改tikzpicture
\documentclass{exam}
\usepackage{multicol,tikz}
\begin{document}
Instructions here.
\begin{questions}
\begin{multicols}{2}
\question
First Question
\columnbreak
\question
\begin{tikzpicture} [xscale=0.35, yscale=0.35, baseline=(current bounding box.north)] %Change size of grid
\draw[help lines] (-10,-10) grid (10,10);
\draw[<->, ultra thick] (-10,0) -- (10,0); %x-axis
\draw[<->, ultra thick] (0,-10) -- (0,10); %y-axis
\node[right] at (10,0) {$x$}; %label x-axis
\node[above] at (0,10) {$y$}; %label y-axis
\end{tikzpicture}
\end{multicols}
\end{questions}
\end{document}