
Na classe scrreprt, usando o pacote tocstyle, gostaria que a palavra "Capítulo 1" estivesse em negrito no TOC, mas não o título do capítulo (ver imagem). Como faço para conseguir isso? Por padrão, tudo está em negrito. Usar \addtokomafont{chapterentry}{\mdseries}
altera a fonte de toda a linha de entrada do sumário.
MWE:
\documentclass[twoside, openright, BCOR=1cm, headsepline,chapterprefix=true]{scrreprt}
%%---header/footer
\usepackage[manualmark]{scrlayer-scrpage}
\automark{chapter}
%%--"Chapter #" in lehead, chapter name in rohead
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
\usepackage{lipsum}
%%---add "Chapter #" in TOC before chapter title, only for numbered chapters
\let\oldaddchaptertocentry\addchaptertocentry
\renewcommand{\addchaptertocentry}[2]{%
\ifstr{#1}{}{%
\oldaddchaptertocentry{#1}{#2}}{%
\oldaddchaptertocentry{\chapapp{} #1}{#2}%
}}
\usepackage[toctextentriesindented]{tocstyle}
\usetocstyle{KOMAlike}
\settocstylefeature{spaceafternumber}{16pt}
\setcounter{secnumdepth}{0}
\setcounter{tocdepth}{0}
\begin{document}
\tableofcontents
\chapter{An interesting title}
\thispagestyle{empty}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\addchap{Unnumbered chapter}
\thispagestyle{empty}
\newpage
\section{Section title}
\lipsum[6-15]
\end{document}
Responder1
Observe que o pacote tocstyle
não está mais desenvolvido. Portanto, você receberá avisos.
Eu sugeriria usar comandos, opções etc. de package tocbasic
. Este pacote também faz parte do pacote KOMA-Script e a classe KOMA-Script é carregada tocbasic
automaticamente.
Sugestão sem tocstyle
:
\documentclass[twoside, openright, BCOR=1cm, headsepline,chapterprefix=true,
toc=indentunnumbered% <- added
]{scrreprt}
\usepackage{lipsum}% only for dummy text
%%---header/footer
\usepackage[manualmark]{scrlayer-scrpage}
\automark{chapter}
%%--"Chapter #" in lehead, chapter name in rohead
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
\addtokomafont{chapterentry}{\mdseries}
\DeclareTOCStyleEntry[
entrynumberformat=\textbf,
numsep=16pt,
dynnumwidth
]{chapter}{chapter}
%%---add "Chapter #" in TOC before chapter title, only for numbered chapters
\let\oldaddchaptertocentry\addchaptertocentry
\renewcommand{\addchaptertocentry}[2]{%
\ifstr{#1}{}{%
\oldaddchaptertocentry{#1}{#2}}{%
\oldaddchaptertocentry{\chapapp{} #1}{#2}%
}}
\setcounter{secnumdepth}{\chapternumdepth}
\setcounter{tocdepth}{\chaptertocdepth}
\renewcommand\chapterpagestyle{empty}% if all chapter pages should use page style empty
\begin{document}
\tableofcontents
\chapter{An interesting title}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\addchap{Unnumbered chapter}
\newpage
\section{Section title}
\lipsum[6-15]
\end{document}
Execute três vezes para obter:
Se o número da página da entrada do capítulo também estiver em negrito, você poderá adicionar
pagenumberformat=\usekomafont{chapterentry}\textbf
para as opções do \DeclareTOCStyleEntry
capítulo.
Exemplo:
\documentclass[twoside, openright, BCOR=1cm, headsepline,chapterprefix=true,
toc=indentunnumbered% <- added
]{scrreprt}
\usepackage{lipsum}% only for dummy text
%%---header/footer
\usepackage[manualmark]{scrlayer-scrpage}
\automark{chapter}
%%--"Chapter #" in lehead, chapter name in rohead
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
\addtokomafont{chapterentry}{\mdseries}
\DeclareTOCStyleEntry[
entrynumberformat=\textbf,
pagenumberformat=\usekomafont{chapterentry}\textbf,
dynnumwidth
]{chapter}{chapter}
%%---add "Chapter #" in TOC before chapter title, only for numbered chapters
\let\oldaddchaptertocentry\addchaptertocentry
\renewcommand{\addchaptertocentry}[2]{%
\ifstr{#1}{}{%
\oldaddchaptertocentry{#1}{#2}}{%
\oldaddchaptertocentry{\chapapp{} #1}{#2}%
}}
\setcounter{secnumdepth}{\chapternumdepth}
\setcounter{tocdepth}{\chaptertocdepth}
\renewcommand\chapterpagestyle{empty}% if all chapter pages should use page style empty
\begin{document}
\tableofcontents
\chapter{An interesting title}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\addchap{Unnumbered chapter}
\newpage
\section{Section title}
\lipsum[6-15]
\end{document}
Execute três vezes para obter:
Responder2
Aqui está uma maneira de adicionar dentro \textnormal
do segundo argumento do seu comando definido:
\documentclass[twoside, openright, BCOR=1cm, headsepline,chapterprefix=true]{scrreprt}
%%---header/footer
\usepackage[manualmark]{scrlayer-scrpage}
\automark{chapter}
%%--"Chapter #" in lehead, chapter name in rohead
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
\usepackage{lipsum}
%%---add "Chapter #" in TOC before chapter title, only for numbered chapters
\let\oldaddchaptertocentry\addchaptertocentry
\renewcommand{\addchaptertocentry}[2]{%
\ifstr{#1}{}{%
\oldaddchaptertocentry{#1}{\textnormal{#2}}}{%
\oldaddchaptertocentry{\chapapp{} #1}{\textnormal{#2}}%
}}
\usepackage[toctextentriesindented]{tocstyle}
\usetocstyle{KOMAlike}
\settocstylefeature{spaceafternumber}{16pt}
\setcounter{secnumdepth}{0}
\setcounter{tocdepth}{0}
\begin{document}
\tableofcontents
\chapter{An interesting title}
\thispagestyle{empty}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\addchap{Unnumbered chapter}
\thispagestyle{empty}
\newpage
\section{Section title}
\lipsum[6-15]
\end{document}