-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Expected behavior:
The document outlines and tables of contents in ODT files will match those of PDF files.
Actual behavior:
The document outlines and table of contents in ODT files are established by \section commands.
Longer description:
When converting into ODT, the resulting document map seems to be determined by the \section (and \subsection, etc) commands, without consideration for asterisked versions of these commands (\section*, etc.) and without considering commands like \addcontentsline.
Here's a MWE:
\documentclass[12pt]{article}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{First Section}
\subsection{Subsection}
\section*{Second Section}
\section*{Third Section}\addcontentsline{toc}{section}{Third Section}
Bibliography\addcontentsline{toc}{section}{Bibliography}
\end{document}
The PDF output, with its hyperref-provided document outline on the left, looks like this:

Notice that the Second Section is correctly missing from both the Table of Contents and the document outline because it was added with \section*. Additionally, the Third Section and the Bibliography are in the contents and the document outline because these headings were added with \addcontentsline.
When converting to ODT using the bash command make4ht -f odt mwe.tex, the resulting file looks like this in Microsoft Word:

Notice that the Second Section is incorrectly included in the document outline and Bibliography is missing from it, while the TOC matches the PDF output. When I right click the TOC and choose Update Field, I get this:

Here, the TOC now matches the incorrect document outline. They both incorrectly include Section Two, which was defined using \section*, and they both incorrectly omit Bibliography, which should have been added with \addcontentsline.
P.S. It's likely I should be filing this with TeX4ht instead. I'm still learning where the division is between the two projects.