0

I'm trying to recreate a national math exam in LaTeX, but I'm struggling to put a figure besides the number of the question.

The original idea was to make the final product like this:

Question 16 (here woukd lie the centered picture, with the question number at the margin of the paper)

Here would be the statement of the question

And here would be the answer options, aligned with the statement.

a) Alternative A

b) Alternative B

c) Alternative C

d) Alternative D

e) Alternative E

But when I tried to type:

\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} 

it made the final text like this:

enter image description here

When I desired to make the text like this:

enter image description here

How can I turn the first image like the second?

(I made the second image on Paint, I don't know how to do it properly in LaTeX)

3
  • Beside or above the items? Anyway, no not use the figure environment for this, just \includegraphics.
    – Fran
    Commented Feb 10 at 14:14
  • For example, see tex.stackexchange.com/a/8631/107497
    – Teepeemm
    Commented Feb 10 at 14:14
  • Both, I wanted to make the figure "between" them, if it does make sense to you
    – BoxyHD
    Commented Feb 10 at 14:23

2 Answers 2

0

Is this what you want (more or less)?

\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}
1
  • OMG, THAT'S IT! THANK YOU SO MUCH!
    – BoxyHD
    Commented Feb 10 at 18:15
0

I was going to answer with the valign approach, but since this has already been answered, here are alternative ways using paracol. Just for fun, the MWE avoid make the questions in a long nested list, and I use linguex to simplify the syntax of answer items.

enter image description here

\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}
2
  • Hello Fran, I really liked your approach with the Option 3 that you presented! Do you know a simpler approach to that, without using the paracol package? I don't know, it kinda messed up with the design of the answers (the space between the items are different in some way)
    – BoxyHD
    Commented Feb 19 at 0:13
  • @BoxyHD The paracol package has nothing to do with the spaces of items, but with linguex that is very different to a enumitem. You can play with the aspect of linguex items with the setting of preamble to change the indentation and space above-below, and to change the space betrwee items, you can change \baselineskip (3th example) for answers of a single line or add \\[x] (4ht example) where x could be any length that you want to add to the normal interline space (-1pt, 1em,\parskip, etc.).
    – Fran
    Commented Feb 19 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .