4

I am using the following code to try to obtain something to the effect of

Author:                      Laboratory Partners:
Amos NG                      Rebecca ROYCROFT
                             Nora BRACKBILL
Professor:
Huan HUANG

The code:

\begin{minipage}{0.4\textwidth}
\begin{flushleft} \small
\emph{Author:}\\
Amos \textsc{Ng}\\[0.4cm]
\emph{Professor:} \\
Huan \textsc{Huang}
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \small
\emph{Laboratory Partners:} \\
Rebecca \textsc{Roycroft}\\
Nora \textsc{Brackbill}
\end{flushright}
\end{minipage}

The resulting output:

enter image description here

How can I achieve the layout I want here?

1
  • try \begin{minipage}[t]{0.4\textwidth} for the two minipage environments Commented Apr 2, 2011 at 7:45

2 Answers 2

2

I assume you're trying to get the effect of having the longest line on the right appear flush-right.

Rather than minipage I'd be inclined to use top-aligned tabular, as these automatically adjust their size, with an \hfill to align them to their respective edges.

Edit: Added @{} to the column specs to remove whitespace at the margins.

Something like this:

\begin{tabular}[t]{@{}l}
\emph{Author:}\\
Amos \textsc{Ng}\\
\rule{0.4cm}{0cm}\\% A strut for the extra line space
\emph{Professor:} \\
Huan \textsc{Huang}
\end{tabular}
\hfill
\begin{tabular}[t]{l@{}}
\small
\emph{Laboratory Partners:} \\
Rebecca \textsc{Roycroft}\\
Nora \textsc{Brackbill}
\end{tabular}
3

There is two thing you could use:

  • minipage have an optional position parameter that you should set to t for top aligning
  • the \hfill command will create a space between the 2 mimipage that will fill all available place.

    \begin{minipage}[t]{0.4\textwidth}
     .....
    \end{minipage}
    \hfill
    \begin{minipage}[t]{0.4\textwidth}
    .....
    \end{minipage}
    
2
  • hfillis not necessary. The OP uses flushleftand flushright so it's possible to modify the size of the minipages like this : \begin{minipage}[t]{0.5\textwidth}` Commented Apr 2, 2011 at 7:53
  • In is exemple, it seem that he wanted to flushleft the right part, hence the hfill.
    – Rémi
    Commented Apr 2, 2011 at 14:59

You must log in to answer this question.

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