For the unnumbered sections units of documents built with a personal class
(which inherits from the book class), I'd like to use:
- not the starred form of the corresponding commands,
- instead the
tocvsec2package's\setsecnumdepth{none}and\resetsecnumdepthswitches.
This has several advantages:
- no need to use the star form for each sections, subsections, etc. of a unnumbered chapter,
- no need to use the cryptic
\addcontentsline{toc}{...}{...}command for each of the unnumbered sections units supposed to appear in the table of contents, - no trouble with the headers of unnumbered chapter and sections (which, with starred form, are the ones of the previous numbered chapter and sections).
This is shown in the two following MCEs: the first one with the traditional star commands (headers problem not solved),
\documentclass{book}
\usepackage{tocvsec2}
\usepackage{lipsum}
\begin{document}
%
\tableofcontents
%
\chapter{Numbered chapter}
\lipsum[1-10]
\section{Numbered section}
\lipsum[1-10]
%
\chapter*{Unnumbered chapter}
\addcontentsline{toc}{chapter}{Unnumbered chapter}
\lipsum[1-10]
\section*{Unnumbered section}
\addcontentsline{toc}{section}{Unnumbered section}
\lipsum[1-10]
%
\chapter{Numbered chapter (bis)}
\lipsum[1-10]
\section{Numbered section (bis)}
\lipsum[1-10]
%
\chapter*{Unnumbered chapter (bis)}
\addcontentsline{toc}{chapter}{Unnumbered chapter (bis)}
\lipsum[1-10]
\section*{Unnumbered section (bis)}
\addcontentsline{toc}{section}{Unnumbered section (bis)}
\lipsum[1-10]
%
\end{document}
and the second one with the tocvsec2 package features.
\documentclass{book}
\usepackage{tocvsec2}
\usepackage{lipsum}
\begin{document}
%
\tableofcontents
%
\chapter{Numbered chapter}
\lipsum[1-10]
\section{Numbered section}
\lipsum[1-10]
%
\setsecnumdepth{none}%
%
\chapter{Unnumbered chapter}
\lipsum[1-10]
\section{Unnumbered section}
\lipsum[1-10]
%
\resetsecnumdepth%
%
\chapter{Numbered chapter (bis)}
\lipsum[1-10]
\section{Numbered section (bis)}
\lipsum[1-10]
%
\setsecnumdepth{none}%
%
\chapter{Unnumbered chapter (bis)}
\lipsum[1-10]
\section{Unnumbered section (bis)}
\lipsum[1-10]
%
\end{document}
But, in order to let my personal class be as simple as possible, I'd like to
provide both the traditional syntax (with the star form for the unnumbered
sections units) and the tocvsec2 package's features. (In fact, it should be
enough to redefine the \chapter command.)
All my attempts for this failed, e.g.:
\documentclass{book}
\usepackage{lipsum}
\usepackage{tocvsec2}
%
\makeatletter%
\let\chapter@ORI\chapter%
\renewcommand\chapter{%
\@ifstar{\starred@chapter}{\unstarred@chapter}%
}
\newcommand{\starred@chapter}{\setsecnumdepth{none}\chapter@ORI}%
\newcommand{\unstarred@chapter}{\resetsecnumdepth\chapter@ORI}%
\makeatother%
%
\begin{document}
%
\tableofcontents
%
\chapter{Numbered chapter}
\lipsum[1-10]
\section{Numbered section}
\lipsum[1-10]
%
\chapter*{Unnumbered chapter}
\lipsum[1-10]
\section{Unnumbered section}
\lipsum[1-10]
%
\chapter{Numbered chapter (bis)}
\lipsum[1-10]
\section{Numbered section (bis)}
\lipsum[1-10]
%
\chapter*{Unnumbered chapter (bis)}
\lipsum[1-10]
\section{Unnumbered section (bis)}
\lipsum[1-10]
%
\end{document}
or:
\documentclass{book}
\usepackage{xpatch}
\usepackage{lipsum}
\usepackage{tocvsec2}
%
\makeatletter%
\xpretocmd{\@chapter}{\resetsecnumdepth}{}{}%
\xpretocmd{\@schapter}{\setsecnumdepth{none}}{}{}%
\makeatother%
\begin{document}
%
\tableofcontents
%
\chapter{Numbered chapter}
\lipsum[1-10]
\section{Numbered section}
\lipsum[1-10]
%
\chapter*{Unnumbered chapter}
\lipsum[1-10]
\section{Unnumbered section}
\lipsum[1-10]
%
\chapter{Numbered chapter (bis)}
\lipsum[1-10]
\section{Numbered section (bis)}
\lipsum[1-10]
%
\chapter*{Unnumbered chapter (bis)}
\lipsum[1-10]
\section{Unnumbered section (bis)}
\lipsum[1-10]
%
\end{document}
Do you see a clever way for redefining the unstarred and starred forms of the
\chapter command?
\frontmatter". In such a case, symmetry implies that conclusion is unnumbered as well and hence goes to the\backmatterpart. So far so good, except if there are\appendixchapters: IMO, such chapters have (1) to be numbered, (2) to appear after conclusion and here is the clash: "appendix numbered chapters" and "after an unnumbered conclusion" are incompatible requirements with the default\backmatterand\appendixswitches. – Denis Bitouzé Feb 26 '14 at 08:18texdoc memdesign) says "[t]here may be a final chapter in the main matter called Conclusions, or similar" (p. 18) (and, what hits my taste for symmetry, advises the introduction to be in the front matter (p. 72)). Maybe I should ask a new question about the book structure... – Denis Bitouzé Feb 26 '14 at 10:36\frontmatter" and "Only\backmattermaterial is not numbered." are true only for chapters: parts and (sub(sub))sections are numberd in front and back matter parts. – Denis Bitouzé Feb 26 '14 at 10:56