2

I have a very simple question:

% Cover letter using letter.cls
\documentclass{letter} % Uses 10pt
\usepackage[utf8]{inputenc}
\usepackage[colorlinks, linkcolor = black, citecolor = black, filecolor = black, urlcolor = blue]{hyperref}
\usepackage[pdftex]{graphicx}
%\usepackage{helvetica} % uses helvetica postscript font (download helvetica.sty)
%\usepackage{newcent}   % uses new century schoolbook postscript font 
% the following commands control the margins:
\topmargin=-1in    % Make letterhead start about 1 inch from top of page 
\textheight=8.5in    % text height can be bigger for a longer letter
\oddsidemargin=0pt   % leftmargin is 1 inch
\textwidth=6.5in     % textwidth of 6.5in leaves 1 inch for right margin

\begin{document}

%\signature{}           % name for signature 
\longindentation=0pt                       % needed to get closing flush left
\let\raggedleft\raggedright                % needed to get date flush left


\begin{letter}{address\\ of receiver}
%\begin{\left}
{\large\bf My Name} 
%\end{left}
\medskip\hrule height 1pt
%\begin{center}
\hfill prime stree, moon  \\ 
\hfill T: first phone, M:second phone \\ 
\hfill Email: \href{mailto:mymail}{mymail}
%\end{center} \vfill % forces letterhead to top of page


\opening{Dear Sir/Madam} 

\noindent first part

\noindent main part

\noindent whatever

\noindent etc. etc.

\closing{Yours faithfully,} 
\fromname{XYZ}
%\encl{}                    % Enclosures

\end{letter}


\end{document}

I would like to have the first and second phone as well as my email on the top right. How can this be achieved?

Here is a picture:

enter image description here

Note, using \hfill for all three lines i.e. prime street moon, T:... and Email:... displays just "prime street moon" on the top right.

  • \hfill{}Some line on the right\par? – musicman Apr 9 '14 at 18:19
  • @musicman I tried \hfill for all three lines, but just the first one was displayed on the right, see included picture. – m. th Apr 9 '14 at 19:43
3

Insert the details inside a tabular, that you can the shove over to the right using \hfill:

enter image description here

% Cover letter using letter.cls
\documentclass{letter} % Uses 10pt
\usepackage[utf8]{inputenc}
\usepackage[colorlinks, linkcolor = black, citecolor = black, filecolor = black, urlcolor = blue]{hyperref}
\usepackage[pdftex]{graphicx}
%\usepackage{helvetica} % uses helvetica postscript font (download helvetica.sty)
%\usepackage{newcent}   % uses new century schoolbook postscript font 
% the following commands control the margins:
\topmargin=-1in    % Make letterhead start about 1 inch from top of page 
\textheight=8.5in    % text height can be bigger for a longer letter
\oddsidemargin=0pt   % leftmargin is 1 inch
\textwidth=6.5in     % textwidth of 6.5in leaves 1 inch for right margin

\begin{document}

%\signature{}           % name for signature 
\longindentation=0pt                       % needed to get closing flush left
\let\raggedleft\raggedright                % needed to get date flush left


\begin{letter}{address\\ of receiver}
%\begin{\left}
{\large\bf My Name} 
%\end{left}
\medskip\hrule height 1pt
%\begin{center}
\null\hfill
\begin{tabular}{l}
  prime stree, moon  \\ 
  T: first phone, M:second phone \\ 
  Email: \href{mailto:mymail}{mymail}
\end{tabular}
%\end{center} \vfill % forces letterhead to top of page


\opening{Dear Sir/Madam} 

\noindent first part

\noindent main part

\noindent whatever

\noindent etc. etc.

\closing{Yours faithfully,} 
\fromname{XYZ}
%\encl{}                    % Enclosures

\end{letter}


\end{document}

There is a minor space between second phone and the right margin. This is the separation inherent in a tabular. You can remove this space by using the column specification l@{} instead of the current l. Of course, you can also adjust the alignment to suit your needs.

The \null marker sets an anchor, from which you can \hfill to the right margin. It's not really necessary.

There is really no need to set this (or any letter) in the letter document class.

  • Wener: Thanks! That was exactly what I was looking for! – m. th Apr 10 '14 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.