TeX - LaTeX Asked by Alphonsine2LaTour on April 29, 2021
I would like that each chapter starts with a personalized partial TOC (I did this with titletoc).
When I compile I got the following error :
something’s wrong–perhaps a missing item
I’ve done a MWE :
documentclass[11pt,
a4paper,
twoside]{report}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package import
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage[english]{babel}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[top=2.5cm,
bottom=2.5cm,
inner=2.5cm,
outer=3cm,
twoside]{geometry}
usepackage[usenames,
dvipsnames]{xcolor}
usepackage{titletoc}
usepackage[hidelinks,
colorlinks = true,
linkcolor = PineGreen,
urlcolor = PineGreen,
citecolor = PineGreen,
anchorcolor = PineGreen,
allcolors = PineGreen]{hyperref}
usepackage{subfiles}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Redefine TOC Style
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter text styling
titlecontents{chapter}[1.25cm] % Indentation
{addvspace{12pt}Largebfseries} % Spacing and font options for chapters
{color{BrickRed}contentslabel[thecontentslabel]{1.25cm}color{BrickRed}} % Chapter number
{color{BrickRed}}
{hfillcolor{BrickRed}thecontentspage} % Page number
% Section text styling
titlecontents{section}[1.25cm] % Indentation
{addvspace{3pt}bfseries} % Spacing and font options for sections
{contentslabel[thecontentslabel]{1.25cm}} % Section number
{}
{hfillcolor{black}thecontentspage} % Page number
[]
% Subsection text styling
titlecontents{subsection}[1.25cm] % Indentation
{addvspace{1pt}} % Spacing and font options for subsections
{contentslabel[thecontentslabel]{1.25cm}} % Subsection number
{}
{ titlerule*[.5pc]{.};thecontentspage} % Page number
[]
% Subsubsection text styling
titlecontents{subsubsection}[1.25cm] % Indentation
{addvspace{1pt}small} % Spacing and font options for subsubsections
{contentslabel[thecontentslabel]{1.25cm}} % Subsubsection number
{}
{ titlerule*[.5pc]{.};thecontentspage} % Page number
[]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
{
hypersetup{hidelinks}
tableofcontents
}
%subfile{test}
startcontents[Introduction]
chapter{Introduction}label{chap-introduction}
{
hrulefill
printcontents[Introduction]{}{1}{}
vspace{-3mm}
hrulefill
}
section{Context}label{sec-context}
This chapter introduces the context of the project
stopcontents[Introduction]
end{document}
I’ve already investigate a little and this error appears when there is something to print before the partial TOC (in this case) the first hrulefill
. If there is directly the printcontents
command there is no error.
If I remove the personalized TOC style there is no error.
And I have already used this style (without the partial toc) in others documents and it works just fine …
The error redirects me toward the main.ptc file which contains the following :
babel@toc {english}{}
ttl@starttoc {Introduction@1}
contentsline {chapter}{numberline {1}Introduction}{2}{chapter.1}%
contentsline {section}{numberline {1.1}Context}{2}{section.1.1}%
ttl@stoptoc {Introduction@1}
contentsfinish
Does any of you have an idea, where it can come from ?
Thanks in advance 🙂
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP