I want the chapter number and heading in one line without the word Chapter, like "1. Introduction", center aligned for a book class document. I have seen the solution here: Chapter number and chapter title in one line, that gives the title aligned left. I would like to know what I can add or change to align it to the center.
Asked
Active
Viewed 90 times
0
-
1I am wondering how the title of your question relates to the actual question, and I'd like to encourage you to make a more appropriate choice in order to draw the attention of the relevant folks to it. – Jun 09 '18 at 04:14
1 Answers
2
Using Alan Munn's answer and texdoc titlesec suggests
\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\huge\bfseries\filcenter}{\chaptertitlename\ \thechapter:}{1em}{}
\begin{document}
\chapter{A chapter}
\section{A section}
\end{document}
-
Just to fine-tune @marmot's answer to the requirements of @Sasi, [who probably wants "1. Introduction" instead of "Chapter 1: Introduction"] I think
- either the
\chapternameshould be reset to a blank{}with
– Partha D. Jun 09 '18 at 05:28\renewcommand{\chaptername}{{}}...or 2. avoid it in the\titleformatdefinition as :\titleformat{\chapter}[block] {\normalfont\huge\bfseries\filcenter}{\thechapter.}{1ex}{} - either the
-
@ParthaD. Thanks! (If you want, you could write your own answer, or do you want me to merge this into mine?) – Jun 09 '18 at 05:34
-
Thank you so much. marmot's code helped to get what I wanted as I had already reset chapter name to a blank. – Sasi Jun 10 '18 at 08:26
-
@marmot: Since you have solved essentially every aspect of the problem superbly [only possibly overlooked one minor requirement which I pointed out-- and Sasi could have solved by himself] I probably do not owe any original contribution to this post. So I think it's better if you can edit the MWE to that effect. – Partha D. Jun 11 '18 at 12:17