Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex minipage to align groups of text

Tags:

latex

tex

I am trying to get two minipage sections to show up next to each other. They always show up one underneath the other currently below is an example of my .tex

Example:

\begin{minipage}[b]{1in}
   Hello World akdjfasljdfkjasjdfjsadkflkjksadflkaskjdfsadlflkjsafdalkjsfd
\end{minipage}
\begin{minipage}[b]{1in}
   Hello World akdjfasljdfkjasjdfjsadkflkjksadflkaskjdfsadlflkjsafdalkjsfd
\end{minipage}
like image 823
Larry Avatar asked Oct 16 '09 14:10

Larry


1 Answers

You need to remove the newline from one minipage to the other.

\begin{minipage}{1in}
   Hello World akdjfasljdfkjasjdfjsadkflkjksadflkaskjdfsadlflkjsafdalkjsfd
\end{minipage}\begin{minipage}{1in}
   Hello World akdjfasljdfkjasjdfjsadkflkjksadflkaskjdfsadlflkjsafdalkjsfd
\end{minipage}

You can keep the newline if you fake it with the comment character

\begin{minipage}{1in}
   Hello World akdjfasljdfkjasjdfjsadkflkjksadflkaskjdfsadlflkjsafdalkjsfd
\end{minipage}%
\begin{minipage}{1in}
   Hello World akdjfasljdfkjasjdfjsadkflkjksadflkaskjdfsadlflkjsafdalkjsfd
\end{minipage}

Note that if the accumulated width of minipages is too wide, the next one will drop to the next line (kind of like floating divs... if you do css). In order to worry about this less, I generally give my minipages a width which is a fraction of the line width. For instance \begin{minipage{0.25\linewidth}. You have to account for a little separation and I dont know what relevant tex variables handle the glue in this case, but if I keep the total less than or equal to 0.99\linewidth things seem to be ok.

HTH

like image 92
cheshirekow Avatar answered Sep 20 '22 17:09

cheshirekow