TransWikia.com

Format of unnumbered chapter in TOC to be equal to the format of numbered chapter

TeX - LaTeX Asked on September 29, 2021

I am using classicthesis and arsclassica to write my thesis.

I have used addchap to add a unnumbered chapter, that is automatically added to the TOC. However, the graphic format/font of those unnumbered chapters is different, and I would like to make it equal to the format of the numbered chapters?

Imgur

In the image, I would like to change “Sommario,Abstract,Introduzione” to be equale to LOREM (and also, if possible, to align them to the L)

documentclass[10pt,%                    
               a4paper,%                  
               twoside,openright,%        
%              oneside,openany,%         
               titlepage,%               
               headinclude,,footinclude,%  
               BCOR5mm,%                  
               cleardoublepage=empty,%    
               captions=tableheading,%       
               ]{scrreprt}    
usepackage[T1]{fontenc}

usepackage{lipsum}
usepackage[utf8]{inputenc}
usepackage[english,italian]{babel}       

usepackage[eulerchapternumbers,%        
            beramono,%                   
            eulermath,%                    
            pdfspacing,%                 
            listings,%                  
%           parts,%                       
            ]{classicthesis}   
usepackage{arsclassica}    
begin{document}
hypersetup{pageanchor=false}
pagestyle{scrheadings} 
pagenumbering{gobble}


cleardoublepage
pdfbookmark{contentsname}{tableofcontents}
setcounter{tocdepth}{2}
tableofcontents
markboth{spacedlowsmallcaps{contentsname}}{spacedlowsmallcaps{contentsname}} 
cleardoublepage

hypersetup{pageanchor=true}
pagenumbering{arabic}

deftripstyle{pgnumtopouter}{}{}{pagemark}{}{}{}
renewcommand{chapterpagestyle}{pgnumtopouter}

cleardoublepage
phantomsection
pdfbookmark{Sommario}{Sommario}
begingroup
letclearpagerelax
letcleardoublepagerelax
letcleardoublepagerelax

addchap{Sommario}

Qui Abstract in italiano

lipsum
lipsum
lipsum
lipsum
lipsum
vfill

selectlanguage{english}
pdfbookmark{Abstract}{Abstract}

addchap{Abstract}
lipsum
lipsum
lipsum
Qui abstract in inglese

selectlanguage{italian}

endgroup           

vfill

chapter{Lorem}
label{cap:lorem}
lipsum
lipsum
lipsum
lipsum
end{document}

Thank you

3 Answers

In order to get the alignment as well as the correct font, one way is to write nothing to the toc and use addcontentsline with an empty chapter number as first argument of numberline{}{...} The command spacedlowsmallcaps from the arsclassica package is used to write the 'chapter' title within the TOC line.

I have added a wrapper, which automatically does this for your setup, assuming, that the chapter title is also intended as entry to the toc.

Please not the difference between addchap and addchapextended, I just did addchap{Sommario} effectively twice.

Extended version

documentclass[10pt,%                    
               a4paper,%                  
               twoside,openright,%        
%              oneside,openany,%         
               titlepage,%               
               headinclude,,footinclude,%  
               BCOR5mm,%                  
               cleardoublepage=empty,%    
               captions=tableheading,%       
               ]{scrreprt}    
usepackage[T1]{fontenc}

usepackage{lipsum}
usepackage[utf8]{inputenc}
usepackage[english,italian]{babel}       

usepackage[eulerchapternumbers,%        
            beramono,%                   
            eulermath,%                    
            pdfspacing,%                 
            listings,%                  
%           parts,%                       
            ]{classicthesis}   
usepackage{arsclassica}    


%newcommand{addchapextended}[1]{%  Old version without alignment
%addchap[noexpandspacedlowsmallcaps{#1}]{#1}%
%}%




makeatletter
newcommand{addchapextended}[1]{%
phantomsection%


makeatletter
newcommand{addchapextended}[1]{%
phantomsection%
addchap[]{#1}%  Do the unnumbered chapter head in the content section 
markboth{spacedlowsmallcaps{#1}}{spacedlowsmallcaps{#1}} 
pdfbookmark[0]{#1}{thepage::thechapter}%
%Add a contentsline to the TOC, omit the chapter number and align correctly
begingroup%
renewcommand{Hy@writebookmark}[5]{}{}{}{}{}%   Drop the automatic writing of bookmarks by addcontentsline%
addcontentsline{toc}{chapter}{%
numberline{}{noexpandspacedlowsmallcaps{#1}}}%
endgroup%
}%
makeatother%



begin{document}
hypersetup{pageanchor=false}
pagestyle{scrheadings} 
pagenumbering{gobble}


cleardoublepage
pdfbookmark{contentsname}{tableofcontents}
setcounter{tocdepth}{2}
tableofcontents
markboth{spacedlowsmallcaps{contentsname}}{spacedlowsmallcaps{contentsname}} 
cleardoublepage

hypersetup{pageanchor=true}
pagenumbering{arabic}

deftripstyle{pgnumtopouter}{}{}{pagemark}{}{}{}
renewcommand{chapterpagestyle}{pgnumtopouter}

cleardoublepage
phantomsection
%pdfbookmark{Sommario}{Sommario}
begingroup
letclearpagerelax
letcleardoublepagerelax
letcleardoublepagerelax

%phantomsection
%chapter*{Sommario}%
%addcontentsline{toc}{chapter}{protect{scshape Sommario}}

addchapextended{Sommario}%
addchap{Sommario}


%addchap[noexpandMakeTextLowercase{sffamilytextsc{Sommario}}]{Sommario}%

%addchap[sffamilytextsc{Lorem}]{Sommario}%

Qui Abstract in italiano

lipsum
lipsum
lipsum
lipsum
lipsum
vfill

selectlanguage{english}
pdfbookmark{Abstract}{Abstract}

addchapextended{Abstract}
addchapextended{Lorem}

lipsum
lipsum
lipsum
Qui abstract in inglese

selectlanguage{italian}

endgroup           

vfill

chapter{Lorem}
label{cap:lorem}
lipsum
lipsum
lipsum
lipsum

chapter{Lorem Nr. 2}

end{document}

enter image description here

enter image description here

Correct answer by user31729 on September 29, 2021

Here is a solution that uses the titletoc package:

documentclass[10pt,%
               a4paper,%
               twoside,openright,%
% oneside,openany,%
               titlepage,%
               headinclude,,footinclude,%
               BCOR5mm,%
               cleardoublepage=empty,%
               captions=tableheading,%
               ]{scrreprt}
usepackage[T1]{fontenc}

usepackage{lipsum}
usepackage[utf8]{inputenc}
usepackage[english,italian]{babel}

usepackage[eulerchapternumbers,%
 beramono,%
 eulermath,%
 pdfspacing,%
 %listings,%
% parts,%
 ]{classicthesis}
usepackage{arsclassica}
usepackage{hyperref}

usepackage{titletoc}
 titlecontents{chapter}[1.44em]{smallskip}%vspace{1cm}
 {{contentslabel[thecontentslabel.]{1.25em}}}%numbered
 {spacedlowsmallcaps}%numberless
 {quadcontentspage}[medskip]%


begin{document}
hypersetup{pageanchor=false}
pagestyle{scrheadings}
pagenumbering{gobble}


cleardoublepage
pdfbookmark{contentsname}{tableofcontents}
setcounter{tocdepth}{2}
tableofcontents
markboth{spacedlowsmallcaps{contentsname}}{spacedlowsmallcaps{contentsname}}
cleardoublepage

hypersetup{pageanchor=true}
pagenumbering{arabic}

deftripstyle{pgnumtopouter}{}{}{pagemark}{}{}{}
renewcommand{chapterpagestyle}{pgnumtopouter}

cleardoublepage
phantomsection
pdfbookmark{Sommario}{Sommario}
begingroup
letclearpagerelax
letcleardoublepagerelax
letcleardoublepagerelax

addchap{Sommario}

Qui Abstract in italiano

lipsum
lipsum
lipsum
lipsum
lipsum
vfill

selectlanguage{english}
pdfbookmark{Abstract}{Abstract}

addchap{Abstract}
lipsum
lipsum
lipsum
Qui abstract in inglese

selectlanguage{italian}

endgroup

vfill

chapter{Lorem}
label{cap:lorem}
lipsum
lipsum
lipsum
lipsum
end{document} 

enter image description here

Answered by Bernard on September 29, 2021

I have been using classicthesis and had the same problem. The answers here wouldn't help me, but guided me to a solution.

For new chapters, I am now using addchap{tocEntry{>CHAPTERNAME<}}, which appears both in the pdf as well as in small caps in the LoC.

For the contents, where you would receive a toc-entry automatically but not in the classicthesis style, I used this (here for the LoC):

phantomsection
addcontentsline{toc}{chapter}{{tocEntry{contentsname}}}%
tableofcontents

For glossaries, I needed another workaround, which is:

renewcommand{glossarysection}[2][]{}
addchap{tocEntry{Symbols}}
printglossary[type=symbols]

newpage

addchap{tocEntry{Acronyms}}
printglossary[type=acronymtype]

I hope this helps tackling the next readers issues as well. Cheers!

Answered by 00_Gabri on September 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP