1

I'm trying to setup what you can see in the following image, essentially an image side by side with a tasks environment. The image could be inside or outside the tasks environment, I don't care as long as it works.

enter image description here

(I edited this image with MSPaint)

I've been using tasks throughout my document and I would prefer not to change this package.

In this next code I'm posting a few of my attempts to replicate my target, they've all failed in one way or another as it's explained in the code.

\documentclass[letterpaper,12pt]{book}

\usepackage[margin=1.1in]{geometry}
\setlength{\parindent}{0pt} 

%\usepackage{lipsum}

\usepackage{graphicx}

\usepackage{tasks} 
    \settasks{style=enumerate,label-width=1.5em,label-offset=0.5em,item-indent=2em,label-align=right,resume=true,after-item-skip=0pt}

\usepackage{multicol}

\begin{document}

%tasks only
%Doesn't work, looks almost right but images are not shown the preferred way. Code is a bit dirty too.
\begin{tasks}[resume=false](4)
\task*(2) \includegraphics[width=\linewidth]{dummy}
\task[] Equations
\task[] $P=(0,2)$
\task*(2)[] \task*(2)[] $a:\, y=x$
\task*(2)[] \task*(2)[] $b:\, y=x+2$
\task*(2)[] \task*(2)[] $c:\, y=-x+2$
\task*(2) \includegraphics[width=\linewidth]{dummy}
\task[] Equations
\task[] $P=(0,2)$
\task*(2)[] \task*(2)[] $a:\, y=x$
\task*(2)[] \task*(2)[] $b:\, y=x+2$
\task*(2)[] \task*(2)[] $c:\, y=-x+2$
\end{tasks}

\newpage

%several tasks inside several multicols
%Doesn't work, numbers should go on the left, it also means each example needs its own tasks and a multicols environment.
\begin{multicols}{2}
\includegraphics[width=\linewidth]{dummy}
\columnbreak
\begin{tasks}[resume=false](2)
\task Equations
\task[] $P=(0,2)$
\task![] $a:\, y=x$
\task![] $b:\, y=x+2$
\task![] $c:\, y=-x+2$
\end{tasks}
\end{multicols}

\begin{multicols}{2}
\includegraphics[width=\linewidth]{dummy}
\columnbreak
\begin{tasks}(2)
\task Equations
\task[] $P=(0,2)$
\task![] $a:\, y=x$
\task![] $b:\, y=x+2$
\task![] $c:\, y=-x+2$
\end{tasks}
\end{multicols}

\newpage

%one tasks inside multicols
%Doesn't work, taskes piled at the top instead of aligning with their corresponding image. Also, numbers should go on the left.
\begin{multicols}{2}
\includegraphics[width=\linewidth]{dummy}
\includegraphics[width=\linewidth]{dummy}
\columnbreak
\begin{tasks}[resume=false](2)
\task Equations
\task[] $P=(0,2)$
\task![] $a:\, y=x$
\task![] $b:\, y=x+2$
\task![] $c:\, y=-x+2$
\end{tasks}
\begin{tasks}(2)
\task Equations
\task[] $P=(0,2)$
\task![] $a:\, y=x$
\task![] $b:\, y=x+2$
\task![] $c:\, y=-x+2$
\end{tasks}
\end{multicols}

\end{document}

How can I get my intended result?

2

Using tasks when you don't want the list to be numbered horizontally is not really the best option, but anyway. Starting from your first example:

  • Use \usepackage[export]{adjustbox} and then add valign=t to the \includegraphics options in order to get the enumeration label aligned with the top-left corner of the figure. Note that adjustbox already loads graphicx.

  • For the second column use just one \task command and align the equations in other easier way, e.g. with the aligned environment (requires the amsmath package)

MWE:

\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{amsmath}
\usepackage{tasks} 

\begin{document}

\begin{tasks}[style=enumerate](4)
\task*(2) \includegraphics[width=\linewidth,valign=t]{example-image-a}

\task[] $\begin{aligned}[t]
&{\rm Equations}\\
& a:\, y=x\\
&b:\, y=x+2\\
&c:\, y=-x+2
\end{aligned}$

\task[] $P=(0,2)$

\task*(2) \ldots \end{tasks}
\end{document}

enter image description here

As I said, using tasks for this is overkilling. With an enumerate environment and some \hfill to ensure equal spacing between columns would suffice:

\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{amsmath}

\begin{document}
\begin{enumerate}
\item \includegraphics[width=0.5\linewidth,valign=t]{example-image-a}
\hfill
$\begin{aligned}[t]
&{\rm Equations}\\
& a:\, y=x\\
&b:\, y=x+2\\
&c:\, y=-x+2
\end{aligned}$
\hfill
$P=(0,2)$
\hfill

\item \ldots
\end{enumerate}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.