4

I am writing a letter using LaTeX's letter template, in which I include my e-mail address and phone numbers in the \address section. I would like to use icons from the marvosym package instead of writing "E-mail:" etc. Further, I would prefer for the e-mail address and phone numbers to be aligned as in a table.

Here is the code I try to use in the \address section:

\address{Kurt Han Peek \\ Piet Heinlaan 23 \\ 2341 SG  Oegstgeest \\ \begin{tabbing} \Letter \= \hspace{0.5em}\= [email protected] \\ \Mobilefone \> \>06-14920959 \\ \Telefon \> \> (071) 517 7081 \end{tabbing}}

However, I get the error: ! LaTeX Error: Something's wrong--perhaps a missing \item. in TeXworks. I suspect the tabbing environment can't be used in the \address, because it does work in the main text. I have also tried using a tabular environment which works, but the cells have some "padding", so the marvosym icons then are not left-aligned with the address above.

Any ideas on how to solve this would be much appreciated.

P.S. For the sake of completeness, here is the complete LaTeX code:

\documentclass{letter}
\usepackage{graphicx}
\usepackage[margin=2cm]{geometry}
\usepackage{marvosym}   
\usepackage[pdfborder=0]{hyperref}

%\address{Kurt Han Peek \\ Piet Heinlaan 23 \\ 2341 SG  Oegstgeest \\ \Letter~\href{mailto:[email protected]}{[email protected]} \\ %\Mobilefone~0614920959 \\ \Telefon~  071 517 7081}

\address{Kurt Han Peek \\ Piet Heinlaan 23 \\ 2341 SG  Oegstgeest \\ \begin{tabbing} \Letter \= \hspace{0.5em}\= [email protected] \\ \Mobilefone \> \>06-14920959 \\ \Telefon \> \> (071) 517 7081 \end{tabbing}}

\date{23 februari 2012}
\begin{document}
\begin{letter}{TNO \\ t.a.v. Maaike Blikslager \\ High Tech Campus 5 \\ 5656 AE  Eindhoven}
\opening{Beste ...,}
Graag wil ik solliciteren op de functie .... Het werk van de ...groep sluit goed aan bij interesses en carri\`eredoelen, ik en zou me verheugen om mijn kandidatuur persoonlijk met u te bespreken.

 \begin{tabular}{r@{\hspace{1em}}l}
  \Letter&\href{mailto:[email protected]}{[email protected]}\\                        
  \Mobilefone&06 14920959\\                          
  \Telefon&(071) 517 7081\\ \end{tabular}

\begin{tabbing}
\Letter \= \hspace{0.5em} \= [email protected] \\
\Mobilefone \> \>06-14920959 \\
\Telefon \> \> (071) 517 7081
\end{tabbing}

Bedankt voor uw tijd, en ik verheug me op uw reactie.

\closing{Met vriendelijke groet, \\
%\fromsig{\includegraphics[scale=0.5]{signature_kurt.jpg}} \\
\fromname{Kurt Peek}
}

\end{letter}
\end{document}

2 Answers 2

3

You can "simulate" the tabbing behaviour using \hbox to <length>{...}, the following code is self-explanatory I hope:

\def\addresssymbol#1{\hbox to 1.2em{#1}} % <-- set a good length here

\address{Kurt Han Peek \\ Piet Heinlaan 23 \\ 2341 SG  Oegstgeest
\\ \addresssymbol{\Letter} [email protected]
\\ \addresssymbol{\Mobilefone} 06-14920959
\\ \addresssymbol{\Telefon} (071) 517 7081
}
2
  • Awesome! Works like a charm. Thanks, tohecz!
    – Kurt Peek
    Commented Feb 24, 2012 at 12:47
  • In that case you should mark the answer as accepted so that others see the problem was solved (see the FAQ here)
    – yo'
    Commented Feb 24, 2012 at 13:20
2

You can exploit the fact that a minipage containing only a tabbing environment will be as wide as necessary:

\address{Kurt Han Peek \\ Piet Heinlaan 23 \\ 2341 SG  Oegstgeest \\
  \begin{minipage}{\textwidth}
  \begin{tabbing}
  \Letter \= \hspace{0.5em}\= [email protected] \\
  \Mobilefone \> \>06-14920959 \\
  \Telefon \> \> (071) 517 7081
  \end{tabbing}
  \end{minipage}}

But probably you can make better use of a tabular environment, that will free you from the necessity to guess at the symbols' widths:

\address{Kurt Han Peek \\ Piet Heinlaan 23 \\ 2341 SG  Oegstgeest \\
  \begin{tabular}{@{}l@{ }l}
  \Letter     & \texttt{[email protected]} \\
  \Mobilefone & 06-14920959 \\
  \Telefon    & (071) 517 7081
  \end{tabular}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .