Page LayoutSuppress newline after number in \chapter

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
stefan_fuglsang
Posts: 12
Joined: Mon Oct 04, 2010 9:41 am

Suppress newline after number in \chapter

Post by stefan_fuglsang »

I have removed the "Chapter" text in the \chapter command, but how can I suppress the newline after the chapter number? The example below prints
1
<vertical space>
Introduction
<vertical space>
Blabla bla bla
I would like this:
1 Introduction
<vertical space>
Blabla bla bla

Code: Select all

\documentclass[a4paper,12pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
%remove "Chapter" text in headlines:
\addto\captionsenglish{\renewcommand\chaptername{}}
\begin{document}
\chapter{Introduction}
Blabla bla bla
\end{document}
Thanks,
Stefan
Last edited by stefan_fuglsang on Fri Feb 04, 2011 10:00 am, edited 1 time in total.

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Suppress newline after number in \chapter

Post by frabjous »

I recommend using the titlesec. You'll want to read its documentation, especially regarding getting finer-grained control over title spacing.

Code: Select all

\documentclass[a4paper,12pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}

\usepackage{titlesec}
\titleformat{\chapter}% reformat chapter headings
    [hang]% like section, with number on same line
    {\Huge\bfseries}% formatting applied to whole
    {\thechapter}% Chapter number
    {0.5em}% space between # and title
    {}% formatting applied just to title

\begin{document}
\chapter{Introduction}
Blabla bla bla
\end{document}
There is no need to redefine \chaptername; that could have unintended consequences elsewhere.
stefan_fuglsang
Posts: 12
Joined: Mon Oct 04, 2010 9:41 am

Re: Suppress newline after number in \chapter

Post by stefan_fuglsang »

Thank you,
I will try that.
Post Reply