Text FormattingSpelled-out chapter numbers

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
alarswilson
Posts: 26
Joined: Thu Apr 02, 2009 3:42 pm

Spelled-out chapter numbers

Post by alarswilson »

My thesis guidelines specify:
The words CHAPTER ONE are usually on a line by themselves (no following colon or period), with the title of the chapter double spaced beneath it. The title is centered, in all caps, and in bold face.
I attempted to do this manually, but LaTeX won't let me insert a line-break within a chapter title.

Any suggestions?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Spelled-out chapter numbers

Post by localghost »

A first approach could look like the following sample code.

Code: Select all

\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{titlesec}
\usepackage{blindtext}

\parindent0em

\makeatletter
\newcommand*{\spelled}[1]{%
  \expandafter\@spelled\csname c@#1\endcsname
}
\newcommand*{\@spelled}[1]{%
  \ifcase#1\or{One}\or{Two}\or{Three}\or{Four}\or{Five}\or{Six}\or{Seven}\or{Eight}\or{Nine}\or{Ten}\else\@ctrerr\fi
}
\makeatother

% Setup for headings (titlesec)
\titleformat{\chapter}[display]
{\normalfont\Large\filcenter\bfseries\scshape}
{\LARGE\MakeUppercase{\chaptertitlename~\spelled{chapter}}}
{1pc}
{\Huge}

\begin{document}
  \blinddocument
\end{document}
If you have more than ten chapters, adapt the newly defined \@spelled command. The system how to do that should be clear.

Take a look at the titlesec manual and those of the other used package to learn more.


Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
alarswilson
Posts: 26
Joined: Thu Apr 02, 2009 3:42 pm

Re: Spelled-out chapter numbers

Post by alarswilson »

Again, thank you.
Post Reply