Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
try \begin{minipage}[t]{0.4\textwidth} for the two minipage environments –  Alain Matthes Apr 2 '11 at 7:45
add comment

2 Answers

up vote 2 down vote accepted

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}
share|improve this answer
add comment

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}
    
share|improve this answer
    
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}` –  Alain Matthes Apr 2 '11 at 7:53
    
In is exemple, it seem that he wanted to flushleft the right part, hence the hfill. –  Rémi Apr 2 '11 at 14:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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