我有各种我通常用 Latex 编写的文档的类。我刚刚在新工作中迁移到 Mac,发现我的脚本都无法在 MacTex 2018 上使用(第一次使用 MacTex...)。
我得到的唯一错误是:
未定义控制序列。\end{document}
这意味着我的文件有问题.cls
,但该错误使得无法调试它。
有趣的是,我的所有文件在 TexLive 2018 下的 Ubuntu 机器上都能完美运行。为什么它们不能在 Mac 上运行?
请看一下这封简单信件的 MWE。
这是我的.cls
文件:
\ProvidesClass{DC_cover}[2018/08/31 cover class]
\LoadClass{article}
\NeedsTeXFormat{LaTeX2e}
\DeclareOption{print}{\def\@cv@print{}}
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}%
}
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%
% Colors %
%%%%%%%%%%
\RequirePackage{xcolor}
\definecolor{gray60}{HTML}{666666}% 60%
\definecolor{gray40}{HTML}{999999}% 40%
\definecolor{myblue}{HTML}{A589D9}
\definecolor{skype}{HTML}{12A5F4}
\ifdefined\@cv@print
\colorlet{myblue}{gray60}
\colorlet{skype}{gray40}
\else
\colorlet{myblue}{myblue}
\colorlet{skype}{skype}
\fi
\colorlet{textcolor}{gray60}
\usepackage{hyperref}
%hyperref options, no border and url colors
\hypersetup{%
pdfborder = {0 0 0},
colorlinks=true,
urlcolor=myblue
}
%%%%%%%%%
% Fonts %
%%%%%%%%%
\usepackage[quiet]{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Arial}
\newfontfamily\bodyfont[]{Arial Black}
\newfontfamily\thinfont[]{Lato Hairline}
\newfontfamily\headingfont[]{Impact}
\renewcommand{\bfseries}{\headingfont\color{textcolor}}
\usepackage{unicode-math} %https://tex.stackexchange.com/questions/353136/compilation-error-option-unknown-unicode-math
\setmathfont{XITS Math}
%%%%%%%%%%%
% Awesome %
%%%%%%%%%%%
%http://mirror.utexas.edu/ctan/fonts/fontawesome5/doc/fontawesome5.pdf
\usepackage{fontawesome5}
%- If you want to use the latest, download fontawesome latest Desktop version from https://fontawesome.com/
%- Uncompress and change the names to the otf files so that they do not contain spaces
%- Copy the otf files to the following location, replacing current files
%sudo cp Font* /usr/share/texlive/texmf-dist/fonts/opentype/public/fontawesome5
%sudo texhash
%%%%%%%%%%%%%%%%
% From Details %
%%%%%%%%%%%%%%%%
\newcommand{\fromdetails}[5]{%
\begin{tabular}{@{}l@{}}
\today \\[\normalbaselineskip]
\textbf{#1}\\
#2\\
{\Large \textcolor{gray40}{\faPhoneSquare}} #3\\
\href{mailto:#4}{{\large \textcolor{gray40}{\faEnvelope}} {\small #4}}\\
\href{skype:#5?call}{{\Large \textcolor{skype}{\faSkype}} {\small #5}}
\end{tabular}
}
%%%%%%%%%%%%%%
% To Details %
%%%%%%%%%%%%%%
\newcommand{\todetails}[2]{%
\begin{tabular}{@{}l@{}}
\textbf{#1}\\
#2
\end{tabular}
}
%%%%%%%%%%%%%
% Signature %
%%%%%%%%%%%%%
%\newcommand{\signature}[2]{%
% \begin{tabular}{@{}l@{}}
% Yours sincerely,\\[2\normalbaselineskip]
% \includegraphics[width=5cm]{#2}\\[\normalbaselineskip]
% #1
% \end{tabular}
%}
%%%%%%%%%%%%%%
%Geometry etc%
%%%%%%%%%%%%%%
\usepackage{lipsum}
\usepackage{graphicx}
\setlength{\parindent}{0pt}% No paragraph indentation
\setlength{\parskip}{.5\baselineskip plus 0.1\baselineskip minus 0.1\baselineskip}
%%Page geometry
\usepackage[left=2cm,top=2cm,right=2cm,bottom=2cm]{geometry}
%%%%%%%%%%
% Footer %
%%%%%%%%%%
\usepackage{fancyhdr, lastpage}
\pagestyle{fancy}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength{\footskip}{1cm}
\newcommand{\footer}[2]{%
\fancyfoot[L]{{\small \textcolor{gray60}{\faFingerprint}\ \textbf{ #1}}\hspace{0.375cm}-\hspace{0.375cm}cover letter}
\fancyfoot[R]{
\href{mailto:#2}{\textcolor{gray40}{{\small \faEnvelopeOpen}}\ {\footnotesize #2}}\hspace{3cm}
{\small \textcolor{gray40}{\faFileSignature}\ \thepage\ of \pageref{LastPage}}}
}
这是我的.tex
文件:
\documentclass[a4paper]{DC_cover}%[print] for print option
%letterpaper: US letter (215.9mm x 279.4mm) - default in this distribution
%a4paper: A4 paper (210.0mm x 297.0mm)
%%%%%BEGIN DOCUMENT!
\begin{document}
%%PRINT FOOTER
\footer
{John Doe}
{doe\[email protected]}
%%FROM DETAILS
\fromdetails
{John Doe}
{Some address\\
1 Abc St\\\\
Singapore 000000}
{+65 1234 5678}
{doe\[email protected]}
{doe.doe}
\bigskip
%%TO DETAILS
\todetails
{Jane Doe}
{Doe Agency\\
10 Abc St\\
Singapore 000000}
\bigskip
Dear Mrs. Doe,
\bigskip
%%%%%%%%%%%%%%%%
%LETTER CONTENT%
%%%%%%%%%%%%%%%%
in response to the e-mail bla bla bla
\bigskip
%%SIGNATURE
%\signature
%{John Doe}
%{images/signature.pdf}
\end{document}
文件中是否有任何明显.cls
无法与 MacTex 配合使用的内容?抱歉,它很长,但我真的不知道该如何调试它。非常感谢!