4

I added some rules on my repport in order to add \subsubsubsection.

On below the MWE :

\documentclass[a4paper,11pt,french]{report}
\usepackage[francais]{babel}




\usepackage{titlesec}
\titleclass{\subsubsubsection}{straight}[\subsection]

\newcounter{subsubsubsection}
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered

\titleformat{\subsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
\def\toclevel@paragraph{6}
\def\l@subsubsubsection{\@dottedtocline{4}{10em}{5em}}
\def\l@paragraph{\@dottedtocline{5}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{6}{14em}{6em}}
\@addtoreset{subsubsubsection}{section}
\@addtoreset{subsubsubsection}{subsection}
\@addtoreset{subsubsubsection}{subsubsection}
\makeatother

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}




\begin{document}


\tableofcontents

\pagebreak

\section{test}
\subsubsubsection{test11}
\subsubsubsection{test12}
\subsubsubsection{test13}

\section{test2}
\subsubsubsection{test21}
\subsubsubsection{test22}
\subsubsubsection{test23}


\end{document}

However, when running htlatex on texmaker (separate HTML page), this \subsubsubsection rule is not recognized.

Question 1) How can I fix it please ?

Question 2) Furthermore, is there a way to include/export tikz pictures on the HTML ?

1
1

I am not sure whether using \subsubsubsection is a good idea, but anyway. Move \subsubsubsection definition to its own package, subsubsub.sty:

\usepackage{titlesec}
\titleclass{\subsubsubsection}{straight}[\subsection]

\newcounter{subsubsubsection}
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered

\titleformat{\subsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
\def\toclevel@paragraph{6}
\def\l@subsubsubsection{\@dottedtocline{4}{10em}{5em}}
\def\l@paragraph{\@dottedtocline{5}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{6}{14em}{6em}}
\@addtoreset{subsubsubsection}{section}
\@addtoreset{subsubsubsection}{subsection}
\@addtoreset{subsubsubsection}{subsubsection}
\makeatother

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

now define tex4ht configuration file for this package subsubsub.4ht:

\NewSection\subsubsubsection{\thesubsubsubsection}
\Configure{subsubsubsection}
    {}{}
    {\ifvmode \IgnorePar\fi \EndP\addtocounter{subsubsubsection}{1}\HCode{<h4>}\thesubsubsubsection\quad}
    {\HCode{</h4>}}

this declares \subsubsubsection as sectioning command and new configure hook subsubsubsection is created. With \Configure{subsubsubsection} you can configure appearance of this section.

Now you need to include subsubsub package in your document:

\documentclass[a4paper,11pt,french]{report}
\usepackage[francais]{babel}
\usepackage{subsubsub}

\begin{document}


\tableofcontents

\pagebreak

\section{test}
\subsubsubsection{test11}
\subsubsubsection{test12}
\subsubsubsection{test13}

\section{test2}
\subsubsubsection{test21}
\subsubsubsection{test22}
\subsubsubsection{test23}


\end{document}

after compilation with

 htlatex filename xhtml

this is the result

enter image description here

generated html:

<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->  
<html xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"  
> 
<head><title></title> 
<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/)" /> 
<!-- xhtml,html --> 
<meta name="src" content="oursay.tex" /> 
<meta name="date" content="2014-02-25 13:44:00" /> 
<link rel="stylesheet" type="text/css" href="oursay.css" /> 
</head><body 
>

   <h2 class="likechapterHead"><a 
 id="x1-1000"></a>Table des matières</h2> <div class="tableofcontents">
   &#x00A0;<span class="sectionToc" >0.1 <a 
href="#x1-20001" id="QQ2-1-2">test</a></span>
<br />   &#x00A0;<span class="sectionToc" >0.2 <a 
href="#x1-60002" id="QQ2-1-6">test2</a></span>
   </div>

<a 
 id="x1-1001r1"></a>
<h3 class="sectionHead"><span class="titlemark">0.1   </span> <a 
 id="x1-20001"></a>test</h3>
   <h4>0.1.0.0.1   <a 
 id="x1-30000.1.0.0.1"></a>test11</h4>
   <h4>0.1.0.0.2   <a 
 id="x1-40000.1.0.0.2"></a>test12</h4>
   <h4>0.1.0.0.3   <a 
 id="x1-50000.1.0.0.3"></a>test13</h4>
<a 
 id="x1-5001r2"></a>
<h3 class="sectionHead"><span class="titlemark">0.2   </span> <a 
 id="x1-60002"></a>test2</h3>
   <h4>0.2.0.0.1   <a 
 id="x1-70000.2.0.0.1"></a>test21</h4>
   <h4>0.2.0.0.2   <a 
 id="x1-80000.2.0.0.2"></a>test22</h4>
   <h4>0.2.0.0.3   <a 
 id="x1-90000.2.0.0.3"></a>test23</h4>

</body></html>

At this moment, \subsubsubsection doesn't appear in the toc, I need to investigate why.

3
  • 1
    I see what you mean, but so far it is not working neither by my side. – oursay Feb 25 '14 at 12:31
  • @oursay I forgot to mention that you must include package subsubsub in your document. does it work now? – michal.h21 Feb 25 '14 at 13:14
  • Thanks again. I notice an issue by my side : when using a dept of 4 by my side, it is not working. Why when I move to 5 of depts, it works (but it's not the right numeration) ? Why did you choose : \setcounter{secnumdepth}{4} \setcounter{tocdepth}{4} ? – oursay Feb 25 '14 at 15:59

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.