I'm trying to convert my LaTeX document to HTML using HeVeA and I'm facing a problem with cleveref package -- my LaTeX file uses \cref and \Cref heavily, but hevea doesn't support this package by default.

First thing I tried was importing whole cleveref.sty -- that somehow didn't work, I was also looking at cleveref source, but that is a little too complex for me :-)

So the question is -- how do you think is a best way to do references in document that is supposed to be converted with HeVeA?

example of this is really trivial:

\Cref{x}, \cref{x}.

run pdflatex on this twice and you get a nice pdf with 'Section 1, section 1'. HeVeA fails with Command not found: \Cref

  • 5
    Have you looked at poor man's cleveref (section 10 of the cleveref manual)? – Lev Bishop Feb 8 '13 at 21:33
  • 3
    Have you considered using TeX4ht instead of HeVeA? It would be helpful if you posted an MWE (minimum working example) that demonstrates the problems that you're encountering. – Mico Feb 8 '13 at 21:39

As mentioned in the comments, cleveref actually has a way that you can fix this.

Let's say that your file looks something like this





\section{My section}\label{sec:test}
We see in \cref{sec:test} that ...

When you want to get the benefits of cleveref but without using cref and friends, then you load


and then recompile. This produces the file myfile.sed (which has a lot of lines). Now run

sed -f myfile.sed myfile.tex> mynewfile.tex

which gives




\section{My section}\label{sec:test}
We see in section\nobreakspace \ref {sec:test} that ...

You now have a file that has all the benefits of cleveref but without any of the manual labour- sweet!

| improve this answer | |
  • Poor man's cleveref would work, but I would need to modify the source and it would complicate the build process. My Makefile is pretty hardcore even without it :-) – cube Feb 9 '13 at 21:16
  • And I'd also have to run sed on all of my *.tex files! – cube Feb 10 '13 at 14:33
  • 1
    If you're building from a Makefile anyway, why is adding a couple more processing steps such a big issue? (latex+cleveref->sed->latex->whatever instead of latex+cleveref->whatever.) Automating this kind of thing is exactly what make excels at!? – Toby Cubitt Nov 18 '13 at 21:57

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.