[Tex/LaTex] How does one use cleveref in an arxiv submission

arxivcleveref

cleveref (in particular \cref and \Cref) does not seem to work on Arxiv, resulting in "??" instead of the correct reference such as "Section 2" or "Theorem 3". Is there a workaround?

Note that arxiv does compile twice (of course) and in general the compilation works fine for complex documents.

Here is an MWE:

\documentclass{article}
\usepackage{cleveref}

\begin{document}

a

\section{Test section}
\label{test}

\cref{test}
\end{document}

Which results in this when compiled on arxiv, with "??" instead of "Section 1".
PDF output

Here is the log provided by arxiv:

[verbose]: Creating arXiv submission AutoTeX object
[verbose]: Calling arXiv submission AutoTeX process
[verbose]: TeX/AutoTeX.pm: admin_timeout = minion
[verbose]:  is of type 'LATEX2e'.
[verbose]: ~~~~~~~~~~~ Processing file 'cleveref-test.tex'
[verbose]: TEXMFCNF is unset.
[verbose]: ~~~~~~~~~~~ Running hlatex for the first time ~~~~~~~~
[verbose]: Running: "(export HOME=/tmp PATH=/texlive/2011/bin/arch:/bin; cd /submissions/1397210/ && latex 'cleveref-test.tex' &1
[verbose]: This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
restricted \write18 enabled.
entering extended mode
(./cleveref-test.tex
LaTeX2e 
Babel  and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/texlive/2011/texmf-dist/tex/latex/base/size10.clo))
(/texlive/2011/texmf-dist/tex/latex/cleveref/cleveref.sty)
(/texlive/2011/texmf-dist/tex/latex/hyperref/hyperref.sty
(/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/texlive/2011/texmf-dist/tex/latex/graphics/keyval.sty)
(/texlive/2011/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/texlive/2011/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/texlive/2011/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/texlive/2011/texmf-config/tex/latex/latexconfig/hyperref.cfg)
(/texlive/2011/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (default): hdvips.

(/texlive/2011/texmf-dist/tex/latex/hyperref/hdvips.def
(/texlive/2011/texmf-dist/tex/latex/hyperref/pdfmark.def
(/texlive/2011/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
No file cleveref-test.aux.
(/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
(/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))

Package hyperref Warning: Rerun to get /PageLabels entry.


LaTeX Warning: Reference `test' on page 1 undefined on input line 12.

[1] (./cleveref-test.aux)

Package rerunfilecheck Warning: File `cleveref-test.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.


LaTeX Warning: There were undefined references.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

)
Output written on cleveref-test.dvi (1 page, 2372 bytes).
Transcript written on cleveref-test.log.

[verbose]: ~~~~~~~~~~~ Running hlatex for the second time ~~~~~~~~
[verbose]: Running: "(export HOME=/tmp PATH=/texlive/2011/bin/arch:/bin; cd /submissions/1397210/ && latex 'cleveref-test.tex' &1
[verbose]: This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
restricted \write18 enabled.
entering extended mode
(./cleveref-test.tex
LaTeX2e 
Babel  and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/texlive/2011/texmf-dist/tex/latex/base/size10.clo))
(/texlive/2011/texmf-dist/tex/latex/cleveref/cleveref.sty)
(/texlive/2011/texmf-dist/tex/latex/hyperref/hyperref.sty
(/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/texlive/2011/texmf-dist/tex/latex/graphics/keyval.sty)
(/texlive/2011/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/texlive/2011/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/texlive/2011/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/texlive/2011/texmf-config/tex/latex/latexconfig/hyperref.cfg)
(/texlive/2011/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (default): hdvips.

(/texlive/2011/texmf-dist/tex/latex/hyperref/hdvips.def
(/texlive/2011/texmf-dist/tex/latex/hyperref/pdfmark.def
(/texlive/2011/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
(./cleveref-test.aux) (/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
(/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./cleveref-test.out) (./cleveref-test.out)

LaTeX Warning: Reference `test' on page 1 undefined on input line 12.

[1] (./cleveref-test.aux)

LaTeX Warning: There were undefined references.

)
Output written on cleveref-test.dvi (1 page, 2460 bytes).
Transcript written on cleveref-test.log.

[verbose]: Removing (La)TeX AUX file called 'cleveref-test.out' (1446737883 >= 1446737882)
[verbose]: Removing (La)TeX AUX file called 'cleveref-test.aux' (1446737883 >= 1446737882)
[verbose]: ~~~~~~~~~~~ Processing file 'cleveref-test.dvi'
[verbose]: Running: "(export HOME=/tmp PATH=/texlive/2011/bin/arch:/bin; cd /submissions/1397210/ && dvips -R2 -z 'cleveref-test.dvi' -o )" 2>&1
[verbose]: dvi(h)ps said ...
This is dvips(k) 5.991 Copyright 2011 Radical Eye Software (www.radicaleye.com)
' TeX output 2015.11.05:1538' -> cleveref-test.ps



.


[1]

.
[verbose]: Backing up 'cleveref-test.ps'. Going to change %%Title line.
[verbose]: %%Title: line found and changed.
[verbose]: Title change completed.
[verbose]: Backing up 'cleveref-test.ps'. Going to add a name/date stamp to it.
[verbose]: OK, inserting the stamp
[verbose]: Stamping completed.
[verbose]: All done.

[verbose]: AutoTeX process succeeded
[verbose]: Processing DVI
[verbose]: Gzipping and moving cleveref-test.dvi
[verbose]: Gzipping ...1397210/cleveref-test.dvi
[verbose]: Processing postscript
[verbose]: Creating AutoTeX file for cleveref-test.dvi
[verbose]: Creating AutoTeX file for cleveref-test.dvi.gz
[verbose]: Creating AutoTeX file for cleveref-test.ps
[verbose]: Creating AutoTeX file for cleveref-test.tex
[verbose]: Gzipping ...1397210/cleveref-test.ps
[verbose]: Moving .../1397210/cleveref-test.dvi.gz => .../1397210/tex_cache/1397210.dvi.gz

[verbose]: Moving .../1397210/cleveref-test.ps.gz => .../1397210/tex_cache/1397210.ps.gz

[verbose]: All generated files successfully moved.
[verbose]: ** AutoTeX job completed. **

Best Answer

(Followed up on a suggestion to make an earlier comment into an answer.)

According to the log file you've posted, the hyperref package is being loaded after the cleveref package. However, cleveref is one of the packages that should be loaded after hyperref. This problem appears to arise because the arxiv server automatically loads hyperref if it hasn't been loaded explicitly.

As an alternative to disabling hyperref outright, you may try loading the hyperref package before cleveref is loaded.

Related Question