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.

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:

\documentclass{article}
\usepackage{cleveref}
\begin{document}
\section{A}
\label{x}
\Cref{x}, \cref{x}.
\end{document}

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

share|improve this question
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

1 Answer 1

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

myfile.tex

\documentclass{article}

\usepackage{cleveref}

\begin{document}

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

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

\usepackage[poorman]{cleveref}

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

myfilenew.tex

\documentclass{article}



\begin{document}

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

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

share|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
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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