我正在使用文档类scrlttr2
制作一封求职信,但由于这是一封商务信函,因此日期需要左对齐并位于地址上方。通过使用解决方法这里我可以将其左对齐,但我不知道如何更改日期的位置,并且对齐方式与信件主体相匹配,而不是地址部分。由于其他所有内容都恰好是我想要的位置,所以我不想切换到另一个类别,我希望这里有人可以帮助我。
这是我的示例代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Short Stylish Cover Letter
% LaTeX Template
% Version 1.0 (28/5/13)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Stefano (http://stefano.italians.nl/archives/63)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
% IMPORTANT: THIS TEMPLATE NEEDS TO BE COMPILED WITH XeLaTeX
%
% The two fonts used in this template: Adobe Garamond Pro and Gill Sans
% do not come with Windows by default. You will need to download them in
% order to get an output as in the preview PDF. Otherwise, change those
% fonts to fonts that do come with Windows or comment out the lines to use
% the default font.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------------------------------- --
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%-------------------------------------------------------------------------------------- --
\documentclass{scrlttr2}
\usepackage{fontspec} % Allows font customization
\usepackage{marvosym} % Allows the use of symbols
\usepackage[english]{babel} % Required to compile in Windows
\usepackage{graphicx}
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\defaultfontfeatures{Mapping=tex-text}
%\setmainfont {Adobe Garamond Pro} % Main document font
\setsansfont {Cambria} % Used in the from address line above the to address
\renewcommand{\normalsize}{\fontsize{11.5}{12}\selectfont} % Sets the font size and leading
\setkomavar{date}{\flushleft\vspace{-\baselineskip}\today\par}
%-------------------------------------------------------------------------------------- --
% HEADER SECTION
%----------------------------------------------------------------------------------------
\firsthead{
\centering
{\addfontfeature{LetterSpace=20.0}\fontsize{36}{36}\selectfont\scshape Peter Maguire}\\ [5mm]
\fontsize{21}{21}\selectfont\scshape My Job \\ My Institution } % Your current job title
\begin{document}
%----------------------------------------------------------------------------------------
% COVER LETTER CONTENTS
%-------------------------------------------------------------------------------------- --
\begin{letter}{ % Address of the company you are applying to
Biotech Company \\
123 Street Street \\
Washington, CA 12345
}
\opening{Biotech Company HR Manager,}
\begin{sloppypar}
Main section here
\\
\end{sloppypar}
Sincerely, \\
Peter Maguire
%-------------------------------------------------------------------------------------- --
\end{letter}
\end{document}
输出结果如下:
这大致就是我想要的样子:
有哪位对这方面更熟练的人有什么想法吗?
答案1
有时你可能需要稍微作弊一下……
下面我将日期设置为地址的一部分,留空date
:
\documentclass{scrlttr2}
%\usepackage{fontspec} % Allows font customization
%\usepackage{marvosym} % Allows the use of symbols
\usepackage[english]{babel} % Required to compile in Windows
\usepackage{graphicx}
\setlength\parindent{0pt} % Removes all indentation from paragraphs
%\defaultfontfeatures{Mapping=tex-text}
%\setmainfont {Adobe Garamond Pro} % Main document font
%\setsansfont {Cambria} % Used in the from address line above the to address
\renewcommand{\normalsize}{\fontsize{11.5}{12}\selectfont} % Sets the font size and leading
%\setkomavar{date}{\flushleft\vspace{-\baselineskip}\today\par}
\setkomavar{date}{\vspace*{-\baselineskip}}
%-------------------------------------------------------------------------------------- --
% HEADER SECTION
%----------------------------------------------------------------------------------------
\setkomavar{firsthead}{
\centering
{%\addfontfeature{LetterSpace=20.0}
\fontsize{36}{36}\selectfont\scshape Peter Maguire}\\[5mm]
\fontsize{21}{21}\selectfont\scshape My Job \\ My Institution } % Your current job title
\begin{document}
%----------------------------------------------------------------------------------------
% COVER LETTER CONTENTS
%-------------------------------------------------------------------------------------- --
\begin{letter}{ % Address of the company you are applying to
\today \par \vspace*{2\baselineskip}
Biotech Company \\
123 Street Street \\
Washington, CA 12345
}
\opening{Biotech Company HR Manager,}
\begin{sloppypar}
Main section here \\
\end{sloppypar}
Sincerely, \\
Peter Maguire
%-------------------------------------------------------------------------------------- --
\end{letter}
\end{document}