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.




It gives me

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9 64-bit)
entering extended mode
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:\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:\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:\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?

  • sudo dnf install texlive-* similiar to apt-get or any package manager on your os – Cavalcade Renegade Dec 5 '17 at 7:17

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


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


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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.