# Undefined control sequence \Hy@MakeCurrentHrefAuto when using tex4ht

I'm producing a small encyclopedia with the memoir class which relies fairly heavily on \nameref.

If it's relevant, I have my project directory set up so that I have a folder called articles/ which contains a bunch of .tex files, each beginning with a \section{} and then containing the article. I then have a build script which scans through all the files in the directory, adds chapters for each initial letter, and places these and \input{} statements in a tex file in the compile/ directory (adding "top" and "bottom" files around them), which is then compiled by pdflatex. (See the input file below if that doesn't make sense.) As I say, this works perfectly for pdflatex.

Now I want to produce an html version as well. latex2html, which I've used before, does not seem to support \nameref, so I went looking around and came upon tex4ht. I ran htlatex compile.tex, but it gets stuck when it reaches the first subsection:

/home/soren/current/maudiverse/./articles/history_abandonment.tex:4: Undefined
control sequence.
<argument> \Hy@MakeCurrentHrefAuto
{section*}\setlength {\Hy@SectionHShift }...
l.4 \subsection{Departure}


(I tried a couple of other commands that I found around the Web, since there seem to be a lot of different ways of calling tex4ht; they all gave the same error.)

MWE:

\documentclass[twocolumn]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage{hyperref}

%\copypagestyle{maudcyclo}{plain}
%\createmark{section}{both}{shownumber}{\sectionname}{}

\begin{document}

% the dot in the middle of some paths is a funky consequence of how the build
% script combines paths; it does the same thing with it removed
\chapter{C}
\input{articles/communications.tex}
% ...and so on
\end{document}


When I uncomment the headers lines (which I use in the document), a somewhat different error occurs on the first section:

./compile.tex:11: Undefined control sequence.
<argument> \sectionname
\@nameuse {thesection}
l.11 \section{Section}


At some earlier point, though, before I had pruned it down to this little code, it was giving the same error as the subsection.

It looks like there's some problem with hyperref -- any idea what's making it unhappy? (Hopefully the solution would continue working with pdflatex as well.)

If useful, here's the full output before the error message I showed earlier (if other log files would be useful, let me know).

soren@Emily:~/current/maudiverse/compile\$ htlatex compile.tex
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo
(./compile.tex (/usr/share/texlive/texmf-dist/tex/latex/memoir/memoir.cls
Document Class: memoir 2011/03/06 v3.6j configurable book, report, article docu
ment class
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/etex-pkg/etex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/memoir/mem10.clo)
(/usr/share/texlive/texmf-dist/tex/latex/memoir/mempatch.sty))
(/usr/share/texmf/tex/generic/tex4ht/tex4ht.sty)
(/usr/share/texmf/tex/generic/tex4ht/usepackage.4ht)
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def))
(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)

Package hyperref Message: Stopped early.

) (/usr/share/texlive/texmf-dist/tex/latex/memoir/memhfixc.sty)

Package hyperref Message: Driver: htex4ht.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/htex4ht.def)
(/usr/share/texmf/tex/generic/tex4ht/tex4ht.4ht
::::::::::::::::::::::::::::::::::::::::::
TeX4ht info is available in the log file
::::::::::::::::::::::::::::::::::::::::::
) (/usr/share/texmf/tex/generic/tex4ht/tex4ht.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvips.def)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def))
--- needs --- tex4ht compile ---
(./compile.tmp) (./compile.xref) (/usr/share/texmf/tex/generic/tex4ht/html4.4ht
) (/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht)
(/usr/share/texmf/tex/generic/tex4ht/latex.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/fontmath.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/memoir.4ht
(/usr/share/texmf/tex/generic/tex4ht/book.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/verse.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/mempatch.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/inputenc.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/utf8x.4ht)
(/usr/share/texmf/tex/generic/tex4ht/ucs.4ht)
(/usr/share/texmf/tex/generic/tex4ht/hyperref.4ht
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
Redoing nameref's sectioning
Redoing nameref's label
(/usr/share/texmf/tex/generic/tex4ht/nameref.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/pd1enc.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/url.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/color.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/dvips.4ht
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/dvipsnam.4ht
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def)
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht))
(/usr/share/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-math.4ht)) (./compile.aux)
(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def)
(/usr/share/texmf/tex/generic/tex4ht/utf8x.4ht) [1]
l.68 --- TeX4ht warning --- \halign translated into linear text ---
[2] [3] (./compile.4ct) [4]
(/home/soren/current/maudiverse/articles/communications.tex
/home/soren/current/maudiverse/articles/communications.tex:1: Undefined control
sequence.
<argument> \Hy@MakeCurrentHrefAuto
{section*}\setlength {\Hy@SectionHShift }...
l.1 \section{Communications}

?

-
could you post here also sample of included article? simple test file with just one \section and \subsection compiled fine for me –  michal.h21 Dec 11 '13 at 10:08
That's odd, the following test file (named a_test.tex) triggers it for me: \section{Test File} This is a test file that causes the problem. –  Soren Bjornstad Dec 11 '13 at 14:06
no, it is still OK. which TeX distribution do you use? –  michal.h21 Dec 11 '13 at 14:24
From my distro's package manager (Ubuntu/Mint), TeX Live 2012.20120611.5. Tex4HT 20090611-1.1build1. –  Soren Bjornstad Dec 11 '13 at 14:29