梅威瑟:
\documentclass[12pt]{letter}
\usepackage[english]{babel}
\usepackage{lipsum}
\begin{document}
\begin{letter}
{Name \\
Address \\
Location }
%\date{February 15, 2023}
\opening{Dear ---,}
\lipsum[3]
\closing{Sincerely yours,\\[2pt]Me}
\end{letter}
\end{document}
输出:
我想垂直重新定位日期,使其位于“地点”和“亲爱的---”之间(右对齐)。我该怎么做?
答案1
代码:
\documentclass[12pt]{letter}
\usepackage[english]{babel}
\usepackage{lipsum}
\makeatletter
\renewcommand*\opening[1]{\ifx\@empty\fromaddress
\thispagestyle{firstpage}%
{\toname \\
\toaddress \\[\parskip]
\hspace*{\fill}\@date % https://tex.stackexchange.com/a/195781/273733
\par}%
\else % home address
\thispagestyle{empty}%
{\raggedleft\begin{tabular}{l@{}}\ignorespaces
\fromaddress \\*[2\parskip]%
\@date \end{tabular}\par}%
\fi
{\raggedright}%
#1\par\nobreak}
\makeatother
\begin{document}
\begin{letter}
{Name \\
Address \\
Location }
%\date{February 15, 2023}
\opening{Dear ---,}
\lipsum[3]
\closing{Sincerely yours,\\[2pt]Me}
\end{letter}
\end{document}