3

I am a total TEX noob, so please forgive me :D

I am trying to prepare a template in LATEX, that I can potentially use for all papers I will have to write, in accordance with my faculty's regulations. However they request an inconsistent titling. The first title (chapter) should have an enddot, while subtitles (sections, subsections...) should not have an enddot.

(I don't think what I've done so far, helps you in figuring out how to solve the problem, but I'll do it anyways :D)

So basically titling (in TOC as well as the pages itself) should look somewhat like this:

1.

1.1

1.2

1.2.1

2.

2.1

%---------------------------------------------------------------------------- % LAYOUT %----------------------------------------------------------------------------

\documentclass[12pt,a4paper,headings=standardclasses]{scrreprt}
\usepackage{showframe}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm]{geometry}
\usepackage[onehalfspacing]{setspace}

%---------------------------------------------------------------------------- % FONT %----------------------------------------------------------------------------

\usepackage{libertine}
\usepackage{libertinust1math}

%---------------------------------------------------------------------------- % TITLES %----------------------------------------------------------------------------

\KOMAoption{chapterprefix}{false}
\RedeclareSectionCommand
  [%
    beforeskip=-1sp
  ]
  {chapter}
\renewcommand\chapterformat
  {%
    \mbox
      {%
        \chapappifchapterprefix{\nobreakspace}\thechapter\autodot
        \IfUsePrefixLine{}{\enskip $|$\enskip}%
     }%
  }

I don't really know how I can achieve this (in a neat way). Also my appendices should be listed as

A

B

C

I did it like so, not sure if there's a prettier way:

\renewcommand{\thesection}{\Alph{section}} 
\begin{appendices}
\input{appendices/demo-appendices.tex}
\end{appendices}
5
  • Welcome to TeX.SX! - Related How to add a dot after the section number?. If you don't like an dot after the section use \makeatletter \def\@seccntformat#1{\@ifundefined{#1@cntformat}% {\csname the#1\endcsname\space}% default {\csname #1@cntformat\endcsname}}% enable individual control \newcommand\section@cntformat{\thesection.\space} % section-level \newcommand\subsection@cntformat{\thesubsection\space} % subsection-level \makeatother (small changes).
    – Bobyandbob
    Aug 19, 2018 at 19:05
  • thank you for your reply! unfortunately it didn't have any effect on my file. :/ I read I could simply change to numbers=noenddot , however I would have to be able to manually create enddots for chapter level.
    – user168390
    Aug 19, 2018 at 20:05
  • Nevermind, I solved it :)
    – user168390
    Aug 19, 2018 at 20:58
  • 3
    @user168390 if you solved it, you should perhaps share your solution, so future visitors can benefit from this question.
    – Skillmon
    Aug 19, 2018 at 21:08
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. Mar 28, 2019 at 19:56

1 Answer 1

8

If only chapters should get a dot at the end of the numbers, you can use numbers=noenddot to remove the enddot for all numbers. The dot for chapters in headings and ToC can be added by

\usepackage{xpatch}
\xpretocmd\chapterformat
  {\def\autodot{.}}% replace \autodot by a fixed dot for chapter headings
  {}{\cfPatchFailed}%
\RedeclareSectionCommand[
  beforeskip=-1sp,
  tocentrynumberformat=\def\autodot{.}% replace \autodot by a fixed dot for chapter entries
]{chapter}

Example:

\documentclass[
  12pt,
  headings=standardclasses,
  chapterprefix=false,
  numbers=noenddot% no dots at the end of numbers
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\usepackage{xpatch}
\xpretocmd\chapterformat
  {\def\autodot{.}}% replace \autodot by a fixed dot for chapter headings
  {}{\cfPatchFailed}%
\RedeclareSectionCommand[
  beforeskip=-1sp,
  tocentrynumberformat=\def\autodot{.}% replace \autodot by a fixed dot for chapter entries
]{chapter}

\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\end{document}

Result:

enter image description here

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .