![复制官方信头](https://linux22.com/image/251167/%E5%A4%8D%E5%88%B6%E5%AE%98%E6%96%B9%E4%BF%A1%E5%A4%B4.png)
我的大学和许多其他机构一样,并不真正了解 LaTeX。因此,信头仅以 MS Word 格式提供。以下(低质量)图像是我所拥有的最好的指南,它描述了尺寸、边距和字体。我需要复制信头(有些尺寸充其量是奇怪的)。
大学徽标可在以下网址找到WSU 视觉识别网站如下所示
我知道我可以使用包将徽标放置在规定的位置textpos
,但是如何添加水平线和右对齐的文本?
答案1
请参阅下面的编辑。
这是我第一次尝试。代码注释合理,但本质上我使用textpos
来放置徽标、tikz
添加额外的水平线和geometry
设置边距。子标题使用textpos
和放置\hfill
。页脚使用 放置在页面底部\vfill
。这适用于单页信件,但不适用于较长的信件(希望无论如何都能避免)。更好的解决方案可能是使用fancyhdr
。
\documentclass{article}
\usepackage[dvinames]{xcolor}
% Measurements are taken directly from the guide
\usepackage[top=2in,left=1.5in,bottom=0.5in,right=0.625in]{geometry}
\usepackage{graphicx}
\usepackage[colorlinks=false,
pdfborder={0 0 0},
]{hyperref}
\usepackage{lipsum}
\usepackage[absolute]{textpos}
\usepackage{tikz}
\usetikzlibrary{calc}
% A nice serif font, but no the prescribed nonfree ITC stone
\usepackage[oldstylenums]{kpfonts}
\usepackage[T1]{fontenc}
% No paragraph indentation
\parindent0pt
\setlength{\parskip}{0.8\baselineskip}
\raggedright
\pagestyle{empty}
% Define WSU official colors
\definecolor{WSUcrimson}{RGB}{152,30,50}
\definecolor{WSUgray}{HTML}{5e6a71}
% Ensure consistency in the footer
\urlstyle{sf}
\begin{document}
Date
\bigskip
Prof.~Wisman\\
Department of Wisemen\\
Wise State University \\
Wisetown, Wise\ \ 12345-6789\\
USA
Dear Prof.~Wiseman:
% Write the body of the letter
\lipsum[1]
Sincerely,
\vspace{4\baselineskip}
Me Myselfovsky \\
Assistant Professor
% -------------------------------------------------------
% Add logo, the text under the crimson line, and the line itself
\begin{textblock*}{2in}[0.3066,0.39](1.5in,1.33in)
\includegraphics[width=2in]{WSUlogo}
\end{textblock*}
\begin{textblock*}{6.375in}(1.5in,1.4in) % 6.375=8.5 - 1.5 - 0.625
\sffamily
\hfill \color{WSUgray} School of Electrical Engineering and Computer Science\\
\hfill Dr.~Me Myselfovsky, Assistant Professor
\end{textblock*}
\begin{tikzpicture}[remember picture,overlay]
\draw[color=WSUcrimson,line width=1pt] (current page.north west)+(1.5in,-1.33in) -- ($(-0.625in,-1.33in)+(current page.north east)$);
\end{tikzpicture}
% Add the footnote. A better way would be to use fancyhdr
\vfill
{\footnotesize\color{WSUgray}\sffamily
PO Box 642752, Pullman, WA 99164-2752\\[-0.1\baselineskip]
(509) 335-6249 \textbullet\ Fax: (509) 335-3818 \textbullet\ \url{[email protected]} \textbullet\ \url{http://eecs.wsu.edu/~me}
}
\end{document}
结果如下:
编辑
以下是更好的方法。将通用定义放在单独的文件中。页眉和页脚用于放置信头组件,因此长度超过一页的信件不会有问题。\AtBeginDocument
用于\AtEndDocument
放置称呼和签名。实际信件只需要\input
这些定义并添加适当的\renewcommand
s。
编辑2
}
通用定义代码块末尾缺失的问题已经修复。
常见定义:
% Define WSU official colors
\usepackage[dvinames]{xcolor}
\definecolor{WSUcrimson}{RGB}{152,30,50}
\definecolor{WSUgray}{HTML}{5e6a71}
% Measurements are taken directly from the guide
\usepackage[top=2in,left=1.5in,bottom=0.5in,right=0.625in]{geometry}
\usepackage{graphicx}
\usepackage[colorlinks=false,
pdfborder={0 0 0},
]{hyperref}
\usepackage[absolute]{textpos}
\usepackage{ifthen}
\usepackage{soul}
% --- For placement of the horizontal line
\usepackage{tikz}
\usetikzlibrary{calc}
% --- A nice serif font (palatino), but not the prescribed nonfree ITC stone
\usepackage[sc,osf]{mathpazo}
\linespread{1.05}
% Remove paragraph indentation
\parindent0pt
\setlength{\parskip}{0.8\baselineskip}
\raggedright
\pagestyle{empty}
% Ensure consistency in the footer
\urlstyle{sf}
\providecommand\WSUfromname{Me Myselfovsky}
\providecommand\WSUfromtitle{Assistant Professor}
\providecommand\WSUfromdegree{Ph.D.}
\providecommand\WSUfromdept{School of Electrical Engineering and Computer Science}
\providecommand\WSUfromaddress{PO Box 642752, Pullman, WA 99164-2752}
\providecommand\WSUfromtel{(509) 335-5555}
\providecommand\WSUfromfax{(509) 335-6666}
\providecommand\WSUfromemail{\url{[email protected]}}
\providecommand\WSUfromweb{\url{http://eecs.wsu.edu/~me}}
\providecommand\WSUtoname{Dr.~Wiseman}
\providecommand\WSUtoaddress{Department of Wisemen\\
Wise State University \\
Wisetown, Wise\ \ 12345-6789\\
USA}
\providecommand\WSUdate{\today}
\providecommand\WSUopening{Dear \WSUtoname}
\providecommand\WSUclosing{Sincerely}
% Update this and the next line to the correct path
\providecommand\WSUsignaturefile{AleeSignatureVector}
\providecommand\WSUlogofile{WSUlogo}
\providecommand\WSUenclosure{}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot{}
\fancyfoot[L]{%
{\footnotesize\color{WSUgray}\sffamily
\WSUfromaddress\\[-0.1\baselineskip]
\WSUfromtel\ \textbullet\ Fax: \WSUfromfax\ \textbullet\ \WSUfromemail\ \textbullet\ \WSUfromweb}\color{black}}
\fancyhead{}
\fancyhead[L]{%
\begin{textblock*}{2in}[0.3066,0.39](1.5in,1.33in)
\includegraphics[width=2in]{\WSUlogofile}
\end{textblock*}
\begin{textblock*}{6.375in}(1.5in,1.4in) % 6.375=8.5 - 1.5 - 0.625
\sffamily
\hfill \color{WSUgray} \WSUfromdept
\\ \hfill \WSUfromname, \WSUfromdegree
\end{textblock*}
\begin{tikzpicture}[remember picture,overlay]
\draw[color=WSUcrimson,line width=0.7pt] (current page.north west)+(1.5in,-1.33in) -- ($(-0.625in,-1.33in)+(current page.north east)$);
\end{tikzpicture}}
\renewcommand{\headrulewidth}{0pt}
\AtBeginDocument{
% Text lines should be less than 6in long
\newgeometry{top=2in,left=1.5in,bottom=1.2in,right=1in}
\WSUdate
\bigskip
\WSUtoname\ifthenelse{\equal{\WSUtoname}{}}{}{\\}
\WSUtoaddress
\bigskip
\WSUopening\par
}
\AtEndDocument{
\par\vspace{2ex}
\WSUclosing,
\ifthenelse{\equal{\WSUsignaturefile}{}}{\bigskip\bigskip}{\includegraphics[width=1.2in]{\WSUsignaturefile}\\[-0.2\baselineskip]}
\WSUfromname \\
\WSUfromtitle\ifthenelse{\equal{\WSUfromtitle}{}}{}{\\}
\WSUenclosure
}
信函正文:
这可以像下面这样简单:
\documentclass{article}
\usepackage{lipsum}
\input{WSUletterdefs}
\begin{document}
\lipsum[1-2]
\end{document}
答案2
首先,您需要查看 WSU 的使用指南以确保您没有违反任何规则,我猜您违反了有关徽标使用的规则。假设您可以在所需版本的信头布局上合法使用徽标,我不会专门使用 LaTeX 进行布局。我看到的问题是徽标中的线条。纯 LaTeX 解决方案需要添加完全匹配的线条(颜色、粗细和位置)以延长现有线条。我会在矢量图形程序(例如 Inkscape 或 Illustrator)中修改徽标中的线条延长至整页宽度。我还会将匹配颜色和字体的文本添加到线条中。我还将创建具有匹配颜色和字体的页脚的矢量图形版本。将页眉和页脚制作成图像的好处是您不需要在所有将编译信件的计算机上安装相应的字体。这也意味着您不必总是使用xelatex
。
有了这两个图像后,就可以将它们添加到页眉(向右对齐以使突出部分进入左边距)和页脚(向左对齐)的适当高度fancyhdr
。然后,您可以在文本主体中使用任何字体。