77

I need to put some text at the same height in my page, and I'm trying to do it with a minipage, but I'm not able to do it since they get centre-aligned.

enter image description here

This is the LaTeX for the figure I've uploaded:

\begin{minipage}[]{0.5\textwidth}
    \begin{flushleft}
        {\large \textit{Author}:\vspace*{0.5cm} \\ 
        Me}
    \end{flushleft}
\end{minipage}%
%
\begin{minipage}[]{0.5\textwidth}
    \begin{flushright}
        {\large \textit{Supervisor}:\vspace*{0.5cm} \\ 
        Him}\\
        \vspace*{0.5cm}
        {\large \textit{Advisor}:\vspace*{0.5cm} \\ 
        Other Guy}
    \end{flushright}    
\end{minipage}%

Can you please explain me what I'm doing wrong?

2 Answers 2

100

Use [t] as the option -- \begin{minipage}[t]{0.5\textwidth}:

\documentclass{article}
\begin{document}
  \begin{minipage}[t]{0.5\textwidth}
    \begin{flushleft}
        \large \textit{Author}:\vspace*{0.5cm} \\
        Me
    \end{flushleft}
\end{minipage}%
%
\begin{minipage}[t]{0.5\textwidth}
    \begin{flushright}
        \large \textit{Supervisor}:\vspace*{0.5cm} \\
        Him\\
        \vspace*{0.5cm}
        \large \textit{Advisor}:\vspace*{0.5cm} \\
        Other Guy
    \end{flushright}
\end{minipage}%
\end{document}

enter image description here

12
  • 2
    @Matteo Nothing is silly here, once one doesn't know how to do something then it is important. It is after you see the solution that it becomes obvious.
    – azetina
    Commented Nov 8, 2012 at 19:20
  • 3
    When I try this with two unequal height images, it does not work - it still aligns on the bottom.
    – hola
    Commented Oct 18, 2017 at 16:36
  • 40
    This didn't work for me. What did work is to be sure to set the [t] position indicator for each minipage, and then to specify \vspace{0pt} at the top of each minipage. Then the resulting minipages are all aligned at the top of each other. I found this solution here: latex.org/forum/viewtopic.php?t=1059
    – jdods
    Commented Mar 4, 2019 at 4:10
  • 1
    @Christian Gold: an alternative is \mbox{}\\ Commented Sep 13, 2022 at 12:21
  • 1
    @jdods, thanks a lot, this is really a mystery to me why a \vspace{0pt} makes it work and what it really changes...
    – axkibe
    Commented Feb 26 at 10:53
28

Just to highlight the jdods user remark in the comments to David Carlisle's solution:

Although the solution given by user David Carlisle is fully functional for various cases, there are some cases because of the extra settings in the document, which do not allow to maintain the alignment, so the use of \ vspace {0pt} is a more complete solution but I believe it does not end for other possible deformations that could arise. The use of \ vspace {0pt} was pointed out by user jdods and therefore does not represent a response of my own. To do so, see https://latex.org/forum/viewtopic.php?t=1059 and consequently https://www.ctan.org/pkg/epslatex.

sample

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancybox}
\usepackage{geometry}
\thispagestyle{empty}
\begin{document}
\centering    
With \verb|\vspace{0pt}| at the top of each minipage of this example of a pair of minipages see below: %
\\
\fbox{
        \begin{minipage}{0.8\linewidth}\vspace{0pt}%
        \fontsize{10}{6}\selectfont Reference.
    \end{minipage}%
    }%
        \fbox{%
        \begin{minipage}{0.1\linewidth}\vspace{0pt}%
        \fontsize{10}{6}\selectfont Reference.
            \end{minipage}
    }
        \end{document}
2
  • 11
    Thanks for the \vspace{0pt}% trick. It saves the day when the minipage serves as a wrapping for pictures. Commented Jan 9, 2020 at 1:31
  • @FrancoisVigneron É nóis brother! Show de bola from Brazil!!! Good Luck! Commented Jan 9, 2020 at 3:32

You must log in to answer this question.

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