2

I am relatively new to Latex and I came across a problem I am not able to fix myself. From a friend I got a number of commands for formatting my chapter titles, which works quite well, unfortunately it does not work for the toc-title and chapters with an asterisk (\chapter*{}). Can somebody help to solve this problem?

    \documentclass{book}

    \makeatletter
    \renewcommand{\@makechapterhead}[1]{%
    \vspace*{1 pt}%
    {\setlength{\parindent}{0pt} \raggedright \normalfont
    \bfseries\LARGE\thechapter.\ #1
    \par\nobreak\vspace{20 pt}}}
    \makeatother

    \begin{document}
    \tableofcontents
    \chapter*{Abstract}
    \chapter{Introduction}
    \section{abc}
    \section{def}
    \chapter{Results}
    \section{ABC}
    \end{document}
  • 1
    So you want to format chapters having chapter* right? – subham soni Feb 12 '14 at 17:04
2

Redefine \@makeschapterhead (note the "s") correspondingly.

\documentclass{book}

\makeatletter

\renewcommand{\@makechapterhead}[1]{%
\vspace*{1 pt}%
{\setlength{\parindent}{0pt} \raggedright \normalfont
\bfseries\LARGE\thechapter.\ #1
\par\nobreak\vspace{20 pt}}}

\renewcommand{\@makeschapterhead}[1]{%
\vspace*{1 pt}%
{\setlength{\parindent}{0pt} \raggedright \normalfont
\bfseries\LARGE#1
\par\nobreak\vspace{20 pt}}}

\makeatother

\begin{document}
\tableofcontents
\chapter*{Abstract}
\chapter{Introduction}
\section{abc}
\section{def}
\chapter{Results}
\section{ABC}
\end{document}
2

Let »titlesec« do the job. It will require settings for both numbered and unnumbered chapters.

\documentclass[11pt]{book}
\usepackage[T1]{fontenc}

\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\LARGE\bfseries}
{\thechapter.}
{1em}
{\LARGE}

\titleformat{name=\chapter,numberless}[block]
{\normalfont\LARGE\bfseries}
{}
{0pt}
{\LARGE}

\usepackage{blindtext}

\begin{document}
  \tableofcontents

  \blinddocument
\end{document}
  • As always, the »blindtext« package is only for creating the dummy document, thus not part of the solution. – Thorsten Donig Feb 12 '14 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.