I have classes for all the kinds of documents I usually write in Latex. I just migrated to a Mac in my new job, and find that none of my scripts work with MacTex 2018 (first time working with MacTex...).
The only error I get is:
Undefined control sequence. \end{document}
Which means that there is something wrong with my .cls file, but that error makes it impossible to debug it.
The funny thing is all my files work perfectly in my Ubuntu machine under TexLive 2018. Why don't they work on a Mac?
Please have a look at this MWE of a simple letter.
This would be my .cls file:
\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}}}
}
And this would be my .tex file:
\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\_doe@gmail.com}
%%FROM DETAILS
\fromdetails
{John Doe}
{Some address\\
1 Abc St\\\\
Singapore 000000}
{+65 1234 5678}
{doe\_doe@gmail.com}
{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}
Is there any obvious thing in the .cls file that does not work with MacTex? Sorry for its length but I am really at loss trying to debug it. Many thanks!
% !TeX TS-program = xelatex. (above \documentclass) I do not have XITS math and Lato Hairline on my system, but commenting out the lines in your cls referring to these two files, MacTex compiles for me. – egwene sedai Dec 10 '18 at 02:10% !TeX TS-program = xelatexat the beginning, I still getERROR Undefined control sequence. \end{document}– DaniCee Dec 10 '18 at 03:31xelatex foo.texorlualatex foo.tex, where foo.tex is your latex file? It works on my system without issue. Or maybe it'll give you a better log output. – egwene sedai Dec 10 '18 at 17:00fontawesomeicons. I don't know why running it in TexStudio just throws an error and in the command line it generates the pdf without a couple of icons, but at least now I know it is afontawesomeproblem. Thanks! – DaniCee Dec 11 '18 at 01:17.otffiles with the new ones, so the new icons can be used... However, in Ubuntu I found the old.otffiles at/usr/share/texlive/texmf-dist/fonts/opentype/public/fontawesome5, but now in Mac for the life of me that I cannot locate fontawesome5... Any clue? – DaniCee Dec 11 '18 at 01:27kpsewhichto see where the fonts end up; the font intexmf-distdirectory on mac is usually/usr/local/texlive/2018/texmf-dist/fonts/opentype(if using the texlive 2018 version) – egwene sedai Dec 11 '18 at 15:22