I'm drafting agreements on the topic of renewable energies. Trouble is, clients sometimes need a word-version = my agreement in html. The package tex4ht does the job pretty well, unless I use the package scrjura, a part of the KOMA-Script-bundle. But scrjura makes writing my agreements a lot easier, I would not like to do without it. The package allows to print the agreement in accordance to German standards.

See this example:

\usepackage{scrjura, indentfirst}

      \Paragraph{title=Does it make sense?}

    This first sentences usually talk about the sense of the whole
    contract / agreement / whatever. Unlike many people think, it is not
    forbidden to lawyers to write plain text.

    But there are obstacles. We need some definitions.


    Let's assume we talk about a share-deal agreement. We'd have to name
    the shares.

    And the price.



Ok, the output with pdflatex is:

Agreement pdftex

Now let's add \usepackage{tex4ht}, save the file and compile with htlatex filename.tex. The result is a miss, but not by a mile:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
<html > 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<!-- html --> 
<meta name="src" content="stackexchange-html.tex"> 
<meta name="date" content="2011-08-12 16:00:00"> 
<link rel="stylesheet" type="text/css" href="stackexchange-html.css"> 
<!--l. 7--><p class="noindent" ><span 
class="cmssbx-10x-x-120">&#x00A0;1</span> <span 
class="cmssbx-10x-x-120">Does it make sense?</span><a 
 id="x1-5r1"></a>(1)&#x00A0;This first sentences usually talk about the sense of the whole contract /
agreement / whatever. Unlike many people think, it is not forbidden to lawyers to
write plain text.
 id="x1-7r1"></a>(2)&#x00A0;But there are obstacles. We need some definitions.
class="cmssbx-10x-x-120">&#x00A0;2</span> <span 
 id="x1-11r1"></a>(1)&#x00A0;Let&#8217;s assume we talk about a share-deal agreement. We&#8217;d have to name the
 id="x1-13r1"></a>(2)&#x00A0;And the price.


If you save this as a html-file and open it into your browser, you will notice that everything is ok, except that there are no paragraphs. The fat printed titles appear in the same line as the numbered "paragraphs", of which each one should have it's own, well, paragraph, as in the picture above.

Can anybody help me to write a config-file for tex4ht to get an output including proper paragraphs?


The command \Paragraph{title= ...} provides a headline to the following text. How can I inform tex4ht about this?

1 Answer 1


I don't understand code of scrjura, so this is just little hack:

\ConfigureEnv{contract}{\HCode{<div class="contract">}}{\HCode{</div>}}{}{}
\Css{.contract {white-space:pre-wrap;}}

save it for example as jura.cfg and call htlatex yourfile "jura". There is some error message, which I don't understand, but generated code is ok.

In the code, we are instructing tex4ht to insert at beginning and end of environment contracttag <div> with class contract and then we use css to print white spaces. More robust strategy would be to put hooks for some internal macros of scrjura, but I still don't understand configuring macros of tex4ht and I am getting some really weird errors, when I try to use them


it seems that some operations aren't possible in config files. so we must develop .4ht file for scrjura. In file step4ht.pdf I have found most user friendly explanation of defining hooks for tex4ht.

If we have macro without arguments, we at first must define hooks, which will be put before and after its contents. Their structure is as follows:

\pend:def\bar{\a:bar} % before
\append:def\bar{\b:bar} % after

and then we will declare that we have two hooks for this macro:


and define code, which will be put there

\Configure{bar}{\HCode{<br />}}{}

in this case, we vill put tag <br /> before contents of the macro.

I have found very difficult to understand definition of scrjura, mainly because I don't speak German. So with trial and error, I have found some macros, where I can put manual breaks. This is file scrjura.4ht

\typeout{[scrjura for tex4ht]}

\ConfigureEnv{contract}{\HCode{<div class="contract">}}{\HCode{</div>}}{}{}

\Configure{parformat}{\HCode{<br /><span class="sentence" />}\EndP}{}

\Configure{contract@paragraph@font}{\HCode{<br /><span class="paragraph" />}}{}


Regarding error tex4ht reports on the first \Paragraph, if I insert blank line between \begin{contract} and \Paragraph{title=Does it make sense?}, this error disappear.

The result now looks this way:

enter image description here

It would be best, if we can put div with some class attribute on each paragraph and sentence, but I still don't know how

  • First of all, thank you for your help. It seems to be a complex issue. Strange enough, sometimes I get good output (titles of paragraphs in bold), and sometimes not. And as you mentioned, errors. However, that's a start.
    – Keks Dose
    Aug 17, 2011 at 11:31
  • There is problem, that tex4ht is very complex and it's documentation is not the best, and with scrjura, this problem is the same + documentation is in German
    – michal.h21
    Aug 17, 2011 at 13:08
  • I does not work, unfortunately. In Word and OpenOffice there are no paragraphs, it looks like before: all in one line.
    – Keks Dose
    Aug 18, 2011 at 9:15
  • Michal, thank you for your work, your edited solution looks promising! But what do I do with the file scrjura.4ht? Sorry for the stupid question. Regards, Alexander
    – Keks Dose
    Aug 18, 2011 at 15:58
  • files with suffix .4ht are called when package of the same name is loaded. you must place it somewhere, where it can be found by LaTeX - in the current directory, or to your local texmf tree. see tex.stackexchange.com/questions/12701/…
    – michal.h21
    Aug 18, 2011 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .