Text FormattingChapter heading format change

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Chapter heading format change

Post by nkal »

I am using document class report and wish to change the chapter heading to:
1. Introduction
instead of
Chapter 1
Introduction


which is the default option. In addition, I want to change a few other things about the heading:
1. the color of the heading which I did with
\chapter{\color{mycolor} Introduction}

2. fontsize change to \LARGE
3. underline the heading as shown above
4. boldface

Is there a quick way of doing all of these WITHOUT changing these characteristics in the table of contents?

Thank you in advance!
Nkal

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapter heading format change

Post by Stefan Kottwitz »

Hi Nkal,

you could use titlesec. For example:

Code: Select all

\usepackage{titlesec}
\titleformat{\chapter}
  {\normalfont\LARGE\bfseries\color{darkblue}}{\thechapter.}{1em}{}
Perhaps think again about if you really need underlining. This is an old style of emphasizing, such as with typewriters.

Stefan
LaTeX.org admin
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Chapter heading format change

Post by nkal »

Stefan,

Thank you for your help. That works great! But I need the underlining. It is an odd format that we have in word to submit the reports. I am trying to write my report in latex because it is so much easier than word. But I am getting stuck in small things like these. Once I get the template fixed, the actual report should be much simpler!

Thank you again, if you can help me with the underlining, I can stop scratching my head!

What I have right now is this:
\documentclass[11pt]{report}
\usepackage{titlesec}
\definecolor{darkblue}{rgb}{0.089,0.21,0.363}
\titleformat{\chapter}
{\normalfont\LARGE\bfseries\color{darkblue}}{\thechapter.}{1em}{}

\newpage
\chapter{\color{darkblue}Introduction}


Coloring it blue inside \chapter makes it blue in the table of contents as well. Any fix for that?

Cheers,
Nkal
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapter heading format change

Post by Stefan Kottwitz »

Don't use \color within \chapter, do it within the \titleformat definition.

Regarding the underlining, here's a way:

Code: Select all

\titleformat{\chapter}
  {\normalfont\LARGE\bfseries\color{darkblue}}{\underline{\thechapter.\ }}{0pt}{\underline}
Stefan
LaTeX.org admin
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Chapter heading format change

Post by nkal »

Thank you, Stefan. That works great unless the letter has a tail in the bottom as in g, y, p, etc., then the line under the title is lower than the line under the number.

1. Introduction is fine but 4. Summary is not.

Cheers,
Nkal
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapter heading format change

Post by Stefan Kottwitz »

This can be fixed using ulem and \uline.

Code: Select all

\usepackage[normalem]{ulem}
\usepackage{titlesec}
\titleformat{\chapter}
  {\normalfont\LARGE\bfseries\color{darkblue}}{\uline{\thechapter.\ }}{0pt}{\uline}
Stefan
LaTeX.org admin
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Re: Chapter heading format change

Post by nkal »

Thank you for all your help, Stefan! That works prefect!

Cheers,
Nkal
Post Reply