I am using chapters. I want to include one section (a page or two) that does not have a chapter number, and that does not increment the chapter counter. I've tried include
ing it, without using chapter
, and the section didn't show up at all. How can I include a chapter-less section in a chaptered document?
1 Answer
For example, use \counterwithout{section}{chapter}
to remove chapter counter output in front of the section number (this does remove the section counter also from the reset list!)
Later on, it's possible to use \counterwithin{section}{chapter}
to restore the usual setup.
\documentclass{book}
\usepackage{chngcntr}
\begin{document}
\chapter{First}
\counterwithout{section}{chapter}
\section{Has no chapter number}
\section{Other section}
\counterwithin{section}{chapter}
\chapter{Second}
\section{Foo}
\end{document}
Here's a package-less approach, just using a redefinition of \thesection
, but storing the original version before with \let\latexthesection\thesection
.
\documentclass{book}
\let\latexthesection\thesection
\begin{document}
\chapter{First}
\renewcommand{\thesection}{\arabic{section}}
\section{Has no chapter number}
\section{Other section}
\renewcommand{\thesection}{\latexthesection}
\chapter{Second}
\section{Foo}
\end{document}
Update with Interlude
headings
\documentclass{book}
\let\latexthesection\thesection
\usepackage{blindtext}
\begin{document}
\chapter{First}
\renewcommand{\thesection}{\arabic{section}}
\markboth{Interlude}{Interlude}
\section{Has no chapter number}
\section{Other section}
\renewcommand{\thesection}{\latexthesection}
\chapter{Second}
\section{Foo}
\blindtext[5]
\end{document}
-
That works, thanks! How can I add a chapter-like header to that un-chaptered section? I'd like it to look like the rest of the "Chapter x" headings in the document, but saying "interlude" or something like that. Commented Apr 16, 2016 at 12:51
-
@horsehair: That's another question ;-)– user31729Commented Apr 16, 2016 at 12:52
-
@horsehair: See the update– user31729Commented Apr 16, 2016 at 12:59
\include
uses a\clearpage
'inevitably', so the content of your external file was shifted the next page