我已经从 MiKTeX 控制台添加了 fontawesome 包,但是当尝试使用 XeLaTeX 在 TeXworks 中创建文档时,我收到以下错误:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "FontAwesome" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
我使用的是 Windows 10,在以前的机器上我让我的 tex 文件按原样工作,但我无法恢复我为使其工作所做的任何配置。想法?
编辑:CLS 文件
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cv-roald}[2017/01/30 My custom CV class]
\LoadClass{article}
% --------------------------------- %
% PARAMETERS %
% --------------------------------- %
\newlength{\margin}
\setlength{\margin}{25mm}
\newlength{\leftcol}
\setlength{\leftcol}{0.22\paperwidth}
\newlength{\hdrheight}
\setlength{\hdrheight}{38mm}
\newlength{\vspacepar}
\setlength{\vspacepar}{0.4\baselineskip}
\newlength{\hspaddress}
\setlength{\hspaddress}{1em}
\newlength{\FAspace}
\setlength{\FAspace}{0.2em}
% --------------------------------- %
% PACKAGES %
% --------------------------------- %
\RequirePackage{fontspec}
\RequirePackage{titlesec}
\RequirePackage{tikz}
\RequirePackage{xcolor}
\RequirePackage[margin= \margin]{geometry}
\defaultfontfeatures{ % Important to add, else fontawesome will not work with XeLaTeX
Path = Fonts/}
\RequirePackage{fontawesome}
\RequirePackage{calc}
\RequirePackage{tabularx}
\RequirePackage{enumitem}
\setlist{parsep=1 pt, topsep=1 pt}
\RequirePackage{parskip}
% --------------------------------- %
% CALCULATED LENGTHS %
% --------------------------------- %
\newlength{\hdrskip}
\setlength{\hdrskip}{\hdrheight-\margin}
\newlength{\rightcol}
\setlength{\rightcol}{\paperwidth-\leftcol}
\newlength{\LeftColBody}
\setlength{\LeftColBody}{\leftcol-\margin}
\newlength{\RightColBody}
\setlength{\RightColBody}{\textwidth-\LeftColBody}
% --------------------------------- %
% FONTS %
% --------------------------------- %
\setmainfont{SourceSansPro}[
Path = Fonts/,
Extension = .otf ,
UprightFont = *-Light,
ItalicFont = *-LightIt,
BoldFont = *-Semibold,]
\newfontfamily\titlefont{AdventPro}[
Path = Fonts/,
Extension = .ttf,
UprightFont = *-ExtraLight,
BoldFont = *-SemiBold,
]
% --------------------------------- %
% COLORS %
% --------------------------------- %
\definecolor{maincolor}{RGB}{60, 142, 250}
\colorlet{lightermain}{maincolor!35}
\colorlet{darkermain}{maincolor!90!black}
% --------------------------------- %
% HEADER %
% --------------------------------- %
\newcommand{\sep}{\hspace{\hspaddress} | \hspace{\hspaddress}}
\newcommand{\header}[4]{%
% #1 First name
% #2 Last name
% #3 = Address
% #4 = Phone, mail and LinkedIn
\begin{tikzpicture}[remember picture, overlay]
% Colored bar on top of the page
\node [below right, fill=darkermain, minimum height=\hdrheight, minimum width=\paperwidth, outer sep=0] (name) at (current page.north west) {};
% Node for the name
\node[anchor=base, text=white, inner sep=0.25 cm] (nametext) at (name.base) {%
\fontsize{40pt}{32pt}\color{white}%
{\titlefont #1~}{\titlefont \textbf{#2}\par}
};
% Address
\node[anchor=north, text=lightermain] (address) at (nametext.south) {#3 \par};
% Phone/mail/nationality
\node[anchor=north, text=lightermain] at (address.south) {#4};
\end{tikzpicture}
\vspace{\hdrskip}
}
% --------------------------------- %
% TITLE FORMAT %
% --------------------------------- %
\titleformat{\section}{\titlefont\color{maincolor}\huge\bfseries}{\thesection}{0em}{}
\titlespacing*{\section}{0pt}{1.5ex plus 0.2ex minus .2ex}{-0.5ex plus .2ex}
\newcommand{\worktitle}[2]{
% #1 = Job or education title
% #2 = Company and location
{\bfseries\MakeUppercase{#1}}
{\itshape #2}
}
% --------------------------------- %
% ENVIRONMENTS %
% --------------------------------- %
\newenvironment{tabularcv}{
\tabularx{\textwidth}{@{}>{\raggedright\arraybackslash}p{\LeftColBody}@{}>{\raggedright\arraybackslash}p{\RightColBody}}}{
\endtabularx}
\newenvironment{tabitemize}{
\itemize}{
\vspace*{-\baselineskip}
\enditemize}
% --------------------------------- %
% BODY TEXT OPTIONS %
% --------------------------------- %
\setlength{\parindent}{0pt} % Remove indent at the start of a new paragraph
\setlength{\parskip}{\vspacepar} % adds extra vertical space between paragraphs
示例正文
\documentclass[]{cv-roald}
\begin{document}
\pagestyle{empty} %to remove the page numbers
\header{First}{Last}{\faMapMarker \hspace{\FAspace} Address \sep Title \sep City, State}
{\faMobile \hspace{\FAspace} +1 123 456 7890 \sep \faEnvelope \hspace{\FAspace} abc@xyz.com \sep Other}
\section*{Skills}
\begin{tabularcv}
& \worktitle{Skill}{}
\newline Description
\end{tabularcv}
\section*{Education}
\begin{tabularcv}
Years & \worktitle{Major}{Institution (State)}
\newline Minor
\begin{tabitemize}
\item Details
\end{tabitemize}
\end{tabularcv}
\section*{Projects}
\begin{tabularcv}
& \worktitle{Project Name}{Type}
\newline Description
\\[\vspacepar]
\end{tabularcv}
\section*{Work}
\begin{tabularcv}
2014-2015 & \worktitle{Title}{Company}
\newline Description
\end{tabularcv}
\end{document}