0

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!

  • Are you compiling with xelatex? To do so, you can add this line as the first line in your tex file % !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 2:10
  • I compile with LuaLatex... – DaniCee Dec 10 '18 at 2:17
  • Which log file? – DaniCee Dec 10 '18 at 3:29
  • @egwenesedai trying compiling with xelatex, commenting the Lato and XITS line, and adding % !TeX TS-program = xelatex at the beginning, I still get ERROR Undefined control sequence. \end{document} – DaniCee Dec 10 '18 at 3:31
  • I installed MacTex from here (tug.org/mactex/mactex-download.html) and TexStudio from here (texstudio.org). That is all I have done... Does Mac need anything else for Latex to work properly? Simple documents do compile ok – DaniCee Dec 10 '18 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.