4

In trying to suppress underfull box warnings in annotations to equations in align environments, I'm experimenting with \raggedright. I've discovered that it works inside a \parbox but not inside a minipage environment. Why is that?

% !TEX TS-program = lualatexmk
% !TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage{amsmath}

\newcommand*{\reason}[1]{&&\begin{minipage}{3cm}{\raggedright\small{#1}}\end{minipage}}
\newcommand*{\thereason}[1]{&&\parbox[c]{3cm}{\raggedright\small{#1}}}

\begin{document}
\begin{align}
  \begin{split}
    a &= b + c + d + e + f + g + h + i + j + k + l   \\
      &\quad + m + n + o + o + q + r + s + t + u + v \\
      &\quad + w + x + y + z 
  \end{split} \reason{a really stupidly long equation split over multiple lines} \\
  \begin{split}
    a &= b + c + d + e + f + g + h + i + j + k + l   \\
      &\quad + m + n + o + o + q + r + s + t + u + v \\
      &\quad + w + x + y + z 
  \end{split} \thereason{a really stupidly long equation split over multiple lines} 
\end{align}
\end{document}

1 Answer 1

8

\raggedright does work in minipages as well as in \parbox. What matters is the state at the end of the parargaph. In your minipage test, you have extra braces that delimit the raggedright effect before the paragraph is ended.

\begin{minipage}{3cm}{\raggedright\small{#1}}\end{minipage}

should be

\begin{minipage}{3cm}\raggedright\small{#1}\end{minipage}

though you could do

\begin{minipage}{3cm}{\raggedright\small{#1}\par}\end{minipage}
1
  • Thank you. I was hoping it was something simple, and it was. Commented Nov 10, 2020 at 9:56

You must log in to answer this question.

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