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.

Here are the two text boxes:

\begin{tabular}{l@{}}
     Date: 3 Jan. 2500  \\
     Place: Moon \\
\end{tabular}


\null\hfill\begin{tabular}{l@{}}
     Prof. Neil Armstrong \\
     Department of Moon Studies \\
     Moon University
\end{tabular}

What is the easy way to make those boxes start on the same line? The first box should be on the right, and second one should be on the left. The text in the box should be flushed left. The first two lines of text in both the boxes should be on the same horizontal line.

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

First of all remove the empty line between them, they are producing a paragraph break. The tabulars can be top align using the optional argument of tabular.

Putting a \hfill between both tabulars without any empty lines should already do the trick. You can however also use an \hbox with a fixed width to ensure that they are always on the same line.

\documentclass{article}

\begin{document}
\noindent
\leavevmode\hbox to \linewidth{%
\begin{tabular}[t]{l@{}}
     Date: 3 Jan. 2500  \\
     Place: Moon \\
\end{tabular}
\hfill
\begin{tabular}[t]{l@{}}
     Prof. Neil Armstrong \\
     Department of Moon Studies \\
     Moon University
\end{tabular}%
}

\end{document}

Output:

enter image description here

share|improve this answer
    
Would be a good idea to use \hss instead of \hfill? This way, if the two tables do not fit in \linewidth, they will overlap at the middle, instead of protruding the right margin. –  JLDiaz Jan 3 '13 at 12:01
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.