How do I center the table of contents title without using tocloft?












0















I would simply like to center the title of the table of contents in my "book" document.



I just added dot leaders to the table of contents, and this appeared to be best accomplished by forgoing the tocloft package and instead using the dottedcontents command of the titlesec companion package, titletoc, like so:



dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}


Introducing tocloft settings in order to center the TOC title causes what appears to be a vertical placement/spacing problem that I'm not sure how to correct (this is described in detail in my comments to Peter's answer below). I would therefore like to avoid using the tocloft package if possible.



One way to approach the centering task would be to add centering to the chapter titleformat command of the titlesec package:



usepackage{titlesec}
titleformat{chapter}[display]{centeringLargebfseries}{}{}{}


However this centers all chapter titles, and I don't want this.



So, my question is: what is the simplest way to center the table of contents title without affecting other chapter titles and without using tocloft?



Here is a near minimal example (with my attempts at using the tocloft package omitted):



documentclass{book}

usepackage{titlesec}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

usepackage{titletoc}
dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}

begin{document}

tableofcontents
vspace{24pt}

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}









share|improve this question




















  • 2





    Why do you use section* for what's supposed to be a chapter?

    – Bernard
    Mar 10 at 11:18











  • Just to allow "chapters" 1 and 2 to appear on the same page as the table of contents while working with the minimal example on my system. These can be changed to chapter* for consistency, and I've done so above to avoid confusion.

    – SapereAude
    Mar 10 at 11:55













  • By default the tocloft package does not change the ToC (or LoF or LoT) layout from that of the standard classes, except that they need not start on new pages. I don't know what you might have done to change these to results you don't like.

    – Peter Wilson
    Mar 10 at 19:16













  • Hi Peter, see my comments under your answer below.

    – SapereAude
    Mar 11 at 1:15
















0















I would simply like to center the title of the table of contents in my "book" document.



I just added dot leaders to the table of contents, and this appeared to be best accomplished by forgoing the tocloft package and instead using the dottedcontents command of the titlesec companion package, titletoc, like so:



dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}


Introducing tocloft settings in order to center the TOC title causes what appears to be a vertical placement/spacing problem that I'm not sure how to correct (this is described in detail in my comments to Peter's answer below). I would therefore like to avoid using the tocloft package if possible.



One way to approach the centering task would be to add centering to the chapter titleformat command of the titlesec package:



usepackage{titlesec}
titleformat{chapter}[display]{centeringLargebfseries}{}{}{}


However this centers all chapter titles, and I don't want this.



So, my question is: what is the simplest way to center the table of contents title without affecting other chapter titles and without using tocloft?



Here is a near minimal example (with my attempts at using the tocloft package omitted):



documentclass{book}

usepackage{titlesec}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

usepackage{titletoc}
dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}

begin{document}

tableofcontents
vspace{24pt}

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}









share|improve this question




















  • 2





    Why do you use section* for what's supposed to be a chapter?

    – Bernard
    Mar 10 at 11:18











  • Just to allow "chapters" 1 and 2 to appear on the same page as the table of contents while working with the minimal example on my system. These can be changed to chapter* for consistency, and I've done so above to avoid confusion.

    – SapereAude
    Mar 10 at 11:55













  • By default the tocloft package does not change the ToC (or LoF or LoT) layout from that of the standard classes, except that they need not start on new pages. I don't know what you might have done to change these to results you don't like.

    – Peter Wilson
    Mar 10 at 19:16













  • Hi Peter, see my comments under your answer below.

    – SapereAude
    Mar 11 at 1:15














0












0








0








I would simply like to center the title of the table of contents in my "book" document.



I just added dot leaders to the table of contents, and this appeared to be best accomplished by forgoing the tocloft package and instead using the dottedcontents command of the titlesec companion package, titletoc, like so:



dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}


Introducing tocloft settings in order to center the TOC title causes what appears to be a vertical placement/spacing problem that I'm not sure how to correct (this is described in detail in my comments to Peter's answer below). I would therefore like to avoid using the tocloft package if possible.



One way to approach the centering task would be to add centering to the chapter titleformat command of the titlesec package:



usepackage{titlesec}
titleformat{chapter}[display]{centeringLargebfseries}{}{}{}


However this centers all chapter titles, and I don't want this.



So, my question is: what is the simplest way to center the table of contents title without affecting other chapter titles and without using tocloft?



Here is a near minimal example (with my attempts at using the tocloft package omitted):



documentclass{book}

usepackage{titlesec}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

usepackage{titletoc}
dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}

begin{document}

tableofcontents
vspace{24pt}

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}









share|improve this question
















I would simply like to center the title of the table of contents in my "book" document.



I just added dot leaders to the table of contents, and this appeared to be best accomplished by forgoing the tocloft package and instead using the dottedcontents command of the titlesec companion package, titletoc, like so:



dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}


Introducing tocloft settings in order to center the TOC title causes what appears to be a vertical placement/spacing problem that I'm not sure how to correct (this is described in detail in my comments to Peter's answer below). I would therefore like to avoid using the tocloft package if possible.



One way to approach the centering task would be to add centering to the chapter titleformat command of the titlesec package:



usepackage{titlesec}
titleformat{chapter}[display]{centeringLargebfseries}{}{}{}


However this centers all chapter titles, and I don't want this.



So, my question is: what is the simplest way to center the table of contents title without affecting other chapter titles and without using tocloft?



Here is a near minimal example (with my attempts at using the tocloft package omitted):



documentclass{book}

usepackage{titlesec}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

usepackage{titletoc}
dottedcontents{chapter}[0em]{vspace{2.1ex}}{0em}{0.5pc}

begin{document}

tableofcontents
vspace{24pt}

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}






table-of-contents horizontal-alignment titles titlesec tocloft






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 11 at 2:26







SapereAude

















asked Mar 10 at 11:10









SapereAudeSapereAude

515




515








  • 2





    Why do you use section* for what's supposed to be a chapter?

    – Bernard
    Mar 10 at 11:18











  • Just to allow "chapters" 1 and 2 to appear on the same page as the table of contents while working with the minimal example on my system. These can be changed to chapter* for consistency, and I've done so above to avoid confusion.

    – SapereAude
    Mar 10 at 11:55













  • By default the tocloft package does not change the ToC (or LoF or LoT) layout from that of the standard classes, except that they need not start on new pages. I don't know what you might have done to change these to results you don't like.

    – Peter Wilson
    Mar 10 at 19:16













  • Hi Peter, see my comments under your answer below.

    – SapereAude
    Mar 11 at 1:15














  • 2





    Why do you use section* for what's supposed to be a chapter?

    – Bernard
    Mar 10 at 11:18











  • Just to allow "chapters" 1 and 2 to appear on the same page as the table of contents while working with the minimal example on my system. These can be changed to chapter* for consistency, and I've done so above to avoid confusion.

    – SapereAude
    Mar 10 at 11:55













  • By default the tocloft package does not change the ToC (or LoF or LoT) layout from that of the standard classes, except that they need not start on new pages. I don't know what you might have done to change these to results you don't like.

    – Peter Wilson
    Mar 10 at 19:16













  • Hi Peter, see my comments under your answer below.

    – SapereAude
    Mar 11 at 1:15








2




2





Why do you use section* for what's supposed to be a chapter?

– Bernard
Mar 10 at 11:18





Why do you use section* for what's supposed to be a chapter?

– Bernard
Mar 10 at 11:18













Just to allow "chapters" 1 and 2 to appear on the same page as the table of contents while working with the minimal example on my system. These can be changed to chapter* for consistency, and I've done so above to avoid confusion.

– SapereAude
Mar 10 at 11:55







Just to allow "chapters" 1 and 2 to appear on the same page as the table of contents while working with the minimal example on my system. These can be changed to chapter* for consistency, and I've done so above to avoid confusion.

– SapereAude
Mar 10 at 11:55















By default the tocloft package does not change the ToC (or LoF or LoT) layout from that of the standard classes, except that they need not start on new pages. I don't know what you might have done to change these to results you don't like.

– Peter Wilson
Mar 10 at 19:16







By default the tocloft package does not change the ToC (or LoF or LoT) layout from that of the standard classes, except that they need not start on new pages. I don't know what you might have done to change these to results you don't like.

– Peter Wilson
Mar 10 at 19:16















Hi Peter, see my comments under your answer below.

– SapereAude
Mar 11 at 1:15





Hi Peter, see my comments under your answer below.

– SapereAude
Mar 11 at 1:15










2 Answers
2






active

oldest

votes


















1














You can declare a titleformat within a group, after begin{document}.



Unrelated: with the companion package titletoc, you have a much simpler way to format the entries in the table of contents, with the dottedcontents command.



documentclass{book}

usepackage{titlesec, titletoc, xcolor}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

dottedcontents{chapter}[3.8em]{vspace{2ex}}{2.3em}{0.8pc}

begin{document}

begingroup
titleformat{chapter}[block]{Largebfseriesfilcenter}{color{red}}{}{}
tableofcontents
vspace{24pt}
endgroup

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}


enter image description here






share|improve this answer
























  • Both suggestions worked perfectly. Thanks.

    – SapereAude
    Mar 10 at 17:36



















0














By default the tocloft package uses the standard class's (book, report, article) settings for the ToC, LoF and LoT. The following (less any typos) is a solution to your problem using tocloft.



documentclass{book}
usepackage{tocloft}

%% center Contents title
renewcommand{cfttoctitlefont}{hfillHugebfseries}
renewcommand{cftaftertoctitle}{hfill}

%% add dot leaders to chapters
renewcommand{cftchapdotsep}{cftdotsep}

begin{document}
tableofcontents
chapter{First chapter}
section{A section}
subsection{A subsection}
end{document}


This makes no changes to the indentation and vertical placement of the entries.






share|improve this answer
























  • Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

    – SapereAude
    Mar 11 at 1:10











  • Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

    – SapereAude
    Mar 11 at 1:12











  • Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

    – SapereAude
    Mar 11 at 2:34











  • @SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

    – Peter Wilson
    Mar 12 at 19:05











  • Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

    – SapereAude
    Mar 13 at 4:36











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%2f478709%2fhow-do-i-center-the-table-of-contents-title-without-using-tocloft%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














You can declare a titleformat within a group, after begin{document}.



Unrelated: with the companion package titletoc, you have a much simpler way to format the entries in the table of contents, with the dottedcontents command.



documentclass{book}

usepackage{titlesec, titletoc, xcolor}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

dottedcontents{chapter}[3.8em]{vspace{2ex}}{2.3em}{0.8pc}

begin{document}

begingroup
titleformat{chapter}[block]{Largebfseriesfilcenter}{color{red}}{}{}
tableofcontents
vspace{24pt}
endgroup

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}


enter image description here






share|improve this answer
























  • Both suggestions worked perfectly. Thanks.

    – SapereAude
    Mar 10 at 17:36
















1














You can declare a titleformat within a group, after begin{document}.



Unrelated: with the companion package titletoc, you have a much simpler way to format the entries in the table of contents, with the dottedcontents command.



documentclass{book}

usepackage{titlesec, titletoc, xcolor}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

dottedcontents{chapter}[3.8em]{vspace{2ex}}{2.3em}{0.8pc}

begin{document}

begingroup
titleformat{chapter}[block]{Largebfseriesfilcenter}{color{red}}{}{}
tableofcontents
vspace{24pt}
endgroup

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}


enter image description here






share|improve this answer
























  • Both suggestions worked perfectly. Thanks.

    – SapereAude
    Mar 10 at 17:36














1












1








1







You can declare a titleformat within a group, after begin{document}.



Unrelated: with the companion package titletoc, you have a much simpler way to format the entries in the table of contents, with the dottedcontents command.



documentclass{book}

usepackage{titlesec, titletoc, xcolor}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

dottedcontents{chapter}[3.8em]{vspace{2ex}}{2.3em}{0.8pc}

begin{document}

begingroup
titleformat{chapter}[block]{Largebfseriesfilcenter}{color{red}}{}{}
tableofcontents
vspace{24pt}
endgroup

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}


enter image description here






share|improve this answer













You can declare a titleformat within a group, after begin{document}.



Unrelated: with the companion package titletoc, you have a much simpler way to format the entries in the table of contents, with the dottedcontents command.



documentclass{book}

usepackage{titlesec, titletoc, xcolor}
titleformat{chapter}[display]{Largebfseries}{}{}{}

usepackage{indentfirst}

dottedcontents{chapter}[3.8em]{vspace{2ex}}{2.3em}{0.8pc}

begin{document}

begingroup
titleformat{chapter}[block]{Largebfseriesfilcenter}{color{red}}{}{}
tableofcontents
vspace{24pt}
endgroup

chapter*{Left-Justified Chapter 1}
addcontentsline{toc}{chapter}{Left-Justified Chapter 1}

Some indented text.

chapter*{Left-Justified Chapter 2}
addcontentsline{toc}{chapter}{Left-Justified Chapter 2}

More indented text.

end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 10 at 12:48









BernardBernard

173k776205




173k776205













  • Both suggestions worked perfectly. Thanks.

    – SapereAude
    Mar 10 at 17:36



















  • Both suggestions worked perfectly. Thanks.

    – SapereAude
    Mar 10 at 17:36

















Both suggestions worked perfectly. Thanks.

– SapereAude
Mar 10 at 17:36





Both suggestions worked perfectly. Thanks.

– SapereAude
Mar 10 at 17:36











0














By default the tocloft package uses the standard class's (book, report, article) settings for the ToC, LoF and LoT. The following (less any typos) is a solution to your problem using tocloft.



documentclass{book}
usepackage{tocloft}

%% center Contents title
renewcommand{cfttoctitlefont}{hfillHugebfseries}
renewcommand{cftaftertoctitle}{hfill}

%% add dot leaders to chapters
renewcommand{cftchapdotsep}{cftdotsep}

begin{document}
tableofcontents
chapter{First chapter}
section{A section}
subsection{A subsection}
end{document}


This makes no changes to the indentation and vertical placement of the entries.






share|improve this answer
























  • Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

    – SapereAude
    Mar 11 at 1:10











  • Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

    – SapereAude
    Mar 11 at 1:12











  • Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

    – SapereAude
    Mar 11 at 2:34











  • @SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

    – Peter Wilson
    Mar 12 at 19:05











  • Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

    – SapereAude
    Mar 13 at 4:36
















0














By default the tocloft package uses the standard class's (book, report, article) settings for the ToC, LoF and LoT. The following (less any typos) is a solution to your problem using tocloft.



documentclass{book}
usepackage{tocloft}

%% center Contents title
renewcommand{cfttoctitlefont}{hfillHugebfseries}
renewcommand{cftaftertoctitle}{hfill}

%% add dot leaders to chapters
renewcommand{cftchapdotsep}{cftdotsep}

begin{document}
tableofcontents
chapter{First chapter}
section{A section}
subsection{A subsection}
end{document}


This makes no changes to the indentation and vertical placement of the entries.






share|improve this answer
























  • Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

    – SapereAude
    Mar 11 at 1:10











  • Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

    – SapereAude
    Mar 11 at 1:12











  • Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

    – SapereAude
    Mar 11 at 2:34











  • @SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

    – Peter Wilson
    Mar 12 at 19:05











  • Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

    – SapereAude
    Mar 13 at 4:36














0












0








0







By default the tocloft package uses the standard class's (book, report, article) settings for the ToC, LoF and LoT. The following (less any typos) is a solution to your problem using tocloft.



documentclass{book}
usepackage{tocloft}

%% center Contents title
renewcommand{cfttoctitlefont}{hfillHugebfseries}
renewcommand{cftaftertoctitle}{hfill}

%% add dot leaders to chapters
renewcommand{cftchapdotsep}{cftdotsep}

begin{document}
tableofcontents
chapter{First chapter}
section{A section}
subsection{A subsection}
end{document}


This makes no changes to the indentation and vertical placement of the entries.






share|improve this answer













By default the tocloft package uses the standard class's (book, report, article) settings for the ToC, LoF and LoT. The following (less any typos) is a solution to your problem using tocloft.



documentclass{book}
usepackage{tocloft}

%% center Contents title
renewcommand{cfttoctitlefont}{hfillHugebfseries}
renewcommand{cftaftertoctitle}{hfill}

%% add dot leaders to chapters
renewcommand{cftchapdotsep}{cftdotsep}

begin{document}
tableofcontents
chapter{First chapter}
section{A section}
subsection{A subsection}
end{document}


This makes no changes to the indentation and vertical placement of the entries.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 10 at 20:01









Peter WilsonPeter Wilson

8,59711533




8,59711533













  • Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

    – SapereAude
    Mar 11 at 1:10











  • Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

    – SapereAude
    Mar 11 at 1:12











  • Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

    – SapereAude
    Mar 11 at 2:34











  • @SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

    – Peter Wilson
    Mar 12 at 19:05











  • Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

    – SapereAude
    Mar 13 at 4:36



















  • Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

    – SapereAude
    Mar 11 at 1:10











  • Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

    – SapereAude
    Mar 11 at 1:12











  • Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

    – SapereAude
    Mar 11 at 2:34











  • @SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

    – Peter Wilson
    Mar 12 at 19:05











  • Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

    – SapereAude
    Mar 13 at 4:36

















Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

– SapereAude
Mar 11 at 1:10





Hi Peter, thanks for the MWE. For the code you wrote, I find that including the tocloft package and related settings (as opposed to commenting them out) not only centers the title and adds dot leaders, but also raises both the title and entries by about the height of the title. This upward shift is one example of what I'm calling an unwanted change in vertical placement.

– SapereAude
Mar 11 at 1:10













Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

– SapereAude
Mar 11 at 1:12





Additionally, when the TOC is long enough, LaTeX apparently may adjust vertical spacing between entries so that the final entry on the page is a fixed distance from the bottom of the page. This means that the upward shift that I just described can lead to differences in inter-entry spacing. Hope this clarifies what I meant. Thanks for encouraging me to look at this more closely.

– SapereAude
Mar 11 at 1:12













Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

– SapereAude
Mar 11 at 2:34





Finally, it turned out that the indentation issue that I mentioned in my original question had another explanation (tocloft was not to blame), and I have edited my question accordingly. Thanks, Peter.

– SapereAude
Mar 11 at 2:34













@SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

– Peter Wilson
Mar 12 at 19:05





@SapereAude When I processed my MWE there was no change in the vertical position of the title or entries. For long (multipage) ToCs LaTeX will alter, or not, the vertical spacing between the entries according as to whether raggedbottom or flushbottom is in effect.

– Peter Wilson
Mar 12 at 19:05













Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

– SapereAude
Mar 13 at 4:36





Interesting. The upward vertical shift, which on closer inspection appears to be the line width of a TOC entry, is quite reproducible on my end. In such a minimal example, it was not easy for me to see this difference without printing out the TOC with and without the tocloft lines commented out. In any event, I've opened a new question about this.

– SapereAude
Mar 13 at 4:36


















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478709%2fhow-do-i-center-the-table-of-contents-title-without-using-tocloft%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?