我用它moderncv
来获取求职信。在文档的上半部分,LaTeX 设置了公司的地址行。问题是,地址行的第一部分有粗体字母。但是,我希望所有内容都不使用粗体字母。
细节
关键命令是{}
收件人行的第一个命令(参见 MWE)。第一个命令{}
使文本变为粗体。我想让第一个命令保持{}
自由以避免使用粗体字母。但是,如果我这样做,LaTeX 会输出错误。您知道如何解决这个问题吗?
提前谢谢了。
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvtheme[black]{banking}
\usepackage[scale=0.75, top=20mm, bottom=15mm]{geometry}
\usepackage{graphicx} %notwendig für eingescannte Unterschrift.
\usepackage[ngerman]{babel} %notwendig für die Darstellung des Datums in deutscher Weise.
\makeatletter
\newcommand*{\birthdate}[1]{\def\@birthdate{#1}}
\newcommand*{\civilstatus}[1]{\def\@civilstatus{#1}}
\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}
% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!60}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}r@{}}%
\ifthenelse{\isundefined{\@birthdate}}{}{\makenewline{\@birthdate}}%
\ifthenelse{\isundefined{\@civilstatus}}{}{\makenewline{\@civilstatus}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}%
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
%\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
%\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}
}%
% optional photo (pre-rendering)
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{}}}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
{}%
\begin{minipage}[b]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@familyname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
\hfill%
% detailed information
\llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo (rendering)
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
%------------------
\makeatother
% personal data
\firstname{John}
\familyname{Doe}
\title{Title}
\birthdate{Birthday}
\photo[64pt][0.4pt]{picture}
\begin{document}
%----- letter ---------------------------------------------------------
% recipient data
\recipient{Company}{Street\\ City}
\date{\today}
\opening{To who it may concern:}
\closing{Kind regards,}
\makelettertitle
%------------------------------
Hello
%----------Schlussformel-------
\makeletterclosing
\end{document}
答案1
你可以简单地写
\recipient{\mdseries Company}{Street\\ City}
梅威瑟:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvtheme[black]{banking}
\usepackage[scale=0.75, top=20mm, bottom=15mm]{geometry}
\usepackage{graphicx} %notwendig für eingescannte Unterschrift.
\usepackage[ngerman]{babel} %notwendig für die Darstellung des Datums in deutscher Weise.
\makeatletter
\newcommand*{\birthdate}[1]{\def\@birthdate{#1}}
\newcommand*{\civilstatus}[1]{\def\@civilstatus{#1}}
\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}
% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!60}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}r@{}}%
\ifthenelse{\isundefined{\@birthdate}}{}{\makenewline{\@birthdate}}%
\ifthenelse{\isundefined{\@civilstatus}}{}{\makenewline{\@civilstatus}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}%
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
%\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
%\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}
}%
% optional photo (pre-rendering)
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{}}}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
{}%
\begin{minipage}[b]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@familyname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
\hfill%
% detailed information
\llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo (rendering)
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
%------------------
\makeatother
% personal data
\firstname{John}
\familyname{Doe}
\title{Title}
\birthdate{Birthday}
\photo[64pt][0.4pt]{picture}
\begin{document}
%----- letter ---------------------------------------------------------
% recipient data
\recipient{\mdseries Company}{Street\\ City}
\date{\today}
\opening{To who it may concern:}
\closing{Kind regards,}
\makelettertitle
%------------------------------
Hello
%----------Schlussformel-------
\makeletterclosing
\end{document}
答案2
在序言中添加以下内容(在之前说\begin{document}
)
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\makelettertitle}{\bfseries\upshape\@recipientname}{\upshape\@recipientname}{}{}
\makeatother
并使用
\recipient{Company}{Street\\ City}
完整代码:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvtheme[black]{banking}
\usepackage[scale=0.75, top=20mm, bottom=15mm]{geometry}
\usepackage{graphicx} %notwendig für eingescannte Unterschrift.
\usepackage[ngerman]{babel} %notwendig für die Darstellung des Datums in deutscher Weise.
\makeatletter
\newcommand*{\birthdate}[1]{\def\@birthdate{#1}}
\newcommand*{\civilstatus}[1]{\def\@civilstatus{#1}}
\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}
% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!60}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}r@{}}%
\ifthenelse{\isundefined{\@birthdate}}{}{\makenewline{\@birthdate}}%
\ifthenelse{\isundefined{\@civilstatus}}{}{\makenewline{\@civilstatus}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}%
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
%\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
%\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}
}%
% optional photo (pre-rendering)
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{}}}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
{}%
\begin{minipage}[b]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@familyname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
\hfill%
% detailed information
\llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo (rendering)
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
%------------------
\makeatother
% personal data
\firstname{John}
\familyname{Doe}
\title{Title}
\birthdate{Birthday}
\photo[64pt][0.4pt]{picture}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\makelettertitle}{\bfseries\upshape\@recipientname}{\upshape\@recipientname}{}{}
\makeatother
\begin{document}
%----- letter ---------------------------------------------------------
% recipient data
\recipient{Company}{Street\\ City}
\date{\today}
\opening{To who it may concern:}
\closing{Kind regards,}
\makelettertitle
%------------------------------
Hello
%----------Schlussformel-------
\makeletterclosing
\end{document}