Illusory stillness

mumble mumble techblog

Hevea

So I wrote a thesis, using some self-torturing chain of LyX, knitr, and a build tool of my own devising. It made a PDF, now I want to make it a webpage.

I tried a few tools, and settled on HeVeA as the tool that showed the most promise (as in, ‘it actually generated some HTML for a subset of my files, within a few hours of work’). That’s not close to “working” though.

Currently, I’m having a problem where a \ref{} is processed correctly by LaTeX, producing a link labeled “Figure x”, but incorrectly by Hevea, including the entire caption, like so:

Error processing input, expected syntax: {% img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | “title text” [“alt text”]] %}

Disabling the hyperref and refstyle packages didn’t do much. I seem to remember also having this problem when using a ref{} to another figure inside of a figure caption but I am not sure how that was resolved.

This is one problem with LaTeX projects, they become hard to troubleshoot. For any two things you want to do in LaTeX, there are four packages offering each, for 16 combinations, each of which will be grossly or subtly incompatible in some way.

In this case, something somewhere is fucking with the generation of reference labels or something. The actual HTML looks like:

1
2
3
4
5
6
<a href="#mov%3Auncrowded">2.1(demo_circle_6.mov) An example
motion stimulus similar to those used in my experiments. There are six
elements, with the carrier motion clockwise and the envelope
counterclockwise. The envelope motion dominates the subjective
appearance. figure.caption.2</a> shows six elements, so the spacing
between elements

which was constructed from this TeX:

1
\ref{mov:uncrowded} shows six elements, so the spacing between elements

Now, part of the fuckup is with hyperref? maybe? Next I need to try constructing a minimal example. Luckily I have a minimal example already….

Some time later

OK so, turns out the inclusion of figure captions in labels was caused by an ill-thought-out line I had written in trouble.hva:

1
\renewcommand{\AtBeginDocument}[1]{}

I had written this to “prevent” an error that was occurring when hevea was reading the .aux file, but it also screwed up hyperref. It seems I can’t get hyperref to work with hevea, and cleveref.

Giving up

After constructing a minimal example, I still couldn’t identify a way to make autoref/cleverref references work.

Tex4ht

Someone suggested that tex4ht might work better than hevea, and at least it correctly processed my minimal example. That doen’t mean it’ll process the the whole thesis, though.

The first problem is:

1
2
--- warning --- Can't find/open file `introduction_chapter.dvi'
--- error --- Can't find/open file `introduction_chapter.dvi'

Which was because I was using tex4ht and not htlatex. Using htlatex I instead get:

1
2
3
4
! I can't find file `introduction_chapter.html'.
<to be read again>
                   \relax
l.79 \begin{document}

Which is odd since that command is actually supposed to be making the file!

So it must be failing at an earlier stage?