GeneralChapter headings without the word chapter!

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapter headings without the word chapter!

Post by Stefan Kottwitz »

Hi gigi,

welcome to the board!
If you want your own style for chapter headings, sections etc., I recommend to use the titlesec package. There's some documentation to read, but it's worth a read.

You could use fancyhdr to customize your page headings, it's recommendable, without that package you may use \markboth and \markright.

Stefan
LaTeX.org admin

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

gigi
Posts: 2
Joined: Thu Sep 04, 2008 11:05 am

Re: Chapter headings without the word chapter!

Post by gigi »

Hi Stefan,

Thank you very much for the reply and the warm welcome ;)
I read the manual and spent the whole day trying to improve my title, but I've still problem I cannot manage to solve. In my code, I put the following lines to define my fonts :

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setmonofont[Scale=MatchLowercase]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Hoefler Text-Italic} %Zapfino

But my title isn't in the Hoefler Italic font and I don't understand why. I saw that when using the \titleformat, you can play on the format. Therefore, I tried to put {\fontfamily{hoefler}}, or try to find the code of the Hoefler Text-Italic to use the command \fontencoding{}, but I didn't find it. The code defining my title (not completely optimized yet) is :

\renewcommand{\chaptername}{}
\renewcommand{\thechapter}{}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\titleformat{\chapter}[display]
{\bfseries\Huge\itshape}
{\filleft\MakeUppercase{\chaptertitlename} \Huge\thechapter}
{4ex}
{\titlerule
\vspace{2ex}%
\font\x="Hoefler Text-Italic"
\fontsize{30}{10}
{\x\addfontfeature{Color=B4B4B4, Scale=2, Alternate=1}1}\kern-2ex
{\x\addfontfeature{Color=404457, Scale=8, Alternate=1}1}\kern-1ex
\vspace{8ex}%
\filright
}
[
\vspace{2ex}%
\titlerule]

I removed explicitely the numbers from my chapter titles, because I wanted to make them somehow different. But the second problem is that I would like that for the sections, subsections,... the number contains the number of the chapter : for example Section 2.1. Otherwise, all the sections start with a 1 and this is not clear any more which section we are talking about. I managed to reput the number of the section using :

\renewcommand{\thesection}{\arabic{section}}

And for the chapter, I tried this, but I doesn't seem to be the way to do it :

\renewcommand{\thesection}{\arabic{chapter}}

If you have any clue about these questions, it would be of great help.
Thanks,
Gigi
wyssel
Posts: 2
Joined: Wed Feb 25, 2009 10:52 pm

Re: Chapter headings without the word chapter!

Post by wyssel »

Hi,

I've read some of the help here, but nothing has worked for me. All I want is to change the way my chapter headings look, from:

Chapter 1

'Chapter title'

to:

1 'Chapter title'

I don't want anything else to change; just to get rid of the word chapter and put the actual title of the chapter next to the number instead of on a new line. There must be a simple way to do this, right?

Thanks :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Chapter headings without the word chapter!

Post by localghost »

The simplest way to do that is to use another document class with built-in features. There are the classes from the KOMA Script bundle or the very flexible memoir class. But with these classes there might come other changes (i. e. type area). Alternatively you can try your luck with the titlesec package.


Best regards and welcome to the board
Thorsten¹
wyssel
Posts: 2
Joined: Wed Feb 25, 2009 10:52 pm

Re: Chapter headings without the word chapter!

Post by wyssel »

Hey thanks! I got my nice chapter headings now. And it was really easy, just as I thought :)

In case anyone is trying to do the same here's what I did:

First I installed the titlesec package
\usepackage{titlesec}

and then added this one line to the preamble and presto! Beauty! Poetry! Etc...

\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{}

Sigh... now to actually write some content under my nice headings....
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapter headings without the word chapter!

Post by Stefan Kottwitz »

Hi wyssel,

very good that your headings are perfect now!
Just one remark: the \bf macro is obsolete, better use LaTeX2e font commands.

Stefan
LaTeX.org admin
Yoni
Posts: 3
Joined: Thu Jun 10, 2010 2:47 pm

Chapter headings without the word chapter!

Post by Yoni »

wyssel wrote:Hey thanks! I got my nice chapter headings now. And it was really easy, just as I thought :)

In case anyone is trying to do the same here's what I did:

First I installed the titlesec package
\usepackage{titlesec}

and then added this one line to the preamble and presto! Beauty! Poetry! Etc...

\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{}

Sigh... now to actually write some content under my nice headings....


Hi wyssel
This was exactly what i have been looking for.Thanks for sharing. I only have one little problem with it now, the table of contents command (\tableofcontents) could not be run. It only runs when i remove the \titleformat...
any idea
Yoni
Posts: 3
Joined: Thu Jun 10, 2010 2:47 pm

Re: Chapter headings without the word chapter!

Post by Yoni »

Got it right with document class scrbook. It does not require
\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{} Good one.
Nihisil
Posts: 1
Joined: Tue Sep 20, 2011 1:53 am

Chapter headings without the word chapter!

Post by Nihisil »

Yoni wrote:Got it right with document class scrbook. It does not require
\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{} Good one.
It make:
1 Chapter First
2 Chapter Second

How make:
1. Chapter First
2. Chapter Second
?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Chapter headings without the word chapter!

Post by localghost »

Nihisil wrote:
Yoni wrote:Got it right with document class scrbook. It does not require
\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{} Good one.
It make:
1 Chapter First
2 Chapter Second

How make:
1. Chapter First
2. Chapter Second
?
Just add a dot at the appropriate place.

Code: Select all

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

\titleformat{\chapter}[hang]{\bfseries\huge}{\thechapter.}{2pc}{}
\titlelabel{\thetitle.\quad}   % For consistency in all headings

\begin{document}
  \blinddocument
\end{document}
For details refer to the titlesec manual.

And next time please open a new topic instead of answering to one that is more than one year old. Your questions then will be recognized much faster as such.


Thorsten
Post Reply