如何顯示每個問題部分以顯示在 tikzpicture 的頂部?

如何顯示每個問題部分以顯示在 tikzpicture 的頂部?

我對乳膠還很陌生,但我正在輸入一份包含不同尺寸形狀的考試。在每一列中,我希望形狀的頂部垂直對齊,希望允許問題編號也對齊(以便 (a) 與 (b) 對齊,並且它們都位於相應圖像的頂部,而不是在底部)。這是我第一次嘗試製作MWE,可能不完美。

\documentclass[12pt]{exam}
\usepackage{tikz}
\usepackage{multicol}

    \begin{questions}
    \question Find the area of each figure shown below.
    \begin{parts}
        \begin{multicols}{2}
            \part{
                \begin{tikzpicture}[scale=0.3]
                    \draw (0,0) circle (4);
                    \draw (0,0) -- node[above]{4 m} (4,0);
                    \draw[fill=black] (0,0) circle (0.07);
                \end{tikzpicture}
                }
                
            \part{
            \begin{tikzpicture}[scale=0.3]
                    \draw (0,0) circle (8);
                    \draw (0,0) -- node[above]{8 mm} (8,0);
                    \draw[fill=black] (0,0) circle (0.07);
                \end{tikzpicture}
                }
        \end{multicols}
    \end{parts}
\end{questions}

\end{document}

答案1

解決方案是給baseline=(current bounding box.north)tikzpicture 作為選項。因此\begin{tikzpicture}[scale=0.3,baseline=(current bounding box.north)]

根據 pgfmanual,文法\draw (0,0) circle (4);很舊。較新的語法是\draw (0,0) circle [radius=4];.

考慮使用 siunitx 套件和then作為文本,而不是4 m節點中的文本(與 類似)。那麼和之間的間距就不會比 一樣大。8 mm\usepackage{siunitx}\qty{4}{\m}4m4 m

\draw[fill=black]可以用,來代替\fill

相關內容