I'm trying to write these exercises, aligned with the "=" sign, in two columns. This is what I have:

                \item 16 mg = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)
                \item 50 mg = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)
                \item 5 mg  = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)
                \item 0,1 mg  = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)
                \item 22,5 mg = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)
                \item 0,005 mg = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)

This is how it looks

How can I align each line by the "=" sign? It doesn't work to use align combined with enumerate.


  • Welcome to TeX.SX! When I compile your snippet I get a different output. Could you please complete your snipped with the \documentclass and the required \usepackages to compile it, please? Don't forget to compile the example before to make sure it works :) – Phelype Oleinik Jul 3 '18 at 12:00
  • Sorry, I'm quite new to LaTex and this is my first post, does it work now? – Sofia Jul 3 '18 at 12:03
  • @No problem, we're all here to learn :) Except for the missing \begin{document} and \end{document} it works. Next time make sure that the code sample you post compiles, so that people can just copy/paste it ;) – Phelype Oleinik Jul 3 '18 at 12:09
  • You're welcome :) But sorry, I don't know the answer. I tried adding an \hfill to the left of the = (\item 16 mg \hfill = \underline{\hspace{1.4cm}} $\mu$g (mikrogram)), but it added too much space... – Phelype Oleinik Jul 3 '18 at 12:28

Here is a suggestion that uses a tabular:

enter image description here



\begin{tabular*}{\textwidth}{lr<{~mg~=~\underline{\hspace{1.4cm}} $\mu$g (mikrogram)\hspace{1.75cm}}lr<{~mg~=~\underline{\hspace{1.4cm}} $\mu$g (mikrogram)}}
1. & 16  & 4. & 0,1\\
2. & 50  & 5. & 22,5 \\
3. & 5   & 6. & 0,005\\


As observed in the comments, the above example only works as expected if one has an even number of entries. With an odd number of entries, mg = ____ µg (mikrogram) will also be printed if there there is no entry in the corresponding cell.

To overcome this, one can use an enumerate relying approach as explained in the answers to this question: Custom alignment of text in itemized environment or use the following modified version of David Carlisle's answer about balancing a longtable in a multicols environment:

enter image description here

\documentclass[11pt, a4paper]{article}



\begin{longtable}{>{\the\value{entryno}.\addtocounter{entryno}{1}\enspace}r<{~mg~=~\underline{\hspace{1.4cm}} $\mu$g (mikrogram)}}
  • You're welcome. If you prefer an enumerate based solution, you might be interested in the following: Custom alignment of text in itemized environment – leandriis Jul 3 '18 at 13:09
  • In the case where the second column in the last row doesn't have an exercise, for example only 1) 2) 3) This code still writes out mg = ____ µg, while I write 2. & 1,7 & & \\ . Is there any way around this? – Sofia Jul 3 '18 at 13:56
  • @Sofia: This is due to the way that text is generated. With the table in my anwer, it is inserted after the contents of every row regardless of if the cell is empty or filled. If you have an odd number of exercises, you might be better off using one of the solutions in the question I linked in my previous comment. – leandriis Jul 3 '18 at 14:05

A combination of tasks and eqparbox, plus the recommended siunitx for units.







\task \ral{\SI{16}{\mg}}    = \SI{\answerspace}{\ug} (mikrogram)
\task \ral{\SI{50}{\mg}}    = \SI{\answerspace}{\ug} (mikrogram)
\task \ral{\SI{5}{\mg}}     = \SI{\answerspace}{\ug} (mikrogram)
\task \ral{\SI{0,1}{\mg}}   = \SI{\answerspace}{\ug} (mikrogram)
\task \ral{\SI{2,5}{\mg}}   = \SI{\answerspace}{\ug} (mikrogram)
\task \ral{\SI{0,005}{\mg}} = \SI{\answerspace}{\ug} (mikrogram)


Remember to \stepcounter{taskc} in order to update the necessary label for \eqmakebox.

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.