Skip to content

LaTeX and the Logic of Sectioning

In LaTeX, sections and subsections lack closing tags. So a section with a subsection followed by another section would be represented like so:

\section{A Section} 

\subsection{A Subsection}

\section{Another Section}

A lack of closing tags, however, is far from being structurally innocent. Suppose, instead, we had sections and subsections represented like LaTeX environments:

\begin{section}{A Section}
    \begin{subsection}{A Subsection}
        
    \end{subsection}
\end{section}

With closing tags, we could have text at the beginning of the parent section and at the close of the section that was not part of any subsection. Why would you want to do that? I am currently writing a paper and I decided to break a long section into two subsections—both for ease of reading and to reflect the emerging structure of the text. It made sense to have some introductory remarks and some closing remarks that were part of the section but not part of either subsections. With closing tags, this would have been simple and transparent:

\begin{section}{A Section}
    
    Some introductory remarks.
    
    \begin{subsection}{A Subsection}
        
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        
    \end{subsection}
    
    \begin{subsection}{Another Subsection}
        
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        
    \end{subsection}
    
    Some closing remarks.
    
\end{section}

However, without closing tags, there is no way to represent this logical structure. The introductory remarks at the beginning of the parent section were no problem. It was the closing remarks following the final subsection that posed the problem:

\section{A Section} 

Some introductory remarks

\subsection{A Subsection}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\subsection{Another Subsection}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Some closing remarks.

Notice, the closing remarks are part of the second subsection. To deal with this I had to resort ot a visual hack:

\section{A Section} 

Some introductory remarks

\subsection{A Subsection}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\subsection{Another Subsection}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\\

\noindent Some closing remarks.

\\ in effect introduces a blank line, and \noindent forces the paragraph to begin without indentation. In this way, I signalled that the closing remarks were part of the section and not the final subsection. It is a visual hack since I signalled the status of the closing remarks by the visual layout of the text. As far as LaTeX is concerned, however, the closing remarks are still part of the final subsection. Disheartening for someone enamoured of structural markup.

LaTeX3 is vaporware, and I have no evidence that this issue will even be addressed. I am unfamiliar with ConTeXt—an alternative macro language for TeX that is meant to be based on more uptodate ideas about structural markup. I would be curious to see if this issue arises in ConTeXt as well.

Post a Comment

You must be logged in to post a comment.
FireStats icon Powered by FireStats