![在考试文档类中水平列出各部分](https://linux22.com/image/320680/%E5%9C%A8%E8%80%83%E8%AF%95%E6%96%87%E6%A1%A3%E7%B1%BB%E4%B8%AD%E6%B0%B4%E5%B9%B3%E5%88%97%E5%87%BA%E5%90%84%E9%83%A8%E5%88%86.png)
现在,我有以下代码,编译后如下所示:
\documentclass[12pt]{exam}
\usepackage[T1]{fontenc}
\usepackage[parfill]{parskip}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc,decorations.pathreplacing,decorations.markings,arrows.meta}
\usepackage{gensymb}
\begin{document}
\begin{questions}
\question
For each solid, calculate:
\begin{subparts}
\subpart
the volume
\subpart
the surface area
\end{subparts}
\begin{parts}
\part
\begin{tikzpicture}[baseline=(current bounding box.north)]
\draw[thick] (-1.5,-0.5) coordinate (v4) {} -- (-1.5,-1.5) coordinate (v3) {} -- node[below] {$20$ m} (3.5,-1.5) coordinate (v6) {} -- node[right] {$8$ m} (3.5,1) coordinate (v5) {} -- cycle;
\draw[thick] (-3.5,-1) coordinate (v1) {} -- node[left] {$3$ m} (-3.5,0) -- (1.5,1.5) coordinate (v2) {};
\draw[dashed, thick] (v1) -- (1.5,-1) coordinate (v7) {} -- (v2);
\draw[thick] (v3) -- node[below left] {$5$ m} (v1);
\draw[thick] (v4) -- (-3.5,0);
\draw[thick] (v5) -- (1.5,1.5);
\draw[dashed, thick] (v6) -- (v7);
\end{tikzpicture}
\part
\begin{tikzpicture}[baseline=(current bounding box.north)]
\draw[thick] (-1.5,-1.5) arc (180:-60:1.5cm and 0.6cm) coordinate (t);
\draw[thick] (0,-1.5) -- (t);
\draw[thick] (0,-1.5) -- (-1.5,-1.5);
\draw[thick, dashed] (-1.5,-5) arc (180:0:1.5cm and 0.6cm);
\draw[thick] (1.5,-5) arc (0:-60:1.5cm and 0.6cm) coordinate (b);
\draw[thick] (0,-5) -- (b);
\draw[thick] (0,-5) -- node [below] {$5$ cm} (-1.5,-5);
\draw[thick] (0,-1.5) -- ++(0,-3.5);
\draw[thick] (-1.5,-1.5) -- ++(0,-3.5);
\draw[thick] (1.5,-1.5) -- node [right] {$12$ cm} ++(0,-3.5);
\draw[thick] (t) -- ++(0,-3.5);
\draw[thick] (-0.25,-1.5) arc (180:-60:0.25cm and 0.1cm) node [above right] {$240 \degree$};
\end{tikzpicture}
\end{parts}
\end{questions}
\end{document}
但是,我想将子部分 i. 和 ii. 以及部分 (a) 和 (b) 列在同一行,使其看起来像这样:
这可能吗?
答案1
您可以使用minipage
s。
\documentclass[12pt]{exam}
\usepackage[T1]{fontenc}
\usepackage[parfill]{parskip}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc,decorations.pathreplacing,decorations.markings,arrows.meta}
\usepackage{gensymb}
\begin{document}
\begin{questions}
\question
For each solid, calculate:
\begin{subparts}
\begin{minipage}{0.45\linewidth}
\subpart
the volume
\end{minipage}
\hfill
\begin{minipage}{0.45\linewidth}
\subpart
the surface area
\end{minipage}
\end{subparts}
\begin{parts}
\begin{minipage}[t]{0.45\linewidth}
\part
\begin{tikzpicture}[baseline=(current bounding box.north),x=0.75cm,y=0.75cm]
\draw[thick] (-1.5,-0.5) coordinate (v4) {} -- (-1.5,-1.5) coordinate (v3) {} -- node[below] {$20$ m} (3.5,-1.5) coordinate (v6) {} -- node[right] {$8$ m} (3.5,1) coordinate (v5) {} -- cycle;
\draw[thick] (-3.5,-1) coordinate (v1) {} -- node[left] {$3$ m} (-3.5,0) -- (1.5,1.5) coordinate (v2) {};
\draw[dashed, thick] (v1) -- (1.5,-1) coordinate (v7) {} -- (v2);
\draw[thick] (v3) -- node[below left] {$5$ m} (v1);
\draw[thick] (v4) -- (-3.5,0);
\draw[thick] (v5) -- (1.5,1.5);
\draw[dashed, thick] (v6) -- (v7);
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\linewidth}
\part
\begin{tikzpicture}[baseline=(current bounding box.north)]
\draw[thick] (-1.5,-1.5) arc (180:-60:1.5cm and 0.6cm) coordinate (t);
\draw[thick] (0,-1.5) -- (t);
\draw[thick] (0,-1.5) -- (-1.5,-1.5);
\draw[thick, dashed] (-1.5,-5) arc (180:0:1.5cm and 0.6cm);
\draw[thick] (1.5,-5) arc (0:-60:1.5cm and 0.6cm) coordinate (b);
\draw[thick] (0,-5) -- (b);
\draw[thick] (0,-5) -- node [below] {$5$ cm} (-1.5,-5);
\draw[thick] (0,-1.5) -- ++(0,-3.5);
\draw[thick] (-1.5,-1.5) -- ++(0,-3.5);
\draw[thick] (1.5,-1.5) -- node [right] {$12$ cm} ++(0,-3.5);
\draw[thick] (t) -- ++(0,-3.5);
\draw[thick] (-0.25,-1.5) arc (180:-60:0.25cm and 0.1cm) node [above right] {$240 \degree$};
\end{tikzpicture}
\end{minipage}
\end{parts}
\end{questions}
\end{document}
,x=0.75cm,y=0.75cm
我已经使用选项缩小了第一张图片的尺寸,tikzpicture
以便所有内容都能正常显示。