3

tex4ht discards the added spaces in this document when converting to .odt format (pdflatex file && mk4ht oolatex file).

Is there a way to write spacing commands that tex4ht will preserve?

\documentclass{article}

\newcommand{\blankline}{\par\vspace*{\baselineskip}}
\newcommand{\shiftright}{\par\hspace*{1em}}
\setlength{\parindent}{0pt}

\begin{document}
One
\blankline
Two
\shiftright Three 
Four
\blankline
Five
\end{document}
2

This is no surprise, you must provide custom configurations for your own commands, for example using following .cfg file:

\Preamble{xhtml}
\begin{document}

\renewcommand{\blankline}{\ifvmode\IgnorePar\fi\EndP\HCode{<text:p text:style-name="blankline"></text:p>}\par}
\renewcommand{\shiftright}{\par\HCode{<text:span text:style="shiftright">&nbsp;</text:span>}}
\OOstyles{%                                                                                                                                           
  <style:style style:name="blankline" style:family="paragraph" 
         style:parent-style-name="Text-body">
    <style:paragraph-properties             
       fo:margin-top="0.0cm"               
       fo:margin-bottom="0.0cm"           
    />                                   
  </style:style>                        
}
\OOstyles{%
  <style:style style:name="shiftright" style:family="text" 
 >
    <style:text-properties
    fo:padding="1cm"
    />                                   
  </style:style>                        
}

\EndPreamble

It inserts OpenDocument Elements in place of your commands and configures some styles associated to them. Note that spacing at the beginning of line doesn't work, it obviously needs some other style than I've used. I may take a look at this issue tomorrow.

enter image description here

2
  • Does any spacing command need a custom configuration? – musarithmia Mar 28 '16 at 21:46
  • @AndrewCashner \bigskip and \medskip works in HTML, they don't seem to be configured in odt output – michal.h21 Mar 28 '16 at 22:00

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.