更改 tccv 中的字体

更改 tccv 中的字体

我想将所有部分和标题的字体全局更改为默认字体 (Computer Modern)。我需要在此 tccv 模板中更改哪些内容:

https://de.overleaf.com/latex/templates/my-two-column-cv/qmdfhjwnzqqy

NeedsTeXFormat{LaTeX2e}
ProvidesClass{tccv}
             [2015/04/16 v1.2.2
Two Column Curriculum Vitae]

LoadClassWithOptions{scrartcl}

setcounter{secnumdepth}{-1}
RequirePackage[hmargin=1.25cm,vmargin=1.25cm,twocolumn,columnsep=1.25cm]{geometry}
RequirePackage{bookman,etoolbox,needspace,pifont,tabularx,xcolor}
RequirePackage{hyperref}

 Capitalize words of at least a minimum length (default to 3 chars).
 The text is capitalized before being expanded.

 This macro uses Lua to do the job but fails gracefully (that is,
 return the text as is) if \directlua is not available.

     \ucwords
         [optional: miminum length]{text}
newcommand\ucwords[2][3]{%
   % Fails gracefully if not in LuaLaTeX
   \providecommand\directlua[1]{#2}%
   \directlua{%
    local minlen = tonumber("#1")
    local src = "\luaescapestring{\unexpanded{#2}}"
    local dst = {}
    % Put a % inside \directlua is tricky as hell. Use char(37)
    % instead: still no plans for supporting non-ASCII platforms.
    for w in src:gmatch(string.char(37) .. "S+") do
        if w:len() >= minlen then
        table.insert(dst, w:sub(1,1):upper() .. w:sub(2))
        else
        table.insert(dst, w)
        end
    end
    tex.print(dst)}}

pagestyle{empty}
setlength\parindent{0pt}
color[HTML]{303030} % Default foreground color
definecolor{link}{HTML}{506060} % Hyperlinks
hypersetup{colorlinks,breaklinks,urlcolor=link,linkcolor=link}
setkomafont{disposition}{\color[HTML]{801010}}
setkomafont{section}{\scshape\Large\mdseries}

 In tccv \part must contain the subject of the curriculum vitae.
 The command will start a new page and output in onecolumn the
 subject (first and last name) with the text from the optional
 argument underneath it
renewcommand\part[2][Curriculum Vitae]{%
   \twocolumn[%
   \begin{center}
    \vskip-\lastskip%
    {\usekomafont{part} #2} \medskip\\
    {\fontfamily{pzc}\selectfont\Huge {#1}}
    \bigskip
   \end{center}]}

 Overrides the \section command to capitalize every
 word for cosmetic purposes and draws a rule under it.
let\old@section\section
renewcommand\section[2][]{%
   \old@section[#1]{\ucwords{#2}}%
   \newdimen\raising%
   \raising=\dimexpr-0.7\baselineskip\relax%
   \vskip\raising\hrule height 0.4pt\vskip-\raising}

 Allow conditionals based on the job name. This can usually be set
 from a command-line argument: check fausto.en.tex for an example.

     \ifjob
         {jobname}
         {content if matches}
         {content if does not match}
newcommand\ifjob[3]{%
   \edef\JOBNAME{\jobname}%
   \edef\PIVOT{\detokenize{#1}}%
   \ifdefstrequal{\JOBNAME}{\PIVOT}{#2}{#3}%


 Renders a personal data box:

     \personal
         [url without scheme, i.e. no http:// prefix]
         {address}
         {phone number}
         {email}
newcommand\personal[4][]{%
   \newcommand\SYMBOL[1]{\raisebox{-2pt}{\Large\ding{##1}}}%
   \needspace{0.5\textheight}%
   \newdimen\boxwidth%
   \boxwidth=\dimexpr\linewidth-2\fboxsep\relax%
   \colorbox[HTML]{F5DD9D}{%
   \begin{tabularx}{\boxwidth}{c|X}
   \SYMBOL{45} & {#2}\smallskip\\
   \SYMBOL{37} & {#3}\smallskip\\
   \SYMBOL{41} & \href{mailto:#4}{#4}
   \ifstrempty{#1}{}{\smallskip\\ \SYMBOL{218} & \href{http://#1}{#1}}
   \end{tabularx}}}

 Every \item can be followed by one or more paragraphs
 of description:

     \item
         {date range}
         {company}
         {role}
     One or more paragraphs describing what achieved during this application.
newenvironment{eventlist}{%
   \newcommand*\inskip{}
   \renewcommand\item[3]{%
    \inskip%
    {\raggedleft\textsc{##1}\\[1pt]}
    \ifstrempty{##2}{}{##2\\[2pt]}
    {\Large\textit{##3}}
    \medskip
    \renewcommand\inskip{\bigskip}}}
   {\bigskip}

 Use only \item inside this environment, no other macros
 are allowed:

     \item
         [what has been achieved]
         {years}
         {subject}
         {notes}
newenvironment{yearlist}{%
   \renewcommand\item[4][]{%
    \textsc{##2} & \textbf{##3} \\
    \ifstrempty{##1}{}{& \textsc{##1} \\}
    & \textit{##4}\medskip\\}
   \tabularx{\linewidth}{rX}}
   {\endtabularx}


 Use only \item inside this environment: no other macros
 are allowed:

     \item
         {fact}
         {description}
newenvironment{factlist}{%
   \newdimen\unbaseline
   \unbaseline=\dimexpr-\baselinestretch\baselineskip\relax
   \renewcommand\item[2]{%
    \textsc{##1} & {\raggedright ##2\medskip\\}\\[\unbaseline]}
   \tabularx{\linewidth}{rX}}
   {\endtabularx}

 Avoid dealing with starred sections
 See the following question for further details:
 http://tex.stackexchange.com/questions/223607/does-the-bibliography-command-specify-a-section-anywhere
KOMAoption{bibliography}{totocnumbered}

AtEndPreamble{%
    \@ifpackageloaded{biblatex}{%
        \defbibheading{bibliography}[\refname]{%
            \section{#1}%
        }%
    }{}%

%
% End of file `tccv.cls'.

答案1

您的 MWE 似乎没有被正确复制,但我想我能明白您的意思。您bookman现在正在使用过时的包设置字体。您需要使用命令选择不同的字体\setkomafont{disposition}{\color[HTML]{801010}}

我不清楚的一件事是,您是否真的想使用 Computer Modern 作为标题,使用 Bookman 作为正文。我想知道您是否真的想问,如何让标题使用正文字体?命令是

\setkomafont{disposition}{\color[HTML]{801010}\rmfamily}

由于您不会将源代码发送给在 2021 年仍要求您使用 8 位字体的发布商,因此您可以选择升级到 LuaLaTeX。这样您就可以使用现代桌面字体。我个人建议在可以时这样做,在必要时使用旧字体。在这种情况下,您需要删除软件包bookman并添加:

\usepackage{xcolor} % Include this only once, before fontspec.
\usepackage{fontspec}
\setmainfont{TeX Gyre Schola} % Or your font of choice

% Because LuaTeX does not properly load NewComputerModernBook.fontspec:
\newfontfamily\newcm{NewComputerModern}[
    Extension = .otf ,
    UprightFont = NewCM10-Book,
    ItalicFont = NewCM10-BookItalic,
    BoldFont = NewCM10-Bold,
    BoldItalicFont = NewCM10-BoldItalic,
    SlantedFont = NewCM10-Book,
    BoldSlantedFont = NewCM10-Bold,
    SmallCapsFeatures = {Numbers=OldStyle},
    Scale = MatchUppercase,
    Ligatures = Common]

\setkomafont{disposition}{\color[HTML]{801010}\newcm}

这会将所有标题的字体设置为稍微细一点的 Computer Modern 字体。您可以调整它以使用常规粗细,或将其替换\newcm\rmfamily以将 Bookman 的克隆字体用于标题和正文。

的一个更简短的定义\newcm足以满足标题的要求,即:

\newfontface\newcm{NewCM10-Book.otf}

如果您想在 PDFTeX 中继续使用 Computer Modern,请替换bookmantgscholakerkis,添加\usepackage[T1]{fontenc},然后将\setkomafont命令更改为:

\setkomafont{disposition}{\color[HTML]{801010}\fontfamily(cmr)}

答案2

将其添加到前言或.cls文件中,然后用进行编译lualatex

\usepackage{fontspec}
\setmainfont{EB Garamond} % Or whatever

相关内容