1

I've been using Tex4ht to create a Word-File from LaTeX via ODT (oolatex). I've been wondering if the conversion process can be easier if we generate a Docbook XML from LaTeX. This could be the transformed to DOCX with pandoc.

Now, if I have a basic file like this:

\documentclass{article}
\begin{document}
 Some Text

 \begin{quote}
 A quotation.
 \end{quote}

 Some more text.

 \end{document}

The relevant part in the resulting Docbook XML looks like this:

 --><para>Some Text</para><!--l. 7
 --><para>A quotation.</para><!--l. 10
 --><para>Some more text.</para>

Why is the quote-environment not transformed into a blockquote element? Is this a bug? How can we get the supposed behavior?

  • the Docbook support is nowhere as complete as HTML or ODT support in tex4ht. so configuration for quote is just missing. why do you think it will be easier to use Docbook instead of ODT? – michal.h21 Nov 11 '17 at 21:07
  • Ok. I supposed that a rather basic construct like quote would be covered. – Denis Nov 12 '17 at 21:25
  • Concerning Docbook being easier to use than ODT: First, I have the impression that Docbook is cleaner, better to read and better to parse than ODT, probably since it is a intended for composing documents, whereas ODT is a file format. Also, I find the documentation more accessible. – Denis Nov 12 '17 at 22:08
  • I've added the configuration for quote to tex4ht sources, so this change should be included in TeX distributions soon, hopefully. Nobody is working on the Docbook support systematically, so I am sure many more things are missing. – michal.h21 Nov 12 '17 at 22:57
3

The configuration for quote environment is missing in tex4ht support for Docbook. You can try the following configuration file:

\Preamble{xhtml}
\ConfigureEnv{quote}{\ifvmode\IgnorePar\fi\EndP\HCode{<blockquote>}}{\ifvmode\IgnorePar\fi\EndP\HCode{</blockquote>}\par\ShowPar}{}{}
\begin{document}
\EndPreamble

It will insert <blockqoute> element around the quote environment contents. The \IgnorePar, \EndP and \ShowPar will fix possible issues with paragraphs.

This is the result:

<article
 xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"><title
></title> 

<!--l. 3
--><para>Some Text</para><blockquote
>
     <!--l. 6
--><para>A quotation.</para></blockquote>
<!--l. 9
--><para>Some more text.</para></article>
  • Great. But why is the opening <blockquote> a line before the quotation itself (and the closing </blockquote>)? – Denis Nov 12 '17 at 20:59

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.