1

I have defined the following command:

\newcommand{\listOfYears}[3]{

    \mbox{
        \begin{minipage}{0.08\textwidth}
        #1
        \end{minipage}

        \begin{minipage}{0.30\textwidth}
        #2
        \end{minipage}
      }

    \mbox{
      \begin{minipage}{0.08\textwidth}
      \end{minipage}

      \begin{minipage}{0.30\textwidth}
          \textit{#3}
      \end{minipage}
      }
}

I would like the third argument to be aligned with the second one(so I want #2 and #3 to have the same distance from the left of the page).

However, if I create an empty minipage before #3 it doesn't get displayed:

      \begin{minipage}{0.08\textwidth}
      \end{minipage}

Therefore, I'm trying to use \hphantom but that has the same effect:

      \begin{minipage}{0.08\textwidth}
       \hphantom{invisible chars}
      \end{minipage}

So how can I create empty space before #3?

  • Please always post a complete minimal example people can compile. Much more useful than a handful or half of code fragments. – cfr May 24 '16 at 22:24
3

Why not just this?

\documentclass{article}
\newcommand{\listOfYears}[3]{%
  \begin{minipage}{0.08\textwidth}
    #1
  \end{minipage}%
  \begin{minipage}{0.30\textwidth}
    #2
  \end{minipage}
  \par
  \hspace*{.08\textwidth}%
  \begin{minipage}{0.30\textwidth}
    \textit{#3}
  \end{minipage}
}
\begin{document}

\listOfYears{765}{235}{3098}

\end{document}

aligned minipages

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.