0

I want to format the toc-chapter numbers indpendent of the chapter numbers in the text. The chapter number for the appendix should be in small caps. However, I've modified the \chapterformat in a \EuRoman font. Thus, using \renewcommand*{\thechapter}{\textsc{\alph{chapter}}} changes the appearance of the chapter heading in the text.

What the heading should look like:

What the toc should look like:

enter image description here

MWE:

\documentclass[10pt, oneside, numbers=noenddot, listof=totoc, toc=indentunnumbered]{scrbook}
\usepackage{anyfontsize}
\usepackage{newpxmath}
\usepackage{microtype}
    \DeclareMathAlphabet\EuRoman{U}{eur}{m}{n}
    \SetMathAlphabet\EuRoman{bold}{U}{eur}{b}{n}
    \newcommand{\eurom}{\EuRoman}

\usepackage[osf]{newpxtext} \linespread{1.05}
\usepackage[left=32.5mm, right=25mm, top=25mm, bottom=20mm]{geometry}

\renewcommand*{\chapterformat}{\textls*[-30]{\Huge\fontfamily{pplx}\selectfont$\eurom\thechapter$}}
\setkomafont{chapter}{\huge\fontfamily{qpl}\selectfont\normalfont\lsstyle\scshape}
\addtokomafont{chapterentry}{\normalfont\lsstyle\scshape}
\DeclareTOCStyleEntries[raggedpagenumber=true, linefill=\qquad, pagenumberbox=\mbox]{tocline}{chapter,section,subsection}


\begin{document}
    \tableofcontents
    \appendix
    % \renewcommand*{\thechapter}{\textsc{\alph{chapter}}}
    \chapter{test}
    \section{test}

\end{document}
fuj36840
  • 550
  • I have no idea what you actually want. But you shouldn't add to \thechapter formatting instructions, and specially not instructions meant only for one location. Beside this: why on earth are you setting the chapter number in math mode?? – Ulrike Fischer Jun 09 '20 at 12:06
  • it is in math mode to achieve the font from from this question. The chapter numbering should be in this font and the toc should display small caps – fuj36840 Jun 09 '20 at 12:50
  • 1
    Well, complicated way to select a font. Simply \newcommand\eurom{\usefont{U}{eur}{b}{n}} (or m instead of the b if it shouldn't be bold) should work too. – Ulrike Fischer Jun 09 '20 at 12:57
  • but now the original problem still remains. switching to \renewcommand*{\thechapter}{\textsc{\alph{chapter}}} in order to use small caps in the toc changes the chapter number to a lower case letter, because small caps don't seem to exist in this font. How can I adjust the toc numbers font independent of the chapter numbers? – fuj36840 Jun 09 '20 at 13:10
  • As I said: \thechapter should not contain formatting command like \textsc. If you want to change the formatting in the toc use eg. entrynumberformat. – Ulrike Fischer Jun 09 '20 at 13:41
  • how would I go about changing to small letter numbering caps with entrynumberformat? – fuj36840 Jun 09 '20 at 13:52

1 Answers1

1

I think this is what you want.

\documentclass[10pt, oneside, numbers=noenddot, listof=totoc, toc=indentunnumbered]{scrbook}

\usepackage{anyfontsize} \usepackage{microtype} \usepackage{etoolbox} \usepackage{newpxmath} \usepackage[osf]{newpxtext} \linespread{1.05} \usepackage[left=32.5mm, right=25mm, top=25mm, bottom=20mm]{geometry}

\makeatletter \patchcmd\appendix{@Alph\c@chapter}{@alph\c@chapter}{}{} \renewcommand\chapterlinesformat[3]{% @hangfrom{\formatchapternumber{#2}}{#3}% } \newcommand\formatchapternumber[1]{% \usefont{U}{eur}{m}{n}\Huge \MakeUppercase{#1}% } \renewcommand\sectionlinesformat[4]{% @hangfrom{\hskip #2\formatsectionnumber{#3}}{#4}% } \newcommand\formatsectionnumber[1]{% \scshape #1% } \makeatother \setkomafont{chapter}{\huge\fontfamily{qpl}\selectfont\normalfont\lsstyle\scshape} \addtokomafont{chapterentry}{\normalfont\lsstyle\scshape} \DeclareTOCStyleEntries[raggedpagenumber=true, linefill=\qquad, pagenumberbox=\mbox]{tocline}{chapter, section, subsection} \DeclareTOCStyleEntry[entrynumberformat=\scshape]{tocline}{section}

\begin{document}

\tableofcontents

\appendix

\chapter{Test} \section{Test}

\end{document}

schtandard
  • 14,892