# Problems with verse environment from xelatex to docx via tex4ht

Note: To convert from XeLaTeX source to .odt/.docx, I am using the solution provided by Michal Hoftich. (See there for MWE and the solution by @michal.h21.) The present question is follows upon an earlier bug report.

As far as I can tell, tex4ht has a bit of trouble with the verse environment.

# bug 1: disappearing text

Most seriously, it seems to ignore text that immediately follows the verse (until it reaches a paragraph or section break). For example:

\begin{verse}
\gk{ἐνταῦθα τ(ὸν) Γεώργ(ιον) Χιονιάδην νόει\\
ἀποπληροῦντα τὸν μακρὸν πόθον αὐτοῦ τοῦ φίλου\\
διασχημάτων εὐφυῶν τῶν τῆς ἀστρονομίας.}

Be aware that here George Chioniades\\
satisfies his friend's great desire\\
for well-formed astronomical diagrams.
\end{verse}
This makes clear...

NEW PARAGRAPH


The words "This makes clear..." are omitted from the output.

# bug 2: spacing of verses

A less serious issue is that the outputted verses are oddly spaced: rather than single spaced, with an extra space where I have indicated a "new paragraph" by leaving a gap between the Greek original and the Arabic translation (as it is in the pdflatex/xetex output), it makes it all double-spaced (or at least evenly-spaced with a wider separation than single-spacing).

# question

Is there a simple way to fix these bugs?

## 1 Answer

The first issue is caused by not starting a new paragraph after the verse environment in the tex4ht configuration. I've fixed that in the sources, so the fix should arrive in TL in few days.

Regarding the second issue, you can change the paragraph style for verse in the custom config file:

\Preamble{xhtml}
\ConfigureOO{verse}{\Hnewline
<style:style style:name="verse"
style:family="paragraph"
style:parent-style-name="Text-body"
style:next-style-name="Text-body">
<style:paragraph-properties  fo:margin-left="1.499cm"
fo:margin-right="1cm"
fo:margin-top="0cm"
fo:margin-bottom="0cm"
fo:text-indent="-0.499cm"
style:auto-text-indent="false">
<style:tab-stops/>
</style:paragraph-properties >
</style:style>
\Hnewline}

\xeuniuseblock{Greek}
\xeuniuseblock{Arabic}
\makeatletter
\ConfigureEnv{arab}{\@rltrue}{\@rlfalse}{}{}
\makeatother
\begin{document}
\EndPreamble


The important lines for you are:

             fo:margin-top="0cm"
fo:margin-bottom="0cm"


These are originally set to 0.2cm, this is a minimal possible value.

The result in LO:

• Is there a way to tweak the output further so that it includes an extra space between "stanzas" when a line within verse ends with \\!? – Alex Roberts Jan 18 '19 at 1:34
• @AlexRoberts I've added support for that to tex4ht sources few moments ago. It should be available in TL in few days as usual :) – michal.h21 Jan 18 '19 at 11:41