40

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?

57

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

  • It was a really silly question...thks ;) – Matteo Nov 8 '12 at 16:21
  • If you use a command like \large always include a paragraph end (\par or blank line) before the } that closes the scope, I know the ones here are just copied from the MWE:-) In this case you could more simply not have the { } and just let the \large end naturally at the end of the flushright environment. – David Carlisle Nov 8 '12 at 19:16
  • 1
    @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 Nov 8 '12 at 19:20
  • 1
    When I try this with two unequal height images, it does not work - it still aligns on the bottom. – pushpen.paul Oct 18 '17 at 16:36
  • 7
    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 Mar 4 at 4:10
1

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.