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}
cfr
  • 198,882

2 Answers2

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.

cfr
  • 198,882
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}

Peter Grill
  • 223,288
  • thanks, I tried adding [t], but it didnt change the results – user169808 Oct 10 '19 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 %). – Peter Grill Oct 10 '19 at 20:11