![在 moderncv 信件中添加“主题”字段](https://linux22.com/image/340357/%E5%9C%A8%20moderncv%20%E4%BF%A1%E4%BB%B6%E4%B8%AD%E6%B7%BB%E5%8A%A0%E2%80%9C%E4%B8%BB%E9%A2%98%E2%80%9D%E5%AD%97%E6%AE%B5.png)
正如论坛上所讨论的latex-community:如何在信件中包含主题,我想在 moderncv 信函模板中添加一个额外的字段“主题:”。
\bigskip
\textbf{Subject: \@subject}
\bigskip\noindent
新的\makeletterhead
命令将会是这样的:
\renewcommand*{\makeletterhead}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputeletterlengths%
% sender block
\makehead%
\par%
% recipient block
\begin{minipage}[t]{.5\textwidth}
\raggedright%
\addressfont%
{\bfseries\upshape\@recipientname}\\%
\@recipientaddress%
\end{minipage}
% date
\hfill% US style
% \\[1em]% UK style
\@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
%_______________________
\bigskip
\textbf{Subject: \@subject}
\bigskip\noindent
%_______________________
% opening
\raggedright%
\@opening\\[1.5em]%
% ensure no extra spacing after \makelettertitle due to a possible blank line
% \ignorespacesafterend% not working
\hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}
\@subject
不要忘记,应该在某处检索参数。
编辑
问题是如何添加“主题”字段,以便在\makelettertitle
执行命令时将主题文本放在开头语句之前。
答案1
谢谢大卫·卡莱尔的评论我已经纠正了我的尝试,这是一个例子:
\documentclass[10pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}
\nopagenumbers{}
\renewcommand*{\namefont}{\fontsize{20}{29}\mdseries\upshape}
\firstname{LaTeX}
\familyname{MiKTeX}
\address{Tex.Stackexchange.com}{0000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
%%%%
%Add the field "Subject" to the definition of the letter header
\makeatletter
\newcommand\subject[1]{\def\@subject{#1}}
\renewcommand*{\makeletterhead}{%
\makehead%
\par%
\begin{minipage}[t]{.5\textwidth}
\raggedright%
\addressfont%
{\bfseries\upshape\@recipientname}\\%
\@recipientaddress%
\end{minipage}
% date
\hfill% US style
% \\[1em]% UK style
\@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
%________ADDED_<<<<<<
\bigskip
\textbf{Subject: \@subject}\\
\noindent
%_______________________
% opening
\raggedright%
\@opening\\[1.5em]%
% ensure no extra spacing after \makelettertitle due to a possible blank line
\hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}
\makeatother
%%%
\begin{document}
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\Some City 00000}
\date{Septembre 05, 2016}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\subject{Apply for...}
\makelettertitle
Duis sit amet magna ante, at sodales diam. Aenean consectetur porta risus et sagittis. Ut interdum, enim varius pellentesque tincidunt, magna libero sodales tortor, ut fermentum nunc metus a ante. Vivamus odio leo, tincidunt eu luctus ut, sollicitudin sit amet metus. Nunc sed orci lectus. Ut sodales magna sed velit volutpat sit amet pulvinar diam venenatis.
\makeletterclosing
\end{document}
该命令的定义\makeletterhead
取自moderncvbodyiii.sty因为banking
样式(在示例中使用)使用moderncvbodyiii.sty
文件。