Aligned TOC with titletoc












0














I'm trying to get my toc build with the titletoc package as I'm using it to do other content tables with it. I get it to work almost like i want it to, but i have some issues:
enter image description here



First of all i have do calculate the intentation manually as shown below.



settowidth{tocindent}{2.12.2}% calculation of the indentation


I tried different approaches of trying to calculate the maximum width by redefining the subsubsection command but that didn't work for me. I would love to have LaTeX calculate this value for me instead of typing it in.



The second problem I have are my unnumbered sections, they are supposed to align with the numbers. I got it to work with the paragraph definition, but that just makes so much headaches concerning the hyperref package:




  • Difference (3) between bookmark levels is greater (hyperref) than one, level fixed

  • The anchor of a bookmark and its parent's must not(hyperref) be the same. Added a new anchor


Following the MWE:



documentclass[10pt,]{scrartcl}
usepackage[hidelinks]{hyperref}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
newlength{tocindent}

%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
settowidth{tocindent}{2.12.2}% calculation of the indentation
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

titlecontents{section}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{paragraph}[0pt]{}
{contentslabel[{thecontentslabel}]{0pt}}
{}
{titlerule*[8pt]{.}contentspage}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
addcontentsline{toc}{paragraph}{List of Figures (paragraph)}
end{document}


Hope you guys can help me out!





EDIT



with the help of @Bernard i've come so far thet the width is now calculated by using the eqmakebox in the labeldefinition:



documentclass[10pt,]{scrartcl}
usepackage{eqparbox}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
usepackage[hidelinks]{hyperref}

newlength{tocindent}
setlength{tocindent}{0.8em}% calculation of the indentation

titlecontents{section}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{hspace*{-dimexpr eqboxwidth{TOC}+tocindent}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

renewcommandthesection{eqmakebox[TOC][l]{arabic{section}}}
renewcommandthesubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}}}
renewcommandthesubsubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}.arabic{subsubsection}}}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
section*{Section B*}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
end{document}


It works but also the sectiontitles and subsectiontitles get pushed away in the normal text.



enter image description here



left according to the above code with the eqmakebox, right without the eqmakebox how i would like it to look like.



I also tried setting the width by using eqsetminwidthto{TOC}{arabic{section}} in the labeldefinition but that just results in errors.
Ideas would be greatly appreciated










share|improve this question
























  • I suppose that you actually don't want to have paragraphs in your table of of contents?
    – Bernard
    Dec 13 '18 at 19:40










  • that's right, it is just a workaround I implemented to get the numberless entries without the indent.
    – celi
    Dec 13 '18 at 20:17
















0














I'm trying to get my toc build with the titletoc package as I'm using it to do other content tables with it. I get it to work almost like i want it to, but i have some issues:
enter image description here



First of all i have do calculate the intentation manually as shown below.



settowidth{tocindent}{2.12.2}% calculation of the indentation


I tried different approaches of trying to calculate the maximum width by redefining the subsubsection command but that didn't work for me. I would love to have LaTeX calculate this value for me instead of typing it in.



The second problem I have are my unnumbered sections, they are supposed to align with the numbers. I got it to work with the paragraph definition, but that just makes so much headaches concerning the hyperref package:




  • Difference (3) between bookmark levels is greater (hyperref) than one, level fixed

  • The anchor of a bookmark and its parent's must not(hyperref) be the same. Added a new anchor


Following the MWE:



documentclass[10pt,]{scrartcl}
usepackage[hidelinks]{hyperref}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
newlength{tocindent}

%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
settowidth{tocindent}{2.12.2}% calculation of the indentation
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

titlecontents{section}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{paragraph}[0pt]{}
{contentslabel[{thecontentslabel}]{0pt}}
{}
{titlerule*[8pt]{.}contentspage}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
addcontentsline{toc}{paragraph}{List of Figures (paragraph)}
end{document}


Hope you guys can help me out!





EDIT



with the help of @Bernard i've come so far thet the width is now calculated by using the eqmakebox in the labeldefinition:



documentclass[10pt,]{scrartcl}
usepackage{eqparbox}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
usepackage[hidelinks]{hyperref}

newlength{tocindent}
setlength{tocindent}{0.8em}% calculation of the indentation

titlecontents{section}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{hspace*{-dimexpr eqboxwidth{TOC}+tocindent}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

renewcommandthesection{eqmakebox[TOC][l]{arabic{section}}}
renewcommandthesubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}}}
renewcommandthesubsubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}.arabic{subsubsection}}}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
section*{Section B*}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
end{document}


It works but also the sectiontitles and subsectiontitles get pushed away in the normal text.



enter image description here



left according to the above code with the eqmakebox, right without the eqmakebox how i would like it to look like.



I also tried setting the width by using eqsetminwidthto{TOC}{arabic{section}} in the labeldefinition but that just results in errors.
Ideas would be greatly appreciated










share|improve this question
























  • I suppose that you actually don't want to have paragraphs in your table of of contents?
    – Bernard
    Dec 13 '18 at 19:40










  • that's right, it is just a workaround I implemented to get the numberless entries without the indent.
    – celi
    Dec 13 '18 at 20:17














0












0








0







I'm trying to get my toc build with the titletoc package as I'm using it to do other content tables with it. I get it to work almost like i want it to, but i have some issues:
enter image description here



First of all i have do calculate the intentation manually as shown below.



settowidth{tocindent}{2.12.2}% calculation of the indentation


I tried different approaches of trying to calculate the maximum width by redefining the subsubsection command but that didn't work for me. I would love to have LaTeX calculate this value for me instead of typing it in.



The second problem I have are my unnumbered sections, they are supposed to align with the numbers. I got it to work with the paragraph definition, but that just makes so much headaches concerning the hyperref package:




  • Difference (3) between bookmark levels is greater (hyperref) than one, level fixed

  • The anchor of a bookmark and its parent's must not(hyperref) be the same. Added a new anchor


Following the MWE:



documentclass[10pt,]{scrartcl}
usepackage[hidelinks]{hyperref}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
newlength{tocindent}

%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
settowidth{tocindent}{2.12.2}% calculation of the indentation
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

titlecontents{section}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{paragraph}[0pt]{}
{contentslabel[{thecontentslabel}]{0pt}}
{}
{titlerule*[8pt]{.}contentspage}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
addcontentsline{toc}{paragraph}{List of Figures (paragraph)}
end{document}


Hope you guys can help me out!





EDIT



with the help of @Bernard i've come so far thet the width is now calculated by using the eqmakebox in the labeldefinition:



documentclass[10pt,]{scrartcl}
usepackage{eqparbox}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
usepackage[hidelinks]{hyperref}

newlength{tocindent}
setlength{tocindent}{0.8em}% calculation of the indentation

titlecontents{section}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{hspace*{-dimexpr eqboxwidth{TOC}+tocindent}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

renewcommandthesection{eqmakebox[TOC][l]{arabic{section}}}
renewcommandthesubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}}}
renewcommandthesubsubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}.arabic{subsubsection}}}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
section*{Section B*}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
end{document}


It works but also the sectiontitles and subsectiontitles get pushed away in the normal text.



enter image description here



left according to the above code with the eqmakebox, right without the eqmakebox how i would like it to look like.



I also tried setting the width by using eqsetminwidthto{TOC}{arabic{section}} in the labeldefinition but that just results in errors.
Ideas would be greatly appreciated










share|improve this question















I'm trying to get my toc build with the titletoc package as I'm using it to do other content tables with it. I get it to work almost like i want it to, but i have some issues:
enter image description here



First of all i have do calculate the intentation manually as shown below.



settowidth{tocindent}{2.12.2}% calculation of the indentation


I tried different approaches of trying to calculate the maximum width by redefining the subsubsection command but that didn't work for me. I would love to have LaTeX calculate this value for me instead of typing it in.



The second problem I have are my unnumbered sections, they are supposed to align with the numbers. I got it to work with the paragraph definition, but that just makes so much headaches concerning the hyperref package:




  • Difference (3) between bookmark levels is greater (hyperref) than one, level fixed

  • The anchor of a bookmark and its parent's must not(hyperref) be the same. Added a new anchor


Following the MWE:



documentclass[10pt,]{scrartcl}
usepackage[hidelinks]{hyperref}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
newlength{tocindent}

%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
settowidth{tocindent}{2.12.2}% calculation of the indentation
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

titlecontents{section}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{paragraph}[0pt]{}
{contentslabel[{thecontentslabel}]{0pt}}
{}
{titlerule*[8pt]{.}contentspage}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
addcontentsline{toc}{paragraph}{List of Figures (paragraph)}
end{document}


Hope you guys can help me out!





EDIT



with the help of @Bernard i've come so far thet the width is now calculated by using the eqmakebox in the labeldefinition:



documentclass[10pt,]{scrartcl}
usepackage{eqparbox}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
usepackage[hidelinks]{hyperref}

newlength{tocindent}
setlength{tocindent}{0.8em}% calculation of the indentation

titlecontents{section}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{hspace*{-dimexpr eqboxwidth{TOC}+tocindent}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr eqboxwidth{TOC}+tocindent]{}
{contentslabel[{thecontentslabel}]{dimexpr eqboxwidth{TOC}+tocindent}}
{}
{titlerule*[8pt]{.}contentspage}

renewcommandthesection{eqmakebox[TOC][l]{arabic{section}}}
renewcommandthesubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}}}
renewcommandthesubsubsection{eqmakebox[TOC][l]{arabic{section}.arabic{subsection}.arabic{subsubsection}}}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
section*{Section B*}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
end{document}


It works but also the sectiontitles and subsectiontitles get pushed away in the normal text.



enter image description here



left according to the above code with the eqmakebox, right without the eqmakebox how i would like it to look like.



I also tried setting the width by using eqsetminwidthto{TOC}{arabic{section}} in the labeldefinition but that just results in errors.
Ideas would be greatly appreciated







hyperref calculations titletoc alignment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 14 '18 at 9:35

























asked Dec 13 '18 at 17:23









celi

357




357












  • I suppose that you actually don't want to have paragraphs in your table of of contents?
    – Bernard
    Dec 13 '18 at 19:40










  • that's right, it is just a workaround I implemented to get the numberless entries without the indent.
    – celi
    Dec 13 '18 at 20:17


















  • I suppose that you actually don't want to have paragraphs in your table of of contents?
    – Bernard
    Dec 13 '18 at 19:40










  • that's right, it is just a workaround I implemented to get the numberless entries without the indent.
    – celi
    Dec 13 '18 at 20:17
















I suppose that you actually don't want to have paragraphs in your table of of contents?
– Bernard
Dec 13 '18 at 19:40




I suppose that you actually don't want to have paragraphs in your table of of contents?
– Bernard
Dec 13 '18 at 19:40












that's right, it is just a workaround I implemented to get the numberless entries without the indent.
– celi
Dec 13 '18 at 20:17




that's right, it is just a workaround I implemented to get the numberless entries without the indent.
– celi
Dec 13 '18 at 20:17










2 Answers
2






active

oldest

votes


















1














Use the argument of titlecontents devoted to unnumbered section (which you've left blank).



Unrelated: you should load hyperref as the last package, with very few exceptions (most notably, cleveref should be loaded aafter hyperref).



documentclass[10pt,]{scrartcl}
usepackage{titletoc}
usepackage{showframe}
usepackage{calc}
usepackage[hidelinks]{hyperref}
newlength{tocindent}

%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
settowidth{tocindent}{2.12.2}% calculation of the indentation
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

titlecontents{section}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{hspace*{-dimexpr tocindent+0.5em}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
{contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
{}
{titlerule*[8pt]{.}contentspage}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
subsection{Subsection B 1}
subsection{Subsection B 2}
subsection{Subsection B 3}
subsection{Subsection B 4}
subsection{Subsection B 5}
subsection{Subsection B 6}
subsection{Subsection B 7}
subsection{Subsection B 8}
subsection{Subsection B 9}
subsection{Subsection B 10}
subsection{Subsection B 11}
subsection{Subsection B 12}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}

end{document}


enter image description here






share|improve this answer























  • Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
    – celi
    Dec 13 '18 at 20:43










  • Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
    – Bernard
    Dec 13 '18 at 20:56



















1














So i managed to fix my problem myself. (yay good for me)



I actually defined the eqmakebox for each sectiongroup and added them to a total indentation for the TOC. Therefore each Label only has a box around the corresponding number:





  • 1 Section 1

  • 1.1 Section 1.1

  • 1.23.13 Section 1.23.13


And it does not affect the sections in the Text.



documentclass[10pt,]{scrartcl}
usepackage{eqparbox}
usepackage{titletoc, titlesec}
usepackage{showframe}
usepackage{calc}
usepackage[hidelinks]{hyperref}

newlength{tocindent}
setlength{tocindent}{0.2em}% additional indentation

titlecontents{section}[%
dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent]{}
{contentslabel[{thecontentslabel}]{%
dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent}}
{hspace*{%
-dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsection}[%
dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent]{}
{contentslabel[{thecontentslabel}]{%
dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent}}
{hspace*{%
-dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent}}
{titlerule*[8pt]{.}contentspage}

titlecontents{subsubsection}[%
dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent]{}
{contentslabel[{thecontentslabel}]{%
dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent}}
{hspace*{%
-dimexpr
eqboxwidth{TOCS}+
eqboxwidth{TOCSS}+
eqboxwidth{TOCSSS}+tocindent}}
{titlerule*[8pt]{.}contentspage}

renewcommandthesection{eqmakebox[TOCS][l]{arabic{section}}}
renewcommandthesubsection{arabic{section}.eqmakebox[TOCSS][l]{arabic{subsection}}}
renewcommandthesubsubsection{arabic{section}.arabic{subsection}.eqmakebox[TOCSSS][l]{arabic{subsubsection}}}

begin{document}
startcontents[sections]
{Large Inhaltsverzeichnis}\
printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

section{Section A}
section{Section B}
subsection{Subsection B 1}
setcounter{subsection}{12}
subsection{Subsection B 1}
subsubsection{Subsubsection B 13.1}
subsubsection{Subsubsection B 13.2}
subsection{Subsection B 14}
subsection{Subsection B 15}
section{Section C}
subsection{Subsection C 1}
subsection{Subsection C 2}
subsubsection{Subsubsection C 2.1}
setcounter{subsubsection}{12}
subsubsection{Subsubsection C 2.2}
subsection{Subsection C 3}
addcontentsline{toc}{section}{List of Figures (section)}
end{document}


enter image description here






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464736%2faligned-toc-with-titletoc%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Use the argument of titlecontents devoted to unnumbered section (which you've left blank).



    Unrelated: you should load hyperref as the last package, with very few exceptions (most notably, cleveref should be loaded aafter hyperref).



    documentclass[10pt,]{scrartcl}
    usepackage{titletoc}
    usepackage{showframe}
    usepackage{calc}
    usepackage[hidelinks]{hyperref}
    newlength{tocindent}

    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    settowidth{tocindent}{2.12.2}% calculation of the indentation
    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    titlecontents{section}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {hspace*{-dimexpr tocindent+0.5em}}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    begin{document}
    startcontents[sections]
    {Large Inhaltsverzeichnis}\
    printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

    section{Section A}
    section{Section B}
    subsection{Subsection B 1}
    subsection{Subsection B 2}
    subsection{Subsection B 3}
    subsection{Subsection B 4}
    subsection{Subsection B 5}
    subsection{Subsection B 6}
    subsection{Subsection B 7}
    subsection{Subsection B 8}
    subsection{Subsection B 9}
    subsection{Subsection B 10}
    subsection{Subsection B 11}
    subsection{Subsection B 12}
    subsubsection{Subsubsection B 13.1}
    subsubsection{Subsubsection B 13.2}
    subsection{Subsection B 14}
    subsection{Subsection B 15}
    section{Section C}
    subsection{Subsection C 1}
    subsection{Subsection C 2}
    subsubsection{Subsubsection C 2.1}
    subsubsection{Subsubsection C 2.2}
    subsection{Subsection C 3}
    addcontentsline{toc}{section}{List of Figures (section)}

    end{document}


    enter image description here






    share|improve this answer























    • Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
      – celi
      Dec 13 '18 at 20:43










    • Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
      – Bernard
      Dec 13 '18 at 20:56
















    1














    Use the argument of titlecontents devoted to unnumbered section (which you've left blank).



    Unrelated: you should load hyperref as the last package, with very few exceptions (most notably, cleveref should be loaded aafter hyperref).



    documentclass[10pt,]{scrartcl}
    usepackage{titletoc}
    usepackage{showframe}
    usepackage{calc}
    usepackage[hidelinks]{hyperref}
    newlength{tocindent}

    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    settowidth{tocindent}{2.12.2}% calculation of the indentation
    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    titlecontents{section}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {hspace*{-dimexpr tocindent+0.5em}}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    begin{document}
    startcontents[sections]
    {Large Inhaltsverzeichnis}\
    printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

    section{Section A}
    section{Section B}
    subsection{Subsection B 1}
    subsection{Subsection B 2}
    subsection{Subsection B 3}
    subsection{Subsection B 4}
    subsection{Subsection B 5}
    subsection{Subsection B 6}
    subsection{Subsection B 7}
    subsection{Subsection B 8}
    subsection{Subsection B 9}
    subsection{Subsection B 10}
    subsection{Subsection B 11}
    subsection{Subsection B 12}
    subsubsection{Subsubsection B 13.1}
    subsubsection{Subsubsection B 13.2}
    subsection{Subsection B 14}
    subsection{Subsection B 15}
    section{Section C}
    subsection{Subsection C 1}
    subsection{Subsection C 2}
    subsubsection{Subsubsection C 2.1}
    subsubsection{Subsubsection C 2.2}
    subsection{Subsection C 3}
    addcontentsline{toc}{section}{List of Figures (section)}

    end{document}


    enter image description here






    share|improve this answer























    • Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
      – celi
      Dec 13 '18 at 20:43










    • Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
      – Bernard
      Dec 13 '18 at 20:56














    1












    1








    1






    Use the argument of titlecontents devoted to unnumbered section (which you've left blank).



    Unrelated: you should load hyperref as the last package, with very few exceptions (most notably, cleveref should be loaded aafter hyperref).



    documentclass[10pt,]{scrartcl}
    usepackage{titletoc}
    usepackage{showframe}
    usepackage{calc}
    usepackage[hidelinks]{hyperref}
    newlength{tocindent}

    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    settowidth{tocindent}{2.12.2}% calculation of the indentation
    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    titlecontents{section}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {hspace*{-dimexpr tocindent+0.5em}}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    begin{document}
    startcontents[sections]
    {Large Inhaltsverzeichnis}\
    printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

    section{Section A}
    section{Section B}
    subsection{Subsection B 1}
    subsection{Subsection B 2}
    subsection{Subsection B 3}
    subsection{Subsection B 4}
    subsection{Subsection B 5}
    subsection{Subsection B 6}
    subsection{Subsection B 7}
    subsection{Subsection B 8}
    subsection{Subsection B 9}
    subsection{Subsection B 10}
    subsection{Subsection B 11}
    subsection{Subsection B 12}
    subsubsection{Subsubsection B 13.1}
    subsubsection{Subsubsection B 13.2}
    subsection{Subsection B 14}
    subsection{Subsection B 15}
    section{Section C}
    subsection{Subsection C 1}
    subsection{Subsection C 2}
    subsubsection{Subsubsection C 2.1}
    subsubsection{Subsubsection C 2.2}
    subsection{Subsection C 3}
    addcontentsline{toc}{section}{List of Figures (section)}

    end{document}


    enter image description here






    share|improve this answer














    Use the argument of titlecontents devoted to unnumbered section (which you've left blank).



    Unrelated: you should load hyperref as the last package, with very few exceptions (most notably, cleveref should be loaded aafter hyperref).



    documentclass[10pt,]{scrartcl}
    usepackage{titletoc}
    usepackage{showframe}
    usepackage{calc}
    usepackage[hidelinks]{hyperref}
    newlength{tocindent}

    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    settowidth{tocindent}{2.12.2}% calculation of the indentation
    %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    titlecontents{section}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {hspace*{-dimexpr tocindent+0.5em}}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsubsection}[dimexpr tocindent+0.5em]{}
    {contentslabel[{thecontentslabel}]{dimexpr tocindent+0.5em}}
    {}
    {titlerule*[8pt]{.}contentspage}

    begin{document}
    startcontents[sections]
    {Large Inhaltsverzeichnis}\
    printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

    section{Section A}
    section{Section B}
    subsection{Subsection B 1}
    subsection{Subsection B 2}
    subsection{Subsection B 3}
    subsection{Subsection B 4}
    subsection{Subsection B 5}
    subsection{Subsection B 6}
    subsection{Subsection B 7}
    subsection{Subsection B 8}
    subsection{Subsection B 9}
    subsection{Subsection B 10}
    subsection{Subsection B 11}
    subsection{Subsection B 12}
    subsubsection{Subsubsection B 13.1}
    subsubsection{Subsubsection B 13.2}
    subsection{Subsection B 14}
    subsection{Subsection B 15}
    section{Section C}
    subsection{Subsection C 1}
    subsection{Subsection C 2}
    subsubsection{Subsubsection C 2.1}
    subsubsection{Subsubsection C 2.2}
    subsection{Subsection C 3}
    addcontentsline{toc}{section}{List of Figures (section)}

    end{document}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 13 '18 at 20:46

























    answered Dec 13 '18 at 20:25









    Bernard

    166k769194




    166k769194












    • Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
      – celi
      Dec 13 '18 at 20:43










    • Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
      – Bernard
      Dec 13 '18 at 20:56


















    • Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
      – celi
      Dec 13 '18 at 20:43










    • Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
      – Bernard
      Dec 13 '18 at 20:56
















    Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
    – celi
    Dec 13 '18 at 20:43




    Thank you, that solves one Problem :) Any idea if the automated calculation of the witdh tocindent might be possible?
    – celi
    Dec 13 '18 at 20:43












    Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
    – Bernard
    Dec 13 '18 at 20:56




    Maybe inserting the subsubsection labels in an eqmakebox command, and using theeqboxwidth command? Take a look at the eqparbox package documentation.
    – Bernard
    Dec 13 '18 at 20:56











    1














    So i managed to fix my problem myself. (yay good for me)



    I actually defined the eqmakebox for each sectiongroup and added them to a total indentation for the TOC. Therefore each Label only has a box around the corresponding number:





    • 1 Section 1

    • 1.1 Section 1.1

    • 1.23.13 Section 1.23.13


    And it does not affect the sections in the Text.



    documentclass[10pt,]{scrartcl}
    usepackage{eqparbox}
    usepackage{titletoc, titlesec}
    usepackage{showframe}
    usepackage{calc}
    usepackage[hidelinks]{hyperref}

    newlength{tocindent}
    setlength{tocindent}{0.2em}% additional indentation

    titlecontents{section}[%
    dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent]{}
    {contentslabel[{thecontentslabel}]{%
    dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent}}
    {hspace*{%
    -dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent}}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsection}[%
    dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent]{}
    {contentslabel[{thecontentslabel}]{%
    dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent}}
    {hspace*{%
    -dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent}}
    {titlerule*[8pt]{.}contentspage}

    titlecontents{subsubsection}[%
    dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent]{}
    {contentslabel[{thecontentslabel}]{%
    dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent}}
    {hspace*{%
    -dimexpr
    eqboxwidth{TOCS}+
    eqboxwidth{TOCSS}+
    eqboxwidth{TOCSSS}+tocindent}}
    {titlerule*[8pt]{.}contentspage}

    renewcommandthesection{eqmakebox[TOCS][l]{arabic{section}}}
    renewcommandthesubsection{arabic{section}.eqmakebox[TOCSS][l]{arabic{subsection}}}
    renewcommandthesubsubsection{arabic{section}.arabic{subsection}.eqmakebox[TOCSSS][l]{arabic{subsubsection}}}

    begin{document}
    startcontents[sections]
    {Large Inhaltsverzeichnis}\
    printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

    section{Section A}
    section{Section B}
    subsection{Subsection B 1}
    setcounter{subsection}{12}
    subsection{Subsection B 1}
    subsubsection{Subsubsection B 13.1}
    subsubsection{Subsubsection B 13.2}
    subsection{Subsection B 14}
    subsection{Subsection B 15}
    section{Section C}
    subsection{Subsection C 1}
    subsection{Subsection C 2}
    subsubsection{Subsubsection C 2.1}
    setcounter{subsubsection}{12}
    subsubsection{Subsubsection C 2.2}
    subsection{Subsection C 3}
    addcontentsline{toc}{section}{List of Figures (section)}
    end{document}


    enter image description here






    share|improve this answer


























      1














      So i managed to fix my problem myself. (yay good for me)



      I actually defined the eqmakebox for each sectiongroup and added them to a total indentation for the TOC. Therefore each Label only has a box around the corresponding number:





      • 1 Section 1

      • 1.1 Section 1.1

      • 1.23.13 Section 1.23.13


      And it does not affect the sections in the Text.



      documentclass[10pt,]{scrartcl}
      usepackage{eqparbox}
      usepackage{titletoc, titlesec}
      usepackage{showframe}
      usepackage{calc}
      usepackage[hidelinks]{hyperref}

      newlength{tocindent}
      setlength{tocindent}{0.2em}% additional indentation

      titlecontents{section}[%
      dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent]{}
      {contentslabel[{thecontentslabel}]{%
      dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent}}
      {hspace*{%
      -dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent}}
      {titlerule*[8pt]{.}contentspage}

      titlecontents{subsection}[%
      dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent]{}
      {contentslabel[{thecontentslabel}]{%
      dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent}}
      {hspace*{%
      -dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent}}
      {titlerule*[8pt]{.}contentspage}

      titlecontents{subsubsection}[%
      dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent]{}
      {contentslabel[{thecontentslabel}]{%
      dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent}}
      {hspace*{%
      -dimexpr
      eqboxwidth{TOCS}+
      eqboxwidth{TOCSS}+
      eqboxwidth{TOCSSS}+tocindent}}
      {titlerule*[8pt]{.}contentspage}

      renewcommandthesection{eqmakebox[TOCS][l]{arabic{section}}}
      renewcommandthesubsection{arabic{section}.eqmakebox[TOCSS][l]{arabic{subsection}}}
      renewcommandthesubsubsection{arabic{section}.arabic{subsection}.eqmakebox[TOCSSS][l]{arabic{subsubsection}}}

      begin{document}
      startcontents[sections]
      {Large Inhaltsverzeichnis}\
      printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

      section{Section A}
      section{Section B}
      subsection{Subsection B 1}
      setcounter{subsection}{12}
      subsection{Subsection B 1}
      subsubsection{Subsubsection B 13.1}
      subsubsection{Subsubsection B 13.2}
      subsection{Subsection B 14}
      subsection{Subsection B 15}
      section{Section C}
      subsection{Subsection C 1}
      subsection{Subsection C 2}
      subsubsection{Subsubsection C 2.1}
      setcounter{subsubsection}{12}
      subsubsection{Subsubsection C 2.2}
      subsection{Subsection C 3}
      addcontentsline{toc}{section}{List of Figures (section)}
      end{document}


      enter image description here






      share|improve this answer
























        1












        1








        1






        So i managed to fix my problem myself. (yay good for me)



        I actually defined the eqmakebox for each sectiongroup and added them to a total indentation for the TOC. Therefore each Label only has a box around the corresponding number:





        • 1 Section 1

        • 1.1 Section 1.1

        • 1.23.13 Section 1.23.13


        And it does not affect the sections in the Text.



        documentclass[10pt,]{scrartcl}
        usepackage{eqparbox}
        usepackage{titletoc, titlesec}
        usepackage{showframe}
        usepackage{calc}
        usepackage[hidelinks]{hyperref}

        newlength{tocindent}
        setlength{tocindent}{0.2em}% additional indentation

        titlecontents{section}[%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent]{}
        {contentslabel[{thecontentslabel}]{%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {hspace*{%
        -dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {titlerule*[8pt]{.}contentspage}

        titlecontents{subsection}[%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent]{}
        {contentslabel[{thecontentslabel}]{%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {hspace*{%
        -dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {titlerule*[8pt]{.}contentspage}

        titlecontents{subsubsection}[%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent]{}
        {contentslabel[{thecontentslabel}]{%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {hspace*{%
        -dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {titlerule*[8pt]{.}contentspage}

        renewcommandthesection{eqmakebox[TOCS][l]{arabic{section}}}
        renewcommandthesubsection{arabic{section}.eqmakebox[TOCSS][l]{arabic{subsection}}}
        renewcommandthesubsubsection{arabic{section}.arabic{subsection}.eqmakebox[TOCSSS][l]{arabic{subsubsection}}}

        begin{document}
        startcontents[sections]
        {Large Inhaltsverzeichnis}\
        printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

        section{Section A}
        section{Section B}
        subsection{Subsection B 1}
        setcounter{subsection}{12}
        subsection{Subsection B 1}
        subsubsection{Subsubsection B 13.1}
        subsubsection{Subsubsection B 13.2}
        subsection{Subsection B 14}
        subsection{Subsection B 15}
        section{Section C}
        subsection{Subsection C 1}
        subsection{Subsection C 2}
        subsubsection{Subsubsection C 2.1}
        setcounter{subsubsection}{12}
        subsubsection{Subsubsection C 2.2}
        subsection{Subsection C 3}
        addcontentsline{toc}{section}{List of Figures (section)}
        end{document}


        enter image description here






        share|improve this answer












        So i managed to fix my problem myself. (yay good for me)



        I actually defined the eqmakebox for each sectiongroup and added them to a total indentation for the TOC. Therefore each Label only has a box around the corresponding number:





        • 1 Section 1

        • 1.1 Section 1.1

        • 1.23.13 Section 1.23.13


        And it does not affect the sections in the Text.



        documentclass[10pt,]{scrartcl}
        usepackage{eqparbox}
        usepackage{titletoc, titlesec}
        usepackage{showframe}
        usepackage{calc}
        usepackage[hidelinks]{hyperref}

        newlength{tocindent}
        setlength{tocindent}{0.2em}% additional indentation

        titlecontents{section}[%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent]{}
        {contentslabel[{thecontentslabel}]{%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {hspace*{%
        -dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {titlerule*[8pt]{.}contentspage}

        titlecontents{subsection}[%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent]{}
        {contentslabel[{thecontentslabel}]{%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {hspace*{%
        -dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {titlerule*[8pt]{.}contentspage}

        titlecontents{subsubsection}[%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent]{}
        {contentslabel[{thecontentslabel}]{%
        dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {hspace*{%
        -dimexpr
        eqboxwidth{TOCS}+
        eqboxwidth{TOCSS}+
        eqboxwidth{TOCSSS}+tocindent}}
        {titlerule*[8pt]{.}contentspage}

        renewcommandthesection{eqmakebox[TOCS][l]{arabic{section}}}
        renewcommandthesubsection{arabic{section}.eqmakebox[TOCSS][l]{arabic{subsection}}}
        renewcommandthesubsubsection{arabic{section}.arabic{subsection}.eqmakebox[TOCSSS][l]{arabic{subsubsection}}}

        begin{document}
        startcontents[sections]
        {Large Inhaltsverzeichnis}\
        printcontents[sections]{l}{1}{setcounter{tocdepth}{4}}

        section{Section A}
        section{Section B}
        subsection{Subsection B 1}
        setcounter{subsection}{12}
        subsection{Subsection B 1}
        subsubsection{Subsubsection B 13.1}
        subsubsection{Subsubsection B 13.2}
        subsection{Subsection B 14}
        subsection{Subsection B 15}
        section{Section C}
        subsection{Subsection C 1}
        subsection{Subsection C 2}
        subsubsection{Subsubsection C 2.1}
        setcounter{subsubsection}{12}
        subsubsection{Subsubsection C 2.2}
        subsection{Subsection C 3}
        addcontentsline{toc}{section}{List of Figures (section)}
        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 14 '18 at 10:40









        celi

        357




        357






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464736%2faligned-toc-with-titletoc%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?