3

I'm trying to do two customizations of the amsbook document class.

  1. Remove the trailing dots after chapter and section numbers and after the title of subsections.
  2. The position of the pagenumber should always be centered in the footer. At the moment it appears in the top right corner in each chapter/section beginning

Regarding 1. I already tried

\renewcommand\thesection{\thechapter.\arabic{section}}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}

to no avail. Regarding 2. I'm not sure where to begin to customize this.

I'm using Texmaker and Miktex 2.9

I would be very happy if someone could help me, it's the last piece missing from my thesis.

My MWE is

\documentclass[12pt,a4paper,oneside,final]{amsbook}
\usepackage{blindtext}

%Sprache
\usepackage[english]{babel}
\usepackage[T1]{fontenc}

%Zeichensatz
\usepackage[utf8]{inputenc}

%Images
\usepackage{graphicx}

%PDF Integrierung
\usepackage{pdfpages}

%Formatierung
\usepackage[left=3.5cm,right=2.5cm,top=2cm,bottom=2cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{makecell}

%diverses
\usepackage[section]{placeins}
\usepackage{lscape}
\usepackage{cite}

\usepackage[nomain,acronym,xindy]{glossaries}
\usepackage[xindy]{imakeidx}
\usepackage[labelsep=space]{caption}

\newcommand{\stoptocwriting}{%
  \addtocontents{toc}{\protect\setcounter{tocdepth}{-5}}}
\newcommand{\resumetocwriting}{%
  \addtocontents{toc}{\protect\setcounter{tocdepth}{\arabic{tocdepth}}}}

\newtheorem{thm}{Theorem}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\numberwithin{equation}{chapter}
\numberwithin{figure}{chapter}
\numberwithin{table}{chapter}
\numberwithin{section}{chapter}

\begin{document}
\setcounter{secnumdepth}{2}
\setlength{\parindent}{0em}

\makeatletter
\def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{2.5pc}{}}
\def\l@table{\@tocline{0}{3pt plus2pt}{0pt}{2.5pc}{}}
\def\l@subsection{\@tocline{1}{0pt}{1.5pc}{5pc}{}}
\makeatother

\tableofcontents 

\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\Blindtext
\stoptocwriting
\subsection*{Subsection without number}
\Blindtext
\resumetocwriting

\end{document}
3

The periods are not inserted through \thesection and similar.

In the following code I only left the relevant parts.

\documentclass[12pt,a4paper,oneside,final]{amsbook}
\usepackage{etoolbox}

\usepackage{blindtext}

\numberwithin{section}{chapter}
\makeatletter
% remove the period from the toc
\renewcommand{\tocsection}[3]{%
  \indentlabel{\@ifnotempty{#2}{\ignorespaces#1 #2\quad}}#3} % was #2.\quad
\let\tocchapter\tocsection
\let\tocsubsection\tocsection
\let\tocparagraph\tocsection
\let\tocsubparagraph\tocsection
% remove the period from the section numbers
\renewcommand\@seccntformat[1]{%
  \protect\textup{\protect\@secnumfont
    \csname the#1\endcsname
    \protect\enspace % was \@secnumpoint
  }%
}
% remove the period after the titles
\patchcmd{\@sect}{\@addpunct.}{}{}{}
% fix the page style
\def\ps@headings{\ps@empty
  \def\@evenhead{%
    \setTrue{runhead}%
    \normalfont\scriptsize
    \hfil % <---- was \rlap{\thepage}\hfil
    \def\thanks{\protect\thanks@warning}%
    \leftmark{}{}\hfil}%
  \def\@oddhead{%
    \setTrue{runhead}%
    \normalfont\scriptsize \hfil
    \def\thanks{\protect\thanks@warning}%
    \rightmark{}{}\hfil}% <--- was \hfil\llap{\thepage}
  % taken from \ps@plain
  \def\@oddfoot{\normalfont\scriptsize \hfil\thepage\hfil}%
  \let\@evenfoot\@oddfoot
  %
  \let\@mkboth\markboth
  \def\partmark{\@secmark\markboth\partrunhead\partname}%
  \def\chaptermark{%
    \@secmark\markboth\chapterrunhead{}}%
  \def\sectionmark{%
    \@secmark\markright\sectionrunhead\sectionname}%
}
\makeatother
\pagestyle{headings} % set the default style

\begin{document}

\tableofcontents 

\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\Blindtext

\end{document}

enter image description here

  • 2
    Thank you very much! Works perfectly – Naro Oct 18 '19 at 14:41

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.