2

I'm trying to compile the HoTT book with htlatex, and was trying to reproduce an issue that occurs with htlatex but not pdflatex. However, I couldn't even manage to get a small working example using pdflatex.

I would like to know why this code does not work, and how to fix it.

\documentclass{article}
\usepackage{amsthm}
\usepackage{aliascnt}
\usepackage[capitalize]{cleveref}
\usepackage{hyperref}

\newtheorem{thm}{Theorem}[section]
\crefname{thm}{Theorem}{Theorems}
\theoremstyle{remark}
\newaliascnt{rmk}{thm}
\newtheorem{rmk}[rmk]{Remark}
\aliascntresetthe{rmk}
\crefname{rmk}{Remark}{Remarks}

\begin{document}
.
\begin{thm}
.
\end{thm}
\begin{rmk}
.
\end{rmk}
\end{document}

It gives me

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9 64-bit)
entering extended mode
(D:\Documents\GitHub\book\test.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2012-05-30, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
 lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2012-05-30, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("D:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("D:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"))
("D:\Program Files\MiKTeX 2.9\tex\latex\amscls\amsthm.sty")
("D:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\aliascnt.sty"
("D:\Program Files\MiKTeX 2.9\tex\latex\carlisle\remreset.sty"))
(D:\Documents\GitHub\book\cleveref.sty)
("D:\Program Files\MiKTeX 2.9\tex\latex\hyperref\hyperref.sty"
("D:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\hobsub-hyperref.sty"
("D:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\hobsub-generic.sty"))
("D:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
(D:\Documents\GitHub\book\ifxetex.sty)
("D:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\auxhook.sty")
("D:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty")
("D:\Program Files\MiKTeX 2.9\tex\latex\hyperref\pd1enc.def")
("D:\Program Files\MiKTeX 2.9\tex\latex\00miktex\hyperref.cfg")
("D:\Program Files\MiKTeX 2.9\tex\latex\ltxmisc\url.sty"))

Package hyperref Message: Driver (autodetected): hpdftex.

("D:\Program Files\MiKTeX 2.9\tex\latex\hyperref\hpdftex.def"
("D:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\rerunfilecheck.sty"))
(D:\Documents\GitHub\book\test.aux)
("D:\Program Files\MiKTeX 2.9\tex\latex\hyperref\nameref.sty"
("D:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\gettitlestring.sty"))
(D:\Documents\GitHub\book\test.out) (D:\Documents\GitHub\book\test.out)

! LaTeX Error: No counter 'r' defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.20 \begin{rmk}

?
! Emergency stop.
 ...

l.20 \begin{rmk}

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.

Why is it looking for a counter "r", and how do I fix this?

1
  • sudo dnf install texlive-* similiar to apt-get or any package manager on your os Dec 5, 2017 at 7:17

2 Answers 2

5

I can't provide the deep technical answer, but according to its manual section 13:

The cleveref package must be loaded after all other packages that don't specifically support it, i.e. the

\usepackage{cleveref}

line should usually be the last \usepackage command in your document's preamble.

1

The solution was to move \usepackage{hyperref} to the top. If someone wants to explain to me why this is the case, I'll be happy to mark that as an accepted answer.

You must log in to answer this question.

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