4

When using a \label inside an align environment of the amsmath package and also importing cleveref and microtype you get an error for the following MNWE:

\documentclass[11pt]{scrbook}
\usepackage{amsmath}
\usepackage{cleveref}
\usepackage{microtype}

\begin{document}
\begin{align}
    \label{eq1}
    1 < 2
\end{align}
\end{document}

Running it yields this error:

$ lualatex test.tex
[...]
! Use of \label doesn't match its definition.
<argument>  \label {
         eq1} 1 < 2 
l.10 \end{align}

This seems to only be an issue with LuaLaTeX. It works fine with both pdfLaTeX and XeLaTeX. Additionally it works with \begin{equation} but not with align.

4
  • Interestingly the error occurs in align only, not in equation
    – user31729
    Jan 31, 2017 at 14:59
  • @ChristianHupfer Yes, I checked that, too, but didn't put in the question. I'll add this bit just to be more precise.
    – Artemis
    Jan 31, 2017 at 15:00
  • The conflict is with luatexbase (loaded by microtype), whose definition of \@gobble@optarg differs from that of cleveref. (@DavidCarlisle, @JosephWright?)
    – Robert
    Feb 2, 2017 at 0:41
  • This issue is not only with microtype: tex.stackexchange.com/questions/351862/…
    – Dirk
    Feb 3, 2017 at 9:57

1 Answer 1

3

After trying out the answer is that cleveref should be loaded after microtype. So changing the example to

\documentclass[11pt]{scrbook}
\usepackage{amsmath}
\usepackage{microtype}
\usepackage{cleveref}

\begin{document}
\begin{align}
    \label{eq1}
    1 < 2
\end{align}
\end{document}

works fine.

EDIT: It seems that the issue really seems to be the combination of the three packages, because there are different orders (also one in which cleveref is included before microtype) which work.

  • amsmathcleverefmicrotype: Does NOT work
  • amsmathmicrotypecleveref: Works
  • cleverefamsmathmicrotype: Works
  • cleverefmicrotypeamsmath: Works
  • microtypeamsmathcleveref: Works
  • microtypecleverefamsmath: Works

Conclusion: All but one loading order works fine and I was „lucky“ to use exactly this.

4
  • 1
    cleveref should be loaded last in almost any case, even after hyperref
    – user31729
    Jan 31, 2017 at 14:49
  • Also in your answer, cleveref is loaded first, which is most probably a typo?
    – Troy
    Jan 31, 2017 at 14:50
  • @ChristianHupfer Thanks for the comment. I just noticed it that it states so in the documentation. I must have missed this bit by now… Shame on me.
    – Artemis
    Jan 31, 2017 at 14:52
  • @Troy This was an accident, but it still works this way. I'll have a look and update my answer accordingly.
    – Artemis
    Jan 31, 2017 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .