# Consistent vertical alignment of one-line text in minipages

The vertical alignment of one-line text in minipages depends on the vertical extent of the text itself:

\documentclass{scrartcl}
\begin{document}
\frame{
\begin{minipage}[c][1cm][c]{0.1\linewidth}
\LARGE Good
\end{minipage}}
\frame{
\begin{minipage}[c][1cm][c]{0.2\linewidth}
\LARGE Morning
\end{minipage}}
\end{document}


There is a simple solution adding a full extent dummy symbol like \ddag, but I don't like this solution for different reasons (e.g. bad for people who want to copy the text from my pdf as they will copy my hidden dummy symbol as well):

\documentclass{scrartcl}
\usepackage{color}
\begin{document}
dummy symbol solution:
\frame{
\begin{minipage}[c][1cm][c]{0.1\linewidth}
\LARGE Good\textcolor{white}{\ddag}
\end{minipage}}
\frame{
\begin{minipage}[c][1cm][c]{0.2\linewidth}
\LARGE Morning\textcolor{white}{\ddag}
\end{minipage}}
\end{document}


Do you have any advices how to solve this problem?

• Usually in such cases what I does is to add \vphantom{g} in the definition of \end{...}. This will be a problem when we use boxes. – Jagath Jul 15 '13 at 13:28
• Use \strut instead of a whitened character. However, \frame is an undocumented macro and probably you should use \fbox – egreg Jul 15 '13 at 13:46
• @Jagath : Thanks for this comment. Could you explain it a little more in detail, maybe as an answer? For example: 1st. I didn't redefine \end before. 2nd. I didn't use \vphantom before - doesn't it leave a hidden symbol which I can copy as well? – matheburg Jul 15 '13 at 13:47
• @JohnWickerson Those optional arguments are not very much known, but they are legal and useful. – egreg Jul 15 '13 at 13:53
• @JohnWickerson : Take a look e.g. here. – matheburg Jul 15 '13 at 13:54

I don't know about the \frame{...} command you're using, but it seems that \fbox{...} is the one you want for this purpose: it makes the baseline of its contents respect the baseline of its environment.

Also, as Jagath AR has suggested, you can use \vphantom{...} rather than white text. Simpler still, you can use \strut.

\documentclass{article}
\begin{document}
\noindent
With struts:
\fbox{
\begin{minipage}[t]{16mm}
\LARGE Good\strut
\end{minipage}}
\fbox{
\begin{minipage}[t]{23mm}
\LARGE Morning\strut
\end{minipage}}
Without struts:
\fbox{
\begin{minipage}[t]{16mm}
\LARGE Good
\end{minipage}}
\fbox{
\begin{minipage}[t]{23mm}
\LARGE Morning
\end{minipage}}
\end{document}


• Thank you - this is the beautiful solution I was looking for! Nevertheless, the extended minipage options would make your solution looking much better ;-) – matheburg Jul 15 '13 at 13:58