Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

UPDATE Jne 22, 2013

After installing TexLive 2013, this problem went away on its own. So this question is now resolved for me, as I will be using TL 2013 from now on. This question can closed or deleted as the moderators decide. thank you

Original question

When I run pdflatex on a file I get errors. But this only happens when I have run htlatex before on the same file.

The problem goes away when the .aux file generated by htlatex run is deleted BEFORE running pdflatex.

A small .tex file is given below (thanks to Nicola Talbot in chat for providing it) and the commands I used. You can see the problem only shows up when I run htlatex before pdflatex

\documentclass{article}
\usepackage{graphicx}
\usepackage[colorlinks]{hyperref}
\begin{document}

Reference to Figure~\ref{fig:sample}.

\begin{figure}
\centering
\includegraphics{image.png}
\caption{Sample} 
\label{fig:sample}
\end{figure}
\end{document}

now

rm -rf report; mkdir report;htlatex report.tex "htm" " -cunihtf" -dreport

pdflatex report.tex

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
 restricted \write18 enabled.
 ......
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./report.out) (./report.out)

Package hyperref Warning: Empty destination name,
(hyperref)                using `UNDEFINED' on input line 8.

! Undefined control sequence.
<argument> ...tring :autoref\endcsname {\@captype 
                                                  }1
l.8 Reference to Figure~\ref{fig:sample}
                                        .
? 

But if I delete the report.aux file before running pdflatex, the problem goes away, and all what I get is the normal undefined references messages asking to run pdflatex again which is expected:

>rm -rf report; mkdir report;htlatex report.tex "htm" " -cunihtf" -dreport

>rm report.aux
   rm: remove regular file `report.aux'? y

>pdflatex report.tex

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
 restricted \write18 enabled.
 ....
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
No file report.aux.
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
......    
LaTeX Warning: Reference `fig:sample' on page 1 undefined on input line 8.

<image.png, id=4, 749.04843pt x 302.63063pt> <use image.png>
Overfull \hbox (404.0466pt too wide) in paragraph at lines 12--13
 [][] 
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} <./image.png>]
(./report.aux)

The error is not there any more. This below is listing of the report.aux after running the htlatex command

>cat report.aux
\relax 
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax 
\gdef\HyperFirstAtBeginDocument#1{#1}
\ifx\rEfLiNK\UnDef\gdef \rEfLiNK#1#2{#2}\fi
\newlabel{fig:sample}{{\rEfLiNK{x1-21}{\csname\string :autoref\endcsname{\@captype }1}}{\rEfLiNK{x1-21}{\csname\string :autoref\endcsname{\@captype }3}}{}{}{}}
>

question is: Why do pdflatex gives an error if run it after htlatex? texlive 2012 debian packaging

Appendix

>tex4ht  -v
----------------------------
tex4ht.c (2009-01-31-07:33 kpathsea)

>latex -v
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
kpathsea version 6.1.0

>uname -a
Linux me-VirtualBox 3.5.0-17-generic #28-Ubuntu SMP T

>ls -lrt
total 106
-rwxrwxrwx 1 me me 17438 Apr 16 01:02 image.png
-rwxrwxrwx 1 me me   259 Jun  5 14:42 Makefile
-rwxrwxrwx 1 me me   274 Jun  5 14:46 report.tex
-rwxrwxrwx 1 me me     0 Jun  5 15:00 report.out
-rwxrwxrwx 1 me me 36292 Jun  5 15:00 report.pdf
-rwxrwxrwx 1 me me   183 Jun  5 15:04 report.4ct
-rwxrwxrwx 1 me me   736 Jun  5 15:04 report.aux
-rwxrwxrwx 1 me me    93 Jun  5 15:04 report.xref
-rwxrwxrwx 1 me me   176 Jun  5 15:04 report.4tc
-rwxrwxrwx 1 me me 10808 Jun  5 15:04 report.dvi
-rwxrwxrwx 1 me me 22167 Jun  5 15:04 report.log
-rwxrwxrwx 1 me me  1563 Jun  5 15:04 report.htm
-rwxrwxrwx 1 me me  6593 Jun  5 15:04 report.lg
-rwxrwxrwx 1 me me   473 Jun  5 15:04 report.idv
-rwxrwxrwx 1 me me    15 Jun  5 15:04 report.tmp
-rwxrwxrwx 1 me me  5625 Jun  5 15:04 report.css
drwxrwxrwx 1 me me     0 Jun  5 15:04 report
-rwxrwxrwx 1 me me  1210 Jun  5 15:16 texput.log
>
share|improve this question

closed as too localized by Heiko Oberdiek, Qrrbrbirlbel, lockstep, Guido, Thorsten Jun 23 '13 at 6:22

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I cannot reproduce the problem with hyperef in version 2012/11/06 v6.83m and hyperref.4ht 2011-01-30-16:01. The .aux file does not contain \@captype. –  Heiko Oberdiek Jun 5 '13 at 20:15