0

General overview

I try to put a \minipage[t]{…} inside a \twoclum[<here>]’s argument.

But it failed with the following error message:

Error message

! Argument of \@iminipage has an extra }.
<inserted text>
                \par
l.7     \begin{minipage}[b]
                           {5cm}

What I tried

It seams that the [t] minipage’s option it’s the reason of the trouble (same thing whith [b], btw). And it cause troubleshouting only when it’s inside the \twocolumn’s argument.

MWE

\documentclass{article}

\begin{document}

\twocolumn[% \begin{minipage}[t]{5cm} foo \end{minipage}% ]

\end{document}

The question

How to use minipage with [t] option inside \twocolumn’s argument without troubleshooting?

fauve
  • 2,501

1 Answers1

2

In accordance with the duplicate question and Frank's excellent explanation and LaTeX2e conclusion, another pair of braces will also solve the problem in your case:

\documentclass{article}

\begin{document}

\twocolumn[{% \begin{minipage}[t]{5cm} foo \end{minipage}% }]

\end{document}

cabohah
  • 11,455
  • This is a common work around for similar optional parameters. However, I expect more questions from OP. This is not a good way to handle it, essentially it puts a minipage in a vbox Also very awkward to type if one has a lot of cases like this. But then the OP did not describe what this is going to be used for. – yannisl Mar 10 '24 at 17:01
  • Also needless to mention, that unless there is material before the \begin{minipage} the minipage [t] can be omitted! – yannisl Mar 10 '24 at 17:06
  • @yannisl before or after – cabohah Mar 10 '24 at 17:36
  • 1
    @yannisl And workaround is only one point of view (maybe Lesie's). As Frank explains in the linked answer, another point of view could be: optional arguments in LaTeX are really correctly specified as [{ (open) and }] (close) and that [...] is just a convenient shortcut if you do not have to hide anything from the scanner which is true most of the time. – cabohah Mar 10 '24 at 17:42
  • @before it can be omitted. If you have two minipages within the [...] yes you need them. – yannisl Mar 10 '24 at 17:52
  • 1
    @yannisl You can omit it, if the minipage has only one line. But if the example is only a good minimization of the nested optional arguments problem, you can only omit it, if there isn't anything before and after the minipage. BTW: If there would really be only a text with width less or equal to 5cm inside the minipage, you can also omit the minipage. But discussing this is more or less useless. I'd just expect, that the real document contains more in the \twocolumn argument than shown, either a longer text, that should break into lines of <= 5cm or something beside the minipage. – cabohah Mar 10 '24 at 17:59