將數字放在考試選項旁邊

將數字放在考試選項旁邊

在下面的 mwe 中,我希望將圓形歐姆公式圖放置在更右側,並且該圖的底部與問題 4 的選項 D 對齊。\includegraphics在列表環境之外和之內移動命令也會造成奇怪的事情。

我試過了

\newlength{\oldparindent} \setlength{\oldparindent}{\parindent}% Save   \parindent
\setbox0=\hbox{\includegraphics[width=0.17\textwidth]{ohm_law}}% Original image
\noindent\begin{minipage}[t]{0.6\textwidth}
\end{minipage}\hfill
\begin{minipage}[t]{0.17\textwidth}
\raisebox{-\ht0}{\usebox0}% Insert image
\end{minipage}

我在某個地方找到的。它將數字移到右側,將問題分開,在左側留下空白。我相信解決方案是迷你頁,但如何解決呢?

這是 mwe:

\documentclass[12pt,letterpaper,addpoints]{exam}
\usepackage{geometry}
\usepackage{float}
%\usepackage[scaled=1.05,proportional,lightcondensed]{zlmtt}
\usepackage{graphicx} %needed to include pictures (png)
\usepackage{tabularx}%\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{inconsolata}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style

\extraheadheight[-1.25in]{-0.25in}
\extrafootheight{-1in}
\begin{document}

%\printanswers    %uncomment and re-compile to print answer key

\pagestyle{headandfoot}
\runningheadrule
\lhead{}
\chead[]{Electrical Systems 20 Exam(continued)}
\rhead{}

\title{Electrical Systems 20 \\\textsc{Exam}}
\date{}
\maketitle
\textsc{NAME}\enspace\makebox[3in]{\hrulefill}
\textsc{DATE}\enspace\makebox[1.5in]{\hrulefill}
\fullwidth{}
\vspace{0.1in}
%\fullwidth{\large \textbf{1) Multiple Choices}}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
\textsc {Choose the \emph{most correct} answer from the choices given.}}}}
\end{center}
\vspace{0.1in}

\begin{questions}
\boxedpoints
\pointsinrightmargin
\question[1]Automotive wiring diagrams include
\begin{choices}
\choice A series of colour coded diagrams
\choice Specific symbols to identify components
\choice Wire gauge sizes
\correctchoice All of the above
\end{choices}

\question[1]When soldering an electrical connection, use
\begin{choices}
\choice Acid core flux
\correctchoice Rosin core flux
\choice A or B
\choice Neither A or B
\end{choices}

\question[1]An electrical component that allows current to flow in one
direction only is called
\begin{choices}
\choice Watt
\choice Anode
\choice Cathode
\CorrectChoice Diode
\end{choices}


\question[1]Ohm's law states that
\includegraphics[width=2.0cm]{ohm_law} %started with this
\begin{choices}
\choice $1\ volt = 1\ amp \times 1 \Omega$
\choice $1\ amp = \frac{1\ volt}{1 \Omega}$
\choice $1 \Omega = \frac{1\ volt}{1\ amp}$
\CorrectChoice All of the above are true.
\end{choices}

\question[1] In a parallel circuit,
\begin{choices}
\choice the voltage is the same throughout the circuit, but the
current is divided.
\choice The total circuit resistance is always less than the smallest
resistor in the circuit.
\choice there is more than one path for current to flow.
\CorrectChoice All of the above are true.
\end{choices}

\question[1] An electronic device which acts like a high speed switch
is a
\begin{choices}
\choice triode
\choice diode
\choice monode
\correctchoice transistor
\end{choices}

\end{questions}
\end{document} here

答案1

您可以定義一個巨集,例如:

\newcommand\myimage[2][width=2cm]{%
\hfill\makebox[0pt][r]{\raisebox{-\height}[0pt][0pt]{\includegraphics[#1]{#2}}}
}

並像這樣使用它

\question[1]Ohm's law states that\myimage[width=3cm]{example-image}
\begin{choices}
\choice $1\ volt = 1\ amp \times 1 \Omega$
\choice $1\ amp = \frac{1\ volt}{1 \Omega}$
\choice $1 \Omega = \frac{1\ volt}{1\ amp}$
\CorrectChoice All of the above are true.
\end{choices}

在此輸入影像描述

完整程式碼:

\documentclass[12pt,letterpaper,addpoints]{exam}
\usepackage{geometry}
\usepackage{float}
%\usepackage[scaled=1.05,proportional,lightcondensed]{zlmtt}
\usepackage{graphicx} %needed to include pictures (png)
\usepackage{tabularx}%\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{inconsolata}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style

\extraheadheight[-1.25in]{-0.25in}
\extrafootheight{-1in}

\newcommand\myimage[2][width=2cm]{%
\hfill\makebox[0pt][r]{\raisebox{-\height}[0pt][0pt]{\includegraphics[#1]{#2}}}
}
\begin{document}

%\printanswers    %uncomment and re-compile to print answer key

\pagestyle{headandfoot}
\runningheadrule
\lhead{}
\chead[]{Electrical Systems 20 Exam(continued)}
\rhead{}

\title{Electrical Systems 20 \\\textsc{Exam}}
\date{}
\maketitle
\textsc{NAME}\enspace\makebox[3in]{\hrulefill}
\textsc{DATE}\enspace\makebox[1.5in]{\hrulefill}
\fullwidth{}
\vspace{0.1in}
%\fullwidth{\large \textbf{1) Multiple Choices}}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
\textsc {Choose the \emph{most correct} answer from the choices given.}}}}
\end{center}
\vspace{0.1in}

\begin{questions}
\boxedpoints
\pointsinrightmargin
\question[1]Automotive wiring diagrams include
\begin{choices}
\choice A series of colour coded diagrams
\choice Specific symbols to identify components
\choice Wire gauge sizes
\correctchoice All of the above
\end{choices}

\question[1]When soldering an electrical connection, use
\begin{choices}
\choice Acid core flux
\correctchoice Rosin core flux
\choice A or B
\choice Neither A or B
\end{choices}

\question[1]An electrical component that allows current to flow in one
direction only is called
\begin{choices}
\choice Watt
\choice Anode
\choice Cathode
\CorrectChoice Diode
\end{choices}


\question[1]Ohm's law states that\myimage[width=3cm]{example-image}
%\hfill\makebox[0pt][r]{\raisebox{-\height}[0pt][0pt]{\includegraphics[width=3.0cm]{example-image}}} %started with this}
\begin{choices}
\choice $1\ volt = 1\ amp \times 1 \Omega$
\choice $1\ amp = \frac{1\ volt}{1 \Omega}$
\choice $1 \Omega = \frac{1\ volt}{1\ amp}$
\CorrectChoice All of the above are true.
\end{choices}

\question[1] In a parallel circuit,
\begin{choices}
\choice the voltage is the same throughout the circuit, but the
current is divided.
\choice The total circuit resistance is always less than the smallest
resistor in the circuit.
\choice there is more than one path for current to flow.
\CorrectChoice All of the above are true.
\end{choices}

\question[1] An electronic device which acts like a high speed switch
is a
\begin{choices}
\choice triode
\choice diode
\choice monode
\correctchoice transistor
\end{choices}

\end{questions}
\end{document}

旁注,請考慮使用siunitx類型設定單元包。可以很容易地輸入諸如\SI{1}{\ampere}和 間距之類的單位,都是正確的。

相關內容