Two `minipage` inside command
1,376
Try
\newcommand{\dualminipage}[2]
{
\begin{minipage}[t]{0.45\linewidth}#1\end{minipage}
\hfill
\begin{minipage}[t]{0.45\linewidth}#2\end{minipage}
}
It seems that second square backed in your\dualminipage
definition make a problem.
Author by
Tim
Updated on November 17, 2020Comments
-
Tim almost 3 years
I want two
minipages
side-by-side. I can do this easily. But then I want to turn it into a command, and theminipages
don't line up any more, even thought the code looks identical.What is wrong? In the MWE i show what I want without the command, and then try to put it into command.
\documentclass{article} \newcommand{\dualminipage}[2][] { \begin{minipage}[t][][t]{0.45\linewidth} #1 \end{minipage}\hfill \begin{minipage}[t][][t]{0.45\linewidth} #2 \end{minipage} } \begin{document} % Firstly the minipages put simply. \begin{minipage}[t][][t]{0.45\linewidth} This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. \end{minipage}\hfill \begin{minipage}[t][][t]{0.45\linewidth} This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. \end{minipage} \vspace{0.5in} % Now the minipages put into a command \dualminipage { This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. This is the left-hand side. } { This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. This is the right-hand side. } \end{document}