2

Hi I am trying to force text to the top of a minipage, but nothing seems to be working. I am still new to Latex do I dont know much. I am using overleaf to edit the file I put two minipages side by side, the right side is what I expect, but the left side is keeping everything in the center of the minipage. this is what the text looks like (I want B862a to go to the top of the page)

enter image description here

the code that is supposed to generate this part is this:

\documentclass{article}     
\usepackage{csquotes}
\usepackage{lipsum}  

\begin{document}

{
    \vspace*{\fill}                 % Posição vertical
    %\hrule                         % Linha horizontal
    \begin{center}
        \begin{minipage}[c]{11.5cm}
            \begin{center}
                \lipsum[3]   
            \end{center}
        \end{minipage}
    \end{center}
    \vspace{5 mm}
    \fbox{
        \begin{center}                  % Minipage Centralizado
            \begin{minipage}[]{12.5cm}        % Largura
                \begin{minipage}[t]{.1\textwidth}
                    B862a
                    \vspace{\fill}
                \end{minipage}
                \begin{minipage}[]{.80\textwidth}
                    \lipsum[2]
                    \hspace{2mm}
                \end{minipage}
            \end{minipage}
        \end{center}
    }
    %\hrule
}


\end{document}
3
  • 2
    Please make your snippet compilable. I expect you want to adjust the alignment of the minipages rather than of their contents.
    – cfr
    Oct 10, 2019 at 1:14
  • ok, I changed the code to something runnable outside of my original document, sorry
    – user169808
    Oct 10, 2019 at 13:06
  • The code gives me an error. Does it compile for you?
    – cfr
    Oct 10, 2019 at 17:04

2 Answers 2

4

The code posted gives me an error as written. When that's corrected, I get overfull boxes, but Peter Grill's answer seems to work fine.

Do you want something like this?

\documentclass[]{article}     
\usepackage{csquotes}
\usepackage{lipsum}  

\begin{document}
\vspace*{\fill}%                 % Posição vertical
\begin{center}
  \begin{minipage}[c]{11.5cm}
    \begin{center}
      \lipsum[3]\bigskip
    \end{center}
  \end{minipage}
\bigskip\par% skips are better than absolute dimensions like 5mm when you can use them
\noindent% don't indent this paragraph
\fbox{\centering% the center environment gives an error here. Change the padding of the box or insert e.g. \smallskip\par if you want more spacing
  \begin{minipage}[]{.95\textwidth}% 12.5cm is too wide for the page layout  % Largura
    \begin{minipage}[t]{.1\textwidth}
      B862a
    \end{minipage} % note the space between the minipages here (a new line is a space unless commented)
    \begin{minipage}[t]{.80\textwidth}
      \lipsum[2]
    \end{minipage}
  \end{minipage}%
}
\end{center}
\end{document}

output

Note that you really don't need csquotes for the example.

1
  • thanks, thats exactly what I was after, I wonder why the code I posted runs on my account.
    – user169808
    Oct 11, 2019 at 0:18
3

Using a [t] alignment option for the minipage seems to work for this case:

enter image description here

References

Code:

\documentclass[a4paper]{article}

\begin{document}
\begin{minipage}[t]{.1\textwidth}
    B862a
\end{minipage}%
\begin{minipage}[t]{.75\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et blandit velit. Quisque lorem diam, aliquam sit amet nibh eu, facilisis hendrerit nulla. Nulla et auctor leo. Sed eros ligula, rhoncus a tristique ac, congue sit amet nisi. Duis semper ut mi id congue. Pellentesque ut purus vel diam posuere tincidunt. Integer luctus placerat accumsan. 
\end{minipage}
\end{document}
2
  • thanks, I tried adding [t], but it didnt change the results
    – user169808
    Oct 10, 2019 at 13:07
  • @user169808: Adding the \t option to both of the minipages in your current MWE seems to work fine (after using the \centering macro instead of center environment). You should also use \fbox{% instead of \fbox{ (ie, add a trailing %). Oct 10, 2019 at 20:11

You must log in to answer this question.

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