Skip to content

Commit

Permalink
Load cleveref.sty before listings.sty when using LaTeXML
Browse files Browse the repository at this point in the history
Workaround for issue reported here:
- brucemiller/LaTeXML#1400
  • Loading branch information
henrikt-ma committed Nov 28, 2020
1 parent 3c3dc29 commit 622ac88
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,24 @@
\let\smallifpdf\normalsize
\fi

\ifpdf
% Don't load cleveref yet.
\else
% The LaTeXML 'listings' support in cleveref is broken, so we need to load cleveref before
% listings (which is loaded inside mlsshared.sty), so that the broken support doesn't get loaded, see
% - https://github.com/brucemiller/LaTeXML/issues/1400
\usepackage[nameinlink,noabbrev]{cleveref}
\fi

\usepackage{mlsshared}

\ifpdf
% This is the preferred load order for listings and cleveref, so that cleveref is aware of listings, see above.
\usepackage[nameinlink,noabbrev]{cleveref}
\fi

\def\autoref#1{\errmessage{You are not supposed to use \autoref; use \cref or \Cref instead.}}

% Settings in addition to those in mlsshared.sty.
\lstset{%
xleftmargin=\fboxsep,
Expand Down Expand Up @@ -174,11 +190,6 @@

\newcommand{\glossaryitem}[1]{\textbf{#1}}

\newcommand{\bibitemtitle}[1]{\emph{#1}}

\usepackage[nameinlink,noabbrev]{cleveref}
\def\autoref#1{\errmessage{You are not supposed to use \autoref; use \cref or \Cref instead.}}

% Environment for definitions.
\usepackage{amsthm}
\newtheoremstyle{mlsdefinition}
Expand Down

0 comments on commit 622ac88

Please sign in to comment.