# Using the res.cls LaTeX file, how do I centre the address?

Right now, it would look something like this for the address area:

Obviously the last line is not centred, but I'd like it to be. Here's the code so far:

% LaTeX resume using res.cls
\documentclass[11pt]{res} % default is 10 pt
%\usepackage{newcent}   % uses new century schoolbook postscript font
\usepackage{latexsym}   % to get the \Box symbol
\setlength{\textheight}{10in} % increase text height to fit resume on 1 page
\topmargin=-0.5in % start text higher on the page

\begin{document}

\name{ANDREW J. MALONE}
\address{739 Mill Grove Drive \\  Audubon, PA 19403 \\  (215) 555-2216}


It uses the res.cls file that is used for resume development. What would I modify to centre that?

-

## migrated from stackoverflow.comJan 17 '13 at 12:12

This question came from our site for professional and enthusiast programmers.

If you want the entire \opening to be centred, then the following redefinition of \@tablebox works:

\makeatletter
\def\@tablebox#1{\begin{tabular}[t]{@{}c@{\extracolsep{\fill}}}#1\end{tabular}}
\makeatother


The original \@tablebox used a left-aligned column:

%\let\latexnofiles\nofiles % If you're using references in your resume
%\let\nofiles\relax % See http://tex.stackexchange.com/a/94528/5764
\documentclass[11pt]{res} % default is 10 pt
%\usepackage{newcent}   % uses new century schoolbook postscript font
\usepackage{latexsym}   % to get the \Box symbol
\setlength{\textheight}{10in} % increase text height to fit resume on 1 page
\topmargin=-0.5in % start text higher on the page

\makeatletter
\def\@tablebox#1{\begin{tabular}[t]{@{}c@{\extracolsep{\fill}}}#1\end{tabular}}
\makeatother

\begin{document}
\name{ANDREW J.\ MALONE}
\address{739 Mill Grove Drive \\  Audubon, PA 19403 \\  (215) 555-2216}
\opening
\end{document}


Alternatively, if you wish to have a left-aligned address with your name, use

\makeatletter
\def\@tablebox#1{%
\setbox9=\hbox{\namefont\@name}%
\begin{tabular}[t]{@{}p{\wd9}@{\extracolsep{\fill}}}#1\end{tabular}}
\makeatother


This is a very particular solution to your current setup. A more general solution would be required where the name length and font size could vary. However, without more detail, this should be sufficient.

%\let\latexnofiles\nofiles % If you're using references in your resume
%\let\nofiles\relax % See http://tex.stackexchange.com/a/94528/5764
\documentclass[11pt]{res} % default is 10 pt
%\usepackage{newcent}   % uses new century schoolbook postscript font
\usepackage{latexsym}   % to get the \Box symbol
\setlength{\textheight}{10in} % increase text height to fit resume on 1 page
\topmargin=-0.5in % start text higher on the page

\makeatletter
\def\@tablebox#1{%
\setbox9=\hbox{\namefont\@name}%
\begin{tabular}[t]{@{}p{\wd9}@{\extracolsep{\fill}}}#1\end{tabular}}
\makeatother

\begin{document}
\name{ANDREW J.\ MALONE}
\address{739 Mill Grove Drive \\  Audubon, PA 19403 \\  (215) 555-2216}
\opening
\end{document}


On a side note: res removes the capability to use references within your document. See Problem using etaremune (reversing the labels of items in a list) for an associated problem and fix for this.

Also, there is no particular need to use the res class for creating a resume. It is possible to use the default article class to replicate the layout, yet have some additional freedom in terms of the layout. Moreover, moderncv provides a stylish take on resumes as well.

-