2

The scrjura.sty is part of the KOMA-script bundle. I'm using it to draft contracts.

Often I have to deliver a word file. So I'm using tex4ht to produce it from my *.tex file. Let's say, the name of the tex-file is contract.tex, this MWE:

\documentclass[pagesize, ngerman, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, scrjura}
  \usepackage{lmodern}
  \usepackage{microtype}

\title{Sicherheitsbestellung}
\subtitle{gag}

\begin{document}
\maketitle

\begin{contract}
  \Clause{title=Eine Paragraphenüberschrift}
  \label{CLA:erster-Par}

  Dieser Paragraph hat nur einen Absatz und der Text ist kurz.

  \Clause{title=Zweite Überschrift}
\label{CLA:titl-uberschr}

Dieser Paragraph hat zwei Absätze, dieser Satz hier ist der erste.

Und hier haben wir den zweiten Absatz. 

\end{contract}


\end{document}

Then I call tex4ht:

htlatex contract.tex "scrjura" " -cunihtf"

A friendly soul wrote scrjura.cfg years ago, it is a small file:

\catcode`\:=11
\makeatletter

\Preamble{html,charset=utf-8}

\begin{document} 

\def\qtchr{\expandafter\@gobble\string\"}
\
\ConfigureList{contract}
  {\HCode{<div class=\qtchr contract\qtchr>}}
  {\HCode{</div>}}
  {}{}

\append:def\contract@paragraph@font{\a:contract@paragraph@font} 
\append:def\contract@paragraph@font{\b:contract@paragraph@font} 

\NewConfigure{contract@paragraph@font}{2}
\Configure{contract@paragraph@font}
  {\HCode{<div class=\qtchr paragraph\qtchr>}}
  {\Tg</div>}

 \pend:def\parformat{\a:parformat} 
 \append:def\parformat{\b:parformat} 

 \NewConfigure{parformat}{2}
 \Configure{parformat}
   {\EndP\HCode{<p class=\qtchr para\qtchr>
    <span class=\qtchr sentence\qtchr>}}
   {\Tg</span>}

 \Css{.sentence{margin-left:2em; padding-top: .5em;}}
 \Css{.paragraph{margin: 1em;}}
 \Css{.para{margin: .5em;}}

\EndPreamble 

\catcode`\:=12
\makeatother

\endinput

The trouble is: If a clause only consists of the heading and one paragraph, there is no \par between heading and text. This screenshot is taken from the contract.html:

Image displaying two clauses

The usage of the words paragraph in the German text is confusing, just ignore it.

Question: How to change scrjura.cfg to get a \par between heading and paragraph, even if the clause only consists of a heading and one paragraph.

You need to know one thing: If a clause only has one paragraph, scrjura.sty does not enumerate it. If a clause has more than one paragraph, they get numbers.

I really hope I have described my wish clearly. If in doubt, please ask!

2

The configuration file in the MWE hooks to parformat in order to insert <p> and <span> tags that create the paragraphs on the html page. parformat (which prints the sentence number) is not used for a single-sentence paragraph and therefore the html tags are not inserted in this case.

A possible solution would be to hook to \Clause or to \par but this is left as an exercise (i.e. I have no clue how to do that).

A workaround is to slightly modify scrjura.sty to call parformat in all cases. To keep the current output (no number for single sentences) the definition of parformat itself should also be modified to display an argument, allowing it to be called with an empty argument for single sentences and with the sentence number for multiple sentences.

When parformat is modified the use of the argument must be indicated in scrjura.cfg, by using defI instead of def.

MWE:

scrjura.sty

\newcommand*{\parformat}[1]{#1} % was: \newcommand*{\parformat}{(\thepar)}
[...]
\ifnum \@tempcnta>\@ne    %at the end of \newcommand*{\contract@everypar}
    {\usekomafont{parnumber}{\parformat{(\thepar)}\nobreakspace}}% % modified %
\else
  \def\reserved@a{\relax}%
  \ifx\@tempa\reserved@a
    \parformat{}% % modified/added (originally empty clause) %
  \else
    {\usekomafont{parnumber}{\parformat{(\thepar)}\nobreakspace}}% % modified %
  \fi
\fi

scrjura.cfg

[...]
\pend:defI\parformat{\a:parformat} 
\append:defI\parformat{\b:parformat} 
[...]

Result:

enter image description here

  • Thank you! Works! I'll ask the maintainer if he could adapt scrjura without side effects. And maybe Michal H. has an idea, too... – Keks Dose Oct 30 '17 at 21:01

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.