# Cannot get large centered text vertically aligned with flushed text

I cannot get the name to vertically align with the text on the left or the right. Using a table seems better but its still off.

Just to clarify below are my two attempts to vertically align the name with the contact info on both sides.

The first way is using a new command i created

The second uses a table

\documentclass[letterpaper]{article}
\usepackage[margin=0.75in]{geometry}
\usepackage{tabularx}

\def\name{John Doe}
\def\email{john.doe@gmail.com}
\def\phone{(123) 456-7890}

\def\city{Toronto}
\def\province{ON}
\def\postalCode{M5Y\thinspace4Z7}

\newcommand{\rTitle}{
\noindent
\centerline{\Huge \textsc \name} \\
\texttt{\phone} \hfill \city, \province \space \postalCode \\
}

\begin{document}
\rTitle

\noindent
\begin{tabularx}{\linewidth}{l >{\centering}X r}
\texttt{\phone} && \city, \province \space \postalCode \\
\end{tabularx}

\end{document}

• Welcome to TeX SE! Could you explain what you want it to look like? What exactly should align with what? – cfr Aug 6 '14 at 0:55
• updated Hope its more clear now – john Aug 6 '14 at 1:32
• If you are asking why the two examples aren't aligned then try to set \tabcolsep=0pt before the tabularx environment. BTW. The \\ after \centerline and after \postalCode are badly placed and cause the warning about underfull hbox. Remove them. – wipet Aug 6 '14 at 4:30

You could use three (vertically centered) side-by-side minipages:

The code:

\documentclass[letterpaper]{article}
\usepackage[margin=0.75in]{geometry}
\usepackage{tabularx}

\def\name{John Doe}
\def\email{john.doe@gmail.com}
\def\phone{(123) 456-7890}

\def\city{Toronto}
\def\province{ON}
\def\postalCode{M5Y\thinspace4Z7}

\newcommand{\rTitle}{%
\par\noindent
\begin{minipage}{.333\textwidth}
\texttt{\phone}
\end{minipage}%
\begin{minipage}{.333\textwidth}
\centering\Huge\textsc{\name}
\end{minipage}%
\begin{minipage}{.333\textwidth}
\raggedleft
\city, \province \space \postalCode
\end{minipage}\par%
}

\begin{document}

\rTitle

\end{document}


Beware of spurious blan spaces in your code.

This simple aligment can be done by simple tools without tabularx:

\centerline{\href{mailto:\email}{\nolinkurl{\email}} \hfill \address}
\centerline{\rlap{\texttt{\phone}}\hfill
\smash{\Huge \textsc \name}\hfill
\llap{\province \space \postalCode}}

• \textsc takes an argument, so this should be \textsc{\name}. – barbara beeton Aug 6 '14 at 13:10
• @barbarabeeton I've copied this part of the code for the original question and it works, because the parameter is only one token \name and the macro \textsc has one undelimited parameter. If the real parameter is one token then it could be in braces or not. On the other hand, you are right that the usage \textsc{\name} is more clear and educational. – wipet Aug 6 '14 at 16:51