Graphics, Figures & TablesImage alignment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Image alignment

Post by Singularity »

How can I get the letter choices for the following multiple choice question to align at the top of the image?

MWE:

Code: Select all

Code, edit and compile here:
\documentclass[fleqn,addpoints
%,answers
]{exam}
\usepackage{amsfonts,amsmath,amssymb,amsthm,mathtools}
\usepackage{color}
\usepackage{multicol}
\everymath{\displaystyle}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\shadedsolutions
\begin{document}
\begin{questions}
\question Determine which plot shows the strongest linear correlation.
\begin{choices}
\begin{multicols}{2}
\correctchoice \includegraphics{T2_Q1_D.png}
\choice \includegraphics{T2_Q1_B.png}
\choice \includegraphics{T2_Q1_A.png}
\choice \includegraphics{T2_Q1_C.png}
\end{multicols}
\end{choices}
\answerline[A]
\end{questions}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Attachments
T2_Q1_D.png
T2_Q1_D.png (4.48 KiB) Viewed 4159 times
T2_Q1_C.png
T2_Q1_C.png (4.5 KiB) Viewed 4159 times
T2_Q1_B.png
T2_Q1_B.png (5.21 KiB) Viewed 4159 times
T2_Q1_A.png
T2_Q1_A.png (4.58 KiB) Viewed 4159 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Image alignment

Post by Stefan Kottwitz »

Very good complete example! You could load the adjustbox package and use \adjincludegraphics[valign=t] instead of \includegraphics:

Code: Select all

Code, edit and compile here:
\documentclass[fleqn,addpoints
%,answers
]{exam}
\usepackage{amsfonts,amsmath,amssymb,amsthm,mathtools}
\usepackage{color}
\usepackage{multicol}
\usepackage{adjustbox}
\everymath{\displaystyle}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\shadedsolutions
\begin{document}
\begin{questions}
\question Determine which plot shows the strongest linear correlation.
\begin{choices}
\begin{multicols}{2}
\correctchoice \adjincludegraphics[valign=t]{T2_Q1_D.png}
\choice \adjincludegraphics[valign=t]{T2_Q1_B.png}
\choice \adjincludegraphics[valign=t]{T2_Q1_A.png}
\choice \adjincludegraphics[valign=t]{T2_Q1_C.png}
\end{multicols}
\end{choices}
\answerline[A]
\end{questions}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Stefan
LaTeX.org admin
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Re: Image alignment

Post by Singularity »

Works perfectly the first time. TY.
Post Reply