TransWikia.com

Negative contentsmargin changes page number alignment in toc

TeX - LaTeX Asked by suitangi on July 4, 2021

I am using titletoc to modify a table of contents. The problem is that the command contentsmargin{-1.5em} seems to change the alignment of the page numbers (from right to left).

documentclass{article}

usepackage{lipsum}
usepackage{titlesec}
usepackage{titletoc}

contentsmargin{-0.5em}

titlecontents{section}[0em]
{addvspace{2pt}}
{}
{}
{
titlerule*[1pc]{}
contentspage
}

titlecontents{subsection}[1em]
{addvspace{0pt}}
{}
{}   % textit · •
{titlerule*[1pc]{}
contentspage
}

begin{document}
tableofcontents

section{First section}
lipsum[1-50]
section{Second section}
end{document}

Why is this happening and how can I avoid it?

Thanks in advance!

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