2

I am trying to make a sheet of math assignments (based on pictures), which should look something like this:

assignment example

So:

  • All assignment should have the same width.
  • The row of assignment should fill the screen.
  • I might want more than 2 assignments.

So I guess, a table would do the trick:

\documentclass{article}

\usepackage[demo]{graphics}
\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\textwidth}{lXlXlX}
a)&\includegraphics{test}&b)&\includegraphics{test}&c)&\includegraphics{test}
\end{tabularx}

\end{document}

But the width of the pictures is not right.

How do I do this?

Update

As suggested I am trying to set the width property of the images. But I am unsure of what to set it to.

If I do:

\documentclass{article}

\usepackage[demo]{graphics}
\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\textwidth}{lXlXlX}
a)&\includegraphics[width=.3\textwidth]{test}&
b)&\includegraphics[width=.3\textwidth]{test}&
c)&\includegraphics[width=.3\textwidth]{test}
\end{tabularx}

\end{document}

I get this error:

Runaway argument?
width=.3\textwidth ]{test}\unskip \relax \@endpbox \hskip \col@sep 
! Forbidden control sequence found while scanning use of \Gin@iii.
<inserted text> 
                \par 
l.12 \end{tabularx}

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
3
  • Have you tried using \includegraphics with the widthoption? Like in \includegraphics[width=.3\textwidth]{test}
    – Benjamin
    Nov 27, 2016 at 15:14
  • 1
    I updated the question to try that out
    – Nathan
    Nov 27, 2016 at 15:25
  • My fault! I haven't seen that you were using the graphicspackage. The widthoption is from the grapicxpackage but the results with that aren't so nice. See my answer for a better solution.
    – Benjamin
    Nov 27, 2016 at 15:34

1 Answer 1

2

A combination of the graphicx package and the minipage environment should suit your needs

\documentclass{article}
\usepackage[demo]{graphicx}

\begin{document}
    \noindent   
    \begin{minipage}{.29\textwidth}
        a)\\
        \includegraphics[width=\textwidth]{test}
    \end{minipage}
    \hspace{.05\textwidth}
    \begin{minipage}{.29\textwidth}
        b)\\
        \includegraphics[width=\textwidth]{test}
    \end{minipage}
    \hspace{.05\textwidth}
    \begin{minipage}{.29\textwidth}
        c)\\
        \includegraphics[width=\textwidth]{test}
    \end{minipage}
\end{document}

This is the output:

output

You must log in to answer this question.

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