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 looking for a (clean) way to keep text aligned in a situation like the following:

thesis under the direction of:    
[tab] Title [&] Name [&] University    
with the supervision of:    
[tab] Title [&] Name [&] University    
[tab] Title [&] Name [&] University    
[tab] Title [&] Name [&] University

The (dirty) way I found so far is to fix empirically the width of the first and second column. Here's an MWE

\documentclass[11pt]{article}
\begin{document}
\begin{titlepage}

\vspace*{\fill}

\noindent{\emph{thesis under the direction of}}\\[.3cm]
\hspace*{.4cm}\begin{tabular}{p{.1\textwidth}p{.4\textwidth}l}
Title & First Name Last Name  &  University A\\
\end{tabular}

\vspace*{.5cm}

\noindent{\emph{with the supervision of}}\\[.3cm]
\hspace*{.4cm}\begin{tabular}{p{.1\textwidth}p{.4\textwidth}l}
Title & First Name Last Name &  University B\\
Title & First Name Last Name &  University C\\
\end{tabular}
\end{titlepage}
\end{document}

I was just curious to know whether there would be a cleaner, more systematic way of doing that?

Thanks!

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Can you use tabbing?

\begin{tabbing}
\emph{thesis under the direction of} \\
\hspace{.4cm} \= Longest Title \= Longest First Name Last Name \= Longest University A \kill
\> Title \> First Name Last Name \> University A \\[.5cm]
\pushtabs
\emph{with the supervision of} \\
\poptabs
\> Title \> First Name Last Name \> University B \\
\> Title \> First Name Last Name \> University C \\
\end{tabbing}

result of the above code

(The \pushtabs and \poptabs commands are unneeded here, but may be useful in other casses.)

share|improve this answer
    
thanks a lot! I didn't know of the tabbing environment. –  tibL Jun 16 '12 at 10:41
add comment

Since you are willing to specify the longest entry for each column you could just define a macro to place the text within an appropriate sized box to yield:

enter image description here

Using a \parbox for the University name allows for longer names. The width of this paragraph is set to the width that would be taken up by Longest University.

Code:

\documentclass{article}
\usepackage{calc}

\newcommand*{\Attribution}[3]{%
    \par\noindent%
    \hspace*{0.5cm}% control leading indent
    \makebox[\widthof{Longest Title}][l]{#1}%
    \makebox[\widthof{Longest First Name Last Name}][l]{#2}%
    \parbox[t]{\widthof{Longest University}}{#3}%
}%

\begin{document}
\noindent
\emph{thesis under the direction of:} 
\Attribution{Title}{First Last}{University A}

\bigskip
\noindent
\emph{with the supervision of:}
\Attribution{Title}{First Name Last Name}{University A}
\Attribution{Title}{First Name Last Name}{University B}
\Attribution{Title}{First Name Last Name}{University C}
\Attribution{Title}{First Name Last Name}{University with a really long name}
\end{document}
share|improve this answer
    
thanks a lot, that's very neat! –  tibL Jun 17 '12 at 10:17
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.