# Non-integer chapters

I am trying to get a chapter number that is not an integer. My current code looks like this:

\chapter*{Example\vspace{-75pt}\\\huge Chapter 0.5}\vspace{50pt}


However, the code is very messy, and every section needs a similar change for it to stay consistent (Thankfully I don't have any sections in the chapter but it is a problem).

What I am looking for is a solution that solves the first (or both) problems noted above.

EDIT: For clarification, 0.5 is just an example. More examples:

\chapter*{Example\vspace{-75pt}\\\huge Chapter Q}\vspace{50pt}

\chapter*{Example\vspace{-75pt}\\\huge Chapter Zero point five}\vspace{50pt}

\chapter*{Example\vspace{-75pt}\\\huge Chapter Chapter}\vspace{50pt}

\chapter*{Example\vspace{-75pt}\\\huge Chapter $\frac12$}\vspace{50pt}
\addcontentsline{toc}{chapter}{$\mathbf{\frac12}$ Example}

• 0.5 looks like part 0, chapter 5. (Similar to how subsections are numbered.) How are the non-integer numbers incremented? If it is a fixed step across the document you could just format the output in relation to the integer numbers 1, 2, 3, … Commented Nov 19, 2022 at 2:17
• @Qrrbrbirlbel You make a good point, what about fractions \frac{1}{2} instead of decimals 0.5? Commented Nov 19, 2022 at 2:43
• I edited my question to be clearer. Commented Nov 19, 2022 at 3:59
• Your examples are quite diverse; it's probably easy to assume a letter numbering would be sequential (A, B, ..., Z). However, what is sequential about "zero point five" or \frac{1}{2}? That is, what follows it?
– Werner
Commented Nov 19, 2022 at 6:26
• I an not sure what exactly do you want, but maybe \renewcommand{\thechapter}{\ensuremath{\frac12}} will do the job? (This should be done right after \chapter{} command) Commented Nov 19, 2022 at 9:21

Not going to explain too much, but the idea is to define \additionalchapter that does a few things:

1. the chapter number is stepped down (so when \chapter is called the main number is the same as the previous one)

2. \thechapter is redefined to include the desired additional part;

3. \chapter is issued, but in its original form.

Why do we need \standardchapter? Because we have to add to \chapter the code for restoring the standard meaning of \thechapter.

Finally, a code for “textual” fractions is added.

Production notes. I use openany and geometry just to make a smaller picture of the result.

\documentclass[openany]{book}
\usepackage{amsmath} % for \text

\usepackage[a6paper]{geometry} % just to make smaller pictures

% #1 = suffix to add
% #2 = optional argument for toc and header, as usual
% #3 = title
\renewcommand{\thechapter}{\standardthechapter#1}%
\nonstandardchapter[#2]{#3}%
}

\AtBeginDocument{%
\NewCommandCopy{\standardthechapter}{\thechapter}%
\NewCommandCopy{\nonstandardchapter}{\chapter}%
\RenewCommandCopy{\thechapter}{\standardthechapter}%
}%
}

\NewDocumentCommand{\chapfrac}{mm}{$\frac{\text{#1}}{\text{#2}}$}

\begin{document}

\chapter{First}\label{ch:one}

\ref{ch:one}, \ref{ch:oneandhalf}, \ref{ch:oneplus}, \ref{ch:two}

\chapter{Second}\label{ch:two}

\end{document}


• It would be interesting if these extra chapters could keep track of their total amount and just enumerate themselves, i.e. 1, 1 1/3, 1 2/3, 2, … but that's just a section in chapter's clothing. Commented Nov 19, 2022 at 15:50
• This... doesn't work. Commented Jun 23, 2023 at 10:33
• @nonhuman The example does, so you must be doing something else. Just “doesn't work” won't help in order to diagnose your problem. Commented Jun 23, 2023 at 12:11
• @egreg I think you are using nonstandard tex commands. Commented Jun 24, 2023 at 13:03
• @nonhuman I think you're using an outdated TeX distribution. Commented Jun 24, 2023 at 16:51

This creates an array of chapter "numbers" to be used for \thechapter.

\documentclass{report}

\renewcommand{\thechapter}{\csname chapt\arabic{chapter}\endcsname}

\makeatletter
\@namedef{chapt1}{1}
\@namedef{chapt2}{1.5}
\@namedef{chapt3}{II}
\@namedef{chapt4}{C}
\@namedef{chapt5}{$\pi$}
\makeatother

\begin{document}
\chapter{First}
\chapter{Second}
\chapter{Third}
\chapter{Fourth}
\chapter{Fifth}
\end{document}


After realizing that @egreg's answer didn't work on my TeX editor I modified it to make this:

\documentclass[openany]{book}
\usepackage{amsmath} % for \text

\usepackage[a6paper]{geometry}

\newcommand{\customchapter}[2]{
\renewcommand{\thechapter}{#2}
\chapter{#1}
}

\newcommand{\achapter}[1]{ % used after chapter
\renewcommand{\thechapter}{\sthechapter}
\chapter{#1}
}

\AtBeginDocument{
\let\sthechapter\thechapter
%\let\schapter\chapter
%\newcommand{\chapter}[1]{
%\renewcommand{\thechapter}{\sthechapter}
%\schapter{#1}
%} % achapter is not needed
}

\begin{document}
\chapter{First}
\customchapter{Between}{$\mathbf{\frac32}$}
\section{Section Title}
\chapter{chapter} % chapter 3/2
\achapter{Second}
\end{document}

• Your TeX editor is not related to whether TeX can compile an example or not. If egreg's example doesn't work, it would be useful to know why not. If it's because your TeX doesn't recognize the NewDocumentCommand and similar commands, it would be because you have an outdated distribution. Commented Jun 25, 2023 at 21:01