[tex4ht] Problem with hyperref

Guido Milanese guido.milanese at unicatt.it
Fri Dec 22 16:45:01 CET 2017


The PANDOC conversion from markdown to LaTeX  uses hyperref, which is
very convenient in order to get internal links in a PDF. 

Given this markdown MWE:

---
title:  Test
author:  John Writer
date:  2017
classoption: nohyper
---

Lorem ipsum dolor sit amet.

Ut enim ad minim veniam.

it is all right. The ODT file is read by Libreoffice. But if I add a
section title, like this:

---
title:  Test
author:  John Writer
date:  2017
classoption: nohyper
---

#  A section
Lorem ipsum dolor sit amet.
Ut enim ad minim veniam.

the LaTeX output uses hyperref as follows:

\hypertarget{a-section}{%
\section{A section}\label{a-section}}

Running "mk4ht htlatex zero.tex" it's all right.

Running "mk4ht oolatex zero.tex" the section titles disappear from the
output, and mk4ht outputs an error:

System return: 0
System call: mv    sxw-zero.dir/zero.odt .
mv: cannot stat 'sxw-zero.dir/zero.odt': No such file or directory
--- Warning --- System return: 256

If I run:

htlatex zero.tex "xhtml, ooffice " "ooffice/! -cmozhtf" "-coo
-cvalidate"

Libreoffice does not load the file and outputs an error window:

Read Error.
Format error discovered in the file in sub-document content.xml at
60,2(row,col). 

Studying the error message, I find that the offending line in
content.xml is this one:

<!--l. 65--><text:p text:style-name="First-line-indent">   <t4htlink 
 href="#first-section" name="first-section">
   </text:p> 

Changing to 

<!--l. 65--><text:p text:style-name="First-line-indent">   <t4htlink 
 href="#first-section" name="first-section"></t4htlink>
   </text:p> 

it's all right. The tag was indeed closed, but after 2 lines, not
where I closed it. I removed the offending close_tag, moved as shown
above and it's all right now.

I do not know if it's a bug or a mistake from my side.

Thank you for your kind attention,
gm

PS the reason why I'm going through LaTeX and not converting markdown
--> ODT is that I like writing in markdown, but the final details of
the project I'm currently working on need the "refinements" of LaTeX.


---
Guido Milanese, Professor of Classics, PhD HC Paris IC
http://docenti.unicatt.it/ita/guido_fabrizio_milanese/
http://usi.to/tz4


More information about the tex4ht mailing list