我有一个非常简单的问题:
% 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}
我想将第一和第二个手机号码以及电子邮件显示在右上角。如何实现?
这是一张图片:
请注意,使用\hfill
所有三行,即 prime street moon、T:... 和 Email:... 在右上角仅显示“prime street moon”。
答案1
在 里面插入详细信息tabular
,然后可以使用 将其推到右侧\hfill
:
% 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}
和右边距之间有一个小空格second phone
。这是 固有的分隔tabular
。您可以使用列规范l@{}
代替当前的 来删除此空格l
。当然,您也可以调整对齐方式以满足您的需要。
标记\null
设置了一个锚点,您可以从该锚点\hfill
移动到右边距。其实这并不是必需的。
确实没有必要在letter
文档类中设置这个(或任何字母)。
答案2
上面给出的所有回复都没有必要那么复杂。最简单的方法是在 \begin{letter} 宣告之前给出以下命令:
\address{
line 1 of sender's address\\
line 2 of sender's address\\
line 3 ...
}
根据需要使用任意多行。地址行也可以包含电子邮件地址。“信件”文档类会自动将地址放在信件的右上角,并将行移到右侧。