Thank you for your kind and useful suggestions. Yes, I did know the excellent Markdown package, but I am a bit rigid in my habit of keeping formats "separated". Digging in the pandoc usergroup archive I found the easiest solution: call the filter as -f --markdown-auto_identifiers
See: pandoc -f markdown-auto_identifiers+smart file.md -t latex+smart -s -o file.tex As an excuse, I must say that the manual is (at leas tome) not particularly clear about this issue. Best regards and wishes for Christmas and the New Year. guido ---- Guido Milanese - Professor of Classics - Docteur HC Paris ICP Universita' Cattolica del Sacro Cuore, Milano and Brescia, Italy http://docenti.unicatt.it/ita/guido_fabrizio_milanese/ http://usi.to/tz4 ________________________________________ From: Michal Hoftich [michal....@gmail.com] Sent: 22 December 2017 17:52 To: Milanese Guido Fabrizio; tex4ht@tug.org Subject: Re: [tex4ht] Problem with hyperref Dear Guido, you may also try the Markdown package, it enables direct Markdown support in TeX and it works quite well with tex4ht. It also supports mixing Markdown and LaTeX macros, so you can use all the Markdown shortcuts for basic formatting and use LaTeX for more advanced stuff. Back to your actual question: Quoting Guido Milanese (2017-12-22 16:45:01) > > <!--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. It is definitely not a bug or a mistake on your side. The problem is that the \hypertarget command inserts the opening link, which starts a new paragraph. But the \section command closes this paragraph, which leaved this opening link unclosed. After the end of section command, new paragraph is started and the link is closed. This produces an invalid XML structure, which causes the post-processing to fail. You may try to use a following macro in a config file: \def\hypertarget#1#2{\ifvmode\IgnorePar\EndP\fi\Link{}{#1}#2\ifvmode\IgnorePar\EndP\fi\EndLink} This definition tries to insert the link outside of a paragraph, so the XML is at least well-formed. It seems that the LibreOffice can open the resulting file, so it seems to work somehow. This definition cannot be used for HTML, because the code it produces is non-valid. I also don't particularly like the \hypertarget use here. Why Pandoc doesn't use only \label? > 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. I think you may really like the Markdown package then. Best regards, Michal