General ⇒ Formatting for Chapter Number
Formatting for Chapter Number
I have a problem in a document. I write a master thesis with the book class and I want to make the chapter format as
Chapter (1) instead Chapter 1
Chapter (2) instead Chapter 2
Chapter (3) instead Chapter 3
...
Thanx
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Formatting for Chapter Number
welcome to the board!
It can easily be redefined. Just put into your preamble:
Code: Select all
\renewcommand*{\thechapter}{(\arabic{chapter})}
Re: Formatting for Chapter Number
thanks Stefan... it is working well!
But I have another problem, the chapter becomes Chapter (1) but the section becomes
(1).1
(1).2
(1).3
...
Thanks in advance
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Formatting for Chapter Number
Code: Select all
\renewcommand*{\thesection}{\arabic{chapter}.\arabic{section}}
Re: Formatting for Chapter Number
I want also to remove the vertical space between chapter title and the "chapter" keyword so I want the chapter will be
Chapter (1) | instead Chapter (1)
Introduction |
Introduction
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Formatting for Chapter Number

Stefan
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Formatting for Chapter Number
\chapter
command by the etoolbox package.
Code: Select all
\documentclass[11pt]{book}
\usepackage[T1]{fontenc}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{\vspace 20\p@}{}{}{}
\makeatother
\begin{document}
\chapter{Foo}
\end{document}
Best regards and welcome to the board
Thorsten
- Attachments
-
- The old chapter formatting.
- chapter-before.png (2.76 KiB) Viewed 4673 times
-
- The new chapter formatting.
- chapter-after.png (2.69 KiB) Viewed 4673 times
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Formatting for Chapter Number
thanks, I download the manual of titlesec package and I found the "titlespacing"
\titlespacing*{<command>}{<left>}{<beforesep>}{<aftersep>}[<right>]
but I don't need it , I want to remove vertical space between chapter title and the "chapter" keyword.
@localghost,
thanks, the figure you attached is really what I want , but the code is n't working well I think the titlesec package will be good but I don't know how....
Regards,
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Formatting for Chapter Number
The words "code isn't working" are not a good description of the problem. Make sure that you have a TeX system that is up to date.amradly wrote:[…] the figure you attached is really what I want , but the code is n't working well I think the titlesec package will be good but I don't know how. […]
Add the
\listfiles
command as very first line to my code example, run the compiler and search the log file (*.log) for the list of used files (quite at the end). This is what I get.
Code: Select all
*File List*
book.cls 2007/10/19 v1.4h Standard LaTeX document class
bk11.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
etoolbox.sty 2011/01/03 v2.1 e-TeX tools for LaTeX
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
***********
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10