我怎样才能将图形放在物品旁边?

我怎样才能将图形放在物品旁边?

我正在尝试用 LaTeX 重新创建一场全国数学考试,但我很难在问题编号旁边添加一个数字。

最初的想法是让最终的产品像这样:

问题 16(此处将图片置于中央,问题编号位于纸张边缘)

以下是问题的陈述

以下是与声明一致的答案选项。

a) 替代方案 A

b) 替代方案 B

c) 替代方案 C

d) 替代方案 D

e) 替代方案 E

但当我尝试输入:

\item 
\begin{figure}[H]
\centering
\includegraphics[scale=0.4]{figure.png} 
\end{figure}    
    If the hemisphere, the cylinder and the right circular cone have the same volume, it is true that
\begin{enumerate}[a)]
\item $h-R+2R=0$
\item $2h-2R-3H=0$
\item $2h-R+3H=0$
\item $2h+2R-H=0$
\item $h-3R+H=0$
\end{enumerate} 

最终的文本如下:

在此处输入图片描述

当我想要使文本如下时:

在此处输入图片描述

我怎样才能将第一张图片变成第二张图片的样子?

(我在 Paint 上制作了第二张图片,但我不知道如何在 LaTeX 中正确地制作它)

答案1

这是你想要的吗(或多或少)?

\documentclass{article}
\usepackage[export]{adjustbox}% for valign
\usepackage{graphicx}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label=\textbf{Question \arabic*}]
\item 
\hfil \includegraphics[width=1in, valign=t]{example-image} \par
    If the hemisphere, the cylinder and the right circular cone have the same volume, it is true that
\begin{enumerate}[label=\alph*)]
\item $h-R+2R=0$
\item $2h-2R-3H=0$
\item $2h-R+3H=0$
\item $2h+2R-H=0$
\item $h-3R+H=0$
\end{enumerate} 
\end{enumerate}
\end{document}

答案2

我本来打算用valign方法来回答,但是既然已经有人回答过了,下面是使用 的替代方法paracol。只是为了好玩,MWE 避免将问题放在长长的嵌套列表中,并且我使用 linguex 来简化答案项的语法。

在此处输入图片描述

\documentclass{article}
\usepackage[tmargin=1cm,bmargin=1cm]{geometry}
\usepackage{parskip}
\usepackage{linguex}
\renewcommand{\SubExRBr}{)}
\AtBeginDocument{
\setlength{\Exlabelwidth}{.5em}
\setlength{\Exindent}{1em}
\setlength{\Extopsep}{1em}}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{paracol}\columnsep 3em
\usepackage{lipsum}
\newcounter{question} 
\def\question{\addtocounter{question}{1}\paragraph*{Question \thequestion:}} 
\newcommand\img[2][1]{\includegraphics[width=#1\linewidth]{#2}} 
\begin{document}
% option 1: image in a column of 40%,  question and  items beside
\columnratio{0.6} 
\begin{paracol}{2}
\question If the hemisphere, the cylinder and the right circular cone have the same volume, it is true that
\begin{enumerate}[label=\alph*)]
\item $h-R+2R=0$
\item $2h-2R-3H=0$
\item $2h-R+3H=0$
\item $2h+2R-H=0$
\item $h-3R+H=0$
\end{enumerate} 
\switchcolumn\centering
\img{example-image-a} 
\end{paracol}
% option 2:the same, but with linguex instead of enuitem, aand imagen zoomed at 80%   
\columnratio{0.6}
\begin{paracol}{2}[\question]
If the hemisphere, the cylinder and the right circular cone have the same volume, it is true that
\a. $h-R+2R=0$ % item restart the count
\b. $2h-2R-3H=0$  
\b. $2h-R+3H=0$ 
\b. $2h+2R-H=0$
\b. $h-3R+H=0$\par % or blank line (mandatory)
\switchcolumn
\hfill % or \centering or  or nothing  (to the consumer's taste)
\img[0.8]{example-image-b}
\end{paracol}
% option 3 Quistion is above, not beside the image,
\columnratio{0.5}
\begin{paracol}{2}[\question  If the hemisphere, the cylinder and the right circular cone have the same volume, it is true that]
\baselineskip2em
\a. $h-R+2R=0$ % item restart the count
\b. $2h-2R-3H=0$  
\b. $2h-R+3H=0$ 
\b. $2h+2R-H=0$
\b. $h-3R+H=0$\par%
\switchcolumn
\img{example-image-16x9} 
\end{paracol}
% The redistributing spaces for long answers  and portrait image at aligned at bottom
\columnratio{0.7}
\begin{paracol}{2}[\question]
\a.[] If the hemisphere, the cylinder and the right circular cone have the same volume, it is true that\\[\parskip] 
\a. \lipsum[1][1-2]\\[\parskip]
\b. \lipsum[2][1-2]\\[\parskip]
\c. \lipsum[3][1-2]\\[\parskip]
\d. \lipsum[4][1-2]\\[\parskip]
\e. \lipsum[5][1-2]\par%
\switchcolumn
\vfill
\img[.8]{example-image-9x16} 
\end{paracol}
\end{document}

相关内容