How can I insert address blocks on the left and right side of the page?
There are many ways to do this. The way I would choose to do it is to use a \minipage
and specify the width of the two minipages:
\documentclass{article}
\begin{document}
\begin{minipage}{0.60\linewidth}
\textbf{Local Address}\par
123 Main Street\par
Anytown, XXX\par
Email: [email protected]
\end{minipage}
\hfill
\begin{minipage}{0.35\linewidth}
\textbf{Permanent Address}\par
656 Somewhere\par
Some Other Town, YYY\par
Phone: 555-555-1212
\end{minipage}
\end{document}
Alternatively, you could also use a tabular
environment such and use p{3.5in}
to fix the width of the first column:
\documentclass{article}
\begin{document}
\begin{tabular}{p{3.5in}l}
\textbf{Local Address} & \textbf{Permanent Address}\\
123 Main Street & 656 Somewhere\\
Anytown, XXX & Some Other Town, YYY\\
Email: [email protected] & Phone: 555-555-1212
\end{tabular}
\end{document}
If you really want to use the \makebox
command, you need to do something like this:
\documentclass{article}
\begin{document}
\noindent
\makebox[3.5in][l]{\textbf{Local Address}} \textbf{Permanent Address}\\
\makebox[3.5in][l]{123 Main Street} 656 Somewhere\\
\makebox[3.5in][l]{Anytown, XXX} Some Other Town, YYY\\
\makebox[3.5in][l]{Email: [email protected]} Phone: 555-555-1212
\end{document}
The first paramter to \makebox
specifies the width to be 3.5in, and the [l]
specifies that the text to be placed in that box is to be left aligned. The \noindent
was needed so that TeX does not add the usual indentation of the first paragraph. Instead of \\
at the end you could also have used \par\noindent
.
Similarily, there is also the \parbox
option:
\documentclass{article}
\begin{document}
\noindent
\parbox{3.5in}{\textbf{Local Address}} \textbf{Permanent Address}\\
\parbox{3.5in}{123 Main Street} 656 Somewhere\\
\parbox{3.5in}{Anytown, XXX} Some Other Town, YYY\\
\parbox{3.5in}{Email: [email protected]} Phone: 555-555-1212
\end{document}
Here is a way to do it using the varwidth
package. It provides the varwidth
environment that is similar to minipage
, but allows for a "natural width" rather than the "fixed width" box of minipage
.
Two examples below show how you can (i) align your addresses flush left and right with the page margin, or (ii) right-align (\raggedleft
) the second address at 50% of the text block width. Other options, of course, are also available. Although possible, neither of these options are that easy to do in a general way using minipage
due to it's fixed width nature.
\documentclass{article}
\usepackage[showframe]{geometry}% http://ctan.org/pkg/geometry
\usepackage{varwidth}% http://ctan.org/pkg/varwidth
\begin{document}
% ========= local address left | permanent address right
\noindent\begin{varwidth}{0.5\linewidth} % local address
Local Address\par
123 Main Street\par
Anytown, XXX\par
Email: [email protected]
\end{varwidth} \hfill
\begin{varwidth}{0.5\linewidth}% permanent address
Permanent Address\par
656 Somewhere\par
Some Other Town, YYY\par
Phone 555-555-1212
\end{varwidth}
\bigskip
% ========= local left | permanent middle
\noindent\begin{minipage}{0.5\linewidth} % local address
Local Address\par
123 Main Street\par
Anytown, XXX\par
Email: [email protected]
\end{minipage}%
\begin{varwidth}{0.5\linewidth}% permanent address
\raggedleft
Permanent Address\par
656 Somewhere\par
Some Other Town, YYY\par
Phone 555-555-1212
\end{varwidth}
\end{document}
geometry
with the showframe
option was merely used to showcase the page layout boundaries.