@@ -147,6 +147,18 @@ $if(numbersections)$
147147$else$
148148\setcounter{secnumdepth}{0}
149149$endif$
150+$if(subparagraph)$
151+$else$
152+% Redefines (sub)paragraphs to behave more like sections
153+\ifx\paragraph\undefined\else
154+\let\oldparagraph\paragraph
155+\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
156+\fi
157+\ifx\subparagraph\undefined\else
158+\let\oldsubparagraph\subparagraph
159+\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
160+\fi
161+$endif$
150162$if(dir)$
151163\ifxetex
152164 % load bidi as late as possible as it modifies e.g. graphicx
@@ -164,6 +176,9 @@ $if(dir)$
164176 \newenvironment{LTR}{\beginL}{\endL}
165177\fi
166178$endif$
179+$for(header-includes)$
180+$header-includes$
181+$endfor$
167182
168183$if(title)$
169184\title{$title$}
@@ -176,22 +191,6 @@ $if(author)$
176191\author{$for(author)$$author$$sep$ \and $endfor$}
177192$endif$
178193\date{$date$}
179−$for(header-includes)$
180−$header-includes$
181−$endfor$
182−
183−$if(subparagraph)$
184−$else$
185−% Redefines (sub)paragraphs to behave more like sections
186−\ifx\paragraph\undefined\else
187−\let\oldparagraph\paragraph
188−\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
189−\fi
190−\ifx\subparagraph\undefined\else
191−\let\oldsubparagraph\subparagraph
192−\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
193−\fi
194−$endif$
195194
196195\begin{document}
197196$if(title)$