Adjust TOC title font, size and weight using tocloft












3














I would like to use the tocloft package to make some adjustments to my TOC. This MWE is based on the accepted answer to this question.



documentclass [a4paper,11pt,twoside]{book}

usepackage{fontspec}
%usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %!Change to any font that you have on your system

usepackage[dutch,english]{babel}

usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
%addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading large, bold and sans
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}

begin{document}

frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


From the documentation, I would have thought that renewcommand{cftaftertoctitle}{hfill} would have set the title to bold and large.
What am I getting wrong here?



Also, I would like to make sure that the title font and entry fonts are set to my sans font. Is there something more I have to do for that? Maybe renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily}?










share|improve this question
























  • Are you sure that the Book Antiqua font has a bold version? The font is clearly not a sans - serif font.
    – Christian Hupfer
    Jan 1 at 8:26












  • @ChristianHupfer I'm quite new to LaTeX, but this font specification is meeting my purposes. The headings are defined by setsansfont{TeX Gyre Heros} and the body of the text by setmainfont{Book Antiqua}. The bold in the body come out as bold Book Aniqua. I suspect that I need to do more reading on this?
    – Simon
    Jan 1 at 8:34










  • Well, there is a second renewcommand{cfttoctitlefont}{hfill} (right in the middle of the bunch of cft.... redefinitions) after your first redefinition, so you're wiping out the first setting
    – Christian Hupfer
    Jan 1 at 8:53


















3














I would like to use the tocloft package to make some adjustments to my TOC. This MWE is based on the accepted answer to this question.



documentclass [a4paper,11pt,twoside]{book}

usepackage{fontspec}
%usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %!Change to any font that you have on your system

usepackage[dutch,english]{babel}

usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
%addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading large, bold and sans
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}

begin{document}

frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


From the documentation, I would have thought that renewcommand{cftaftertoctitle}{hfill} would have set the title to bold and large.
What am I getting wrong here?



Also, I would like to make sure that the title font and entry fonts are set to my sans font. Is there something more I have to do for that? Maybe renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily}?










share|improve this question
























  • Are you sure that the Book Antiqua font has a bold version? The font is clearly not a sans - serif font.
    – Christian Hupfer
    Jan 1 at 8:26












  • @ChristianHupfer I'm quite new to LaTeX, but this font specification is meeting my purposes. The headings are defined by setsansfont{TeX Gyre Heros} and the body of the text by setmainfont{Book Antiqua}. The bold in the body come out as bold Book Aniqua. I suspect that I need to do more reading on this?
    – Simon
    Jan 1 at 8:34










  • Well, there is a second renewcommand{cfttoctitlefont}{hfill} (right in the middle of the bunch of cft.... redefinitions) after your first redefinition, so you're wiping out the first setting
    – Christian Hupfer
    Jan 1 at 8:53
















3












3








3







I would like to use the tocloft package to make some adjustments to my TOC. This MWE is based on the accepted answer to this question.



documentclass [a4paper,11pt,twoside]{book}

usepackage{fontspec}
%usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %!Change to any font that you have on your system

usepackage[dutch,english]{babel}

usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
%addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading large, bold and sans
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}

begin{document}

frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


From the documentation, I would have thought that renewcommand{cftaftertoctitle}{hfill} would have set the title to bold and large.
What am I getting wrong here?



Also, I would like to make sure that the title font and entry fonts are set to my sans font. Is there something more I have to do for that? Maybe renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily}?










share|improve this question















I would like to use the tocloft package to make some adjustments to my TOC. This MWE is based on the accepted answer to this question.



documentclass [a4paper,11pt,twoside]{book}

usepackage{fontspec}
%usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %!Change to any font that you have on your system

usepackage[dutch,english]{babel}

usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
%addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading large, bold and sans
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}

begin{document}

frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


From the documentation, I would have thought that renewcommand{cftaftertoctitle}{hfill} would have set the title to bold and large.
What am I getting wrong here?



Also, I would like to make sure that the title font and entry fonts are set to my sans font. Is there something more I have to do for that? Maybe renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily}?







table-of-contents tocloft






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 9:07







Simon

















asked Jan 1 at 8:21









SimonSimon

1454




1454












  • Are you sure that the Book Antiqua font has a bold version? The font is clearly not a sans - serif font.
    – Christian Hupfer
    Jan 1 at 8:26












  • @ChristianHupfer I'm quite new to LaTeX, but this font specification is meeting my purposes. The headings are defined by setsansfont{TeX Gyre Heros} and the body of the text by setmainfont{Book Antiqua}. The bold in the body come out as bold Book Aniqua. I suspect that I need to do more reading on this?
    – Simon
    Jan 1 at 8:34










  • Well, there is a second renewcommand{cfttoctitlefont}{hfill} (right in the middle of the bunch of cft.... redefinitions) after your first redefinition, so you're wiping out the first setting
    – Christian Hupfer
    Jan 1 at 8:53




















  • Are you sure that the Book Antiqua font has a bold version? The font is clearly not a sans - serif font.
    – Christian Hupfer
    Jan 1 at 8:26












  • @ChristianHupfer I'm quite new to LaTeX, but this font specification is meeting my purposes. The headings are defined by setsansfont{TeX Gyre Heros} and the body of the text by setmainfont{Book Antiqua}. The bold in the body come out as bold Book Aniqua. I suspect that I need to do more reading on this?
    – Simon
    Jan 1 at 8:34










  • Well, there is a second renewcommand{cfttoctitlefont}{hfill} (right in the middle of the bunch of cft.... redefinitions) after your first redefinition, so you're wiping out the first setting
    – Christian Hupfer
    Jan 1 at 8:53


















Are you sure that the Book Antiqua font has a bold version? The font is clearly not a sans - serif font.
– Christian Hupfer
Jan 1 at 8:26






Are you sure that the Book Antiqua font has a bold version? The font is clearly not a sans - serif font.
– Christian Hupfer
Jan 1 at 8:26














@ChristianHupfer I'm quite new to LaTeX, but this font specification is meeting my purposes. The headings are defined by setsansfont{TeX Gyre Heros} and the body of the text by setmainfont{Book Antiqua}. The bold in the body come out as bold Book Aniqua. I suspect that I need to do more reading on this?
– Simon
Jan 1 at 8:34




@ChristianHupfer I'm quite new to LaTeX, but this font specification is meeting my purposes. The headings are defined by setsansfont{TeX Gyre Heros} and the body of the text by setmainfont{Book Antiqua}. The bold in the body come out as bold Book Aniqua. I suspect that I need to do more reading on this?
– Simon
Jan 1 at 8:34












Well, there is a second renewcommand{cfttoctitlefont}{hfill} (right in the middle of the bunch of cft.... redefinitions) after your first redefinition, so you're wiping out the first setting
– Christian Hupfer
Jan 1 at 8:53






Well, there is a second renewcommand{cfttoctitlefont}{hfill} (right in the middle of the bunch of cft.... redefinitions) after your first redefinition, so you're wiping out the first setting
– Christian Hupfer
Jan 1 at 8:53












1 Answer
1






active

oldest

votes


















3














The original code has



renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{}


So any font change for the title or the chapter toc entries is not used. Setting them to hfillLargebfseriessffamily etc. will change to large, bold sans serif entries, given that the font supports those settings.



Similar modifications must be applied to cftsecfont etc, if desired.



documentclass [a4paper,11pt,twoside]{book}



usepackage{fontspec}
usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %Change to any font that you have on your system

usepackage[dutch,english]{babel}


usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cftchapfont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchappagefont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}


begin{document}



frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


enter image description here






share|improve this answer























  • I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
    – Christian Hupfer
    Jan 1 at 9:04






  • 1




    I'll edit the question to use Liberation Sans. Works like a charm.
    – Simon
    Jan 1 at 9:05










  • @Simon: You're welcome. Happy TeXing.
    – Christian Hupfer
    Jan 1 at 9:06











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%2f468103%2fadjust-toc-title-font-size-and-weight-using-tocloft%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














The original code has



renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{}


So any font change for the title or the chapter toc entries is not used. Setting them to hfillLargebfseriessffamily etc. will change to large, bold sans serif entries, given that the font supports those settings.



Similar modifications must be applied to cftsecfont etc, if desired.



documentclass [a4paper,11pt,twoside]{book}



usepackage{fontspec}
usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %Change to any font that you have on your system

usepackage[dutch,english]{babel}


usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cftchapfont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchappagefont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}


begin{document}



frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


enter image description here






share|improve this answer























  • I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
    – Christian Hupfer
    Jan 1 at 9:04






  • 1




    I'll edit the question to use Liberation Sans. Works like a charm.
    – Simon
    Jan 1 at 9:05










  • @Simon: You're welcome. Happy TeXing.
    – Christian Hupfer
    Jan 1 at 9:06
















3














The original code has



renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{}


So any font change for the title or the chapter toc entries is not used. Setting them to hfillLargebfseriessffamily etc. will change to large, bold sans serif entries, given that the font supports those settings.



Similar modifications must be applied to cftsecfont etc, if desired.



documentclass [a4paper,11pt,twoside]{book}



usepackage{fontspec}
usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %Change to any font that you have on your system

usepackage[dutch,english]{babel}


usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cftchapfont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchappagefont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}


begin{document}



frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


enter image description here






share|improve this answer























  • I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
    – Christian Hupfer
    Jan 1 at 9:04






  • 1




    I'll edit the question to use Liberation Sans. Works like a charm.
    – Simon
    Jan 1 at 9:05










  • @Simon: You're welcome. Happy TeXing.
    – Christian Hupfer
    Jan 1 at 9:06














3












3








3






The original code has



renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{}


So any font change for the title or the chapter toc entries is not used. Setting them to hfillLargebfseriessffamily etc. will change to large, bold sans serif entries, given that the font supports those settings.



Similar modifications must be applied to cftsecfont etc, if desired.



documentclass [a4paper,11pt,twoside]{book}



usepackage{fontspec}
usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %Change to any font that you have on your system

usepackage[dutch,english]{babel}


usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cftchapfont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchappagefont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}


begin{document}



frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


enter image description here






share|improve this answer














The original code has



renewcommand{cftaftertoctitle}{hfill}
%renewcommand{cfttoctitlefont}{hfillLargebfseries} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cfttoctitlefont}{hfill} % Blank space before title
renewcommand{cftaftertoctitle}{hfill} % Blank space after title
renewcommand{cftchapfont}{}


So any font change for the title or the chapter toc entries is not used. Setting them to hfillLargebfseriessffamily etc. will change to large, bold sans serif entries, given that the font supports those settings.



Similar modifications must be applied to cftsecfont etc, if desired.



documentclass [a4paper,11pt,twoside]{book}



usepackage{fontspec}
usepackage{titlesec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Book Antiqua}
setsansfont{Liberation Sans} %Change to any font that you have on your system

usepackage[dutch,english]{babel}


usepackage{tocloft}

renewcommand{cftbeforechapskip}{baselineskip} % allow spacing after each chapter/section entry
renewcommand{contentsname}{Contents}
addtocaptionsenglish{defcontentsname{Contents}} %! Needed for babel? https://tex.stackexchange.com/questions/35903/formatting-the-title-of-the-toc
renewcommand{cftaftertoctitle}{hfill}
renewcommand{cfttoctitlefont}{hfillLargebfseriessffamily} %!some command to make the heading huge and bold
renewcommand{cftbeforetoctitleskip}{-0.25in} % Title is 1in from top
renewcommand{cftaftertoctitleskip}{2.0baselineskip}% 1 double space after title
renewcommand{cftchapfont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchappagefont}{largebfseriessffamily} % Can make it bold faced here; don't put a space in the {}
renewcommand{cftchapleader}{cftdotfill{cftchapdotsep}}
renewcommand{cftchapdotsep}{cftdotsep} % Puts dots after chapter entries
renewcommand{cftchappresnum}{Chapter } %
renewcommand{cftchapaftersnum}{} % Don't put a space in the {}
renewcommand{cftsecleader}{cftdotfill{cftsecdotsep}}%
renewcommand{cftchappagefont}{} %
renewcommand{cftchapnumwidth}{1in}

setcounter{tocdepth}{0}


begin{document}



frontmatter
tableofcontents

mainmatter
chapter{A really long chapter heading that will wrap around in the table of contents and end up inline with the chapter name}
section{First section}

chapter{Another chapter}
end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 1 at 9:15

























answered Jan 1 at 8:58









Christian HupferChristian Hupfer

148k14193390




148k14193390












  • I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
    – Christian Hupfer
    Jan 1 at 9:04






  • 1




    I'll edit the question to use Liberation Sans. Works like a charm.
    – Simon
    Jan 1 at 9:05










  • @Simon: You're welcome. Happy TeXing.
    – Christian Hupfer
    Jan 1 at 9:06


















  • I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
    – Christian Hupfer
    Jan 1 at 9:04






  • 1




    I'll edit the question to use Liberation Sans. Works like a charm.
    – Simon
    Jan 1 at 9:05










  • @Simon: You're welcome. Happy TeXing.
    – Christian Hupfer
    Jan 1 at 9:06
















I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
– Christian Hupfer
Jan 1 at 9:04




I had to switch to Liberation Sans since I don't have TeX Gyre Heros on my computer
– Christian Hupfer
Jan 1 at 9:04




1




1




I'll edit the question to use Liberation Sans. Works like a charm.
– Simon
Jan 1 at 9:05




I'll edit the question to use Liberation Sans. Works like a charm.
– Simon
Jan 1 at 9:05












@Simon: You're welcome. Happy TeXing.
– Christian Hupfer
Jan 1 at 9:06




@Simon: You're welcome. Happy TeXing.
– Christian Hupfer
Jan 1 at 9:06


















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%2f468103%2fadjust-toc-title-font-size-and-weight-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

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅