Change font from Pagnumer in tableofcontents












0















I use in my document a font that is not a monospace.
This has to follow that I have jumping numbers in my table of contents. How can I assign a different font to the page number?
In the chapter addtokomafont{chapterentrypagenumber}{ttfamily} the rest of the elements section and subsequenten etc. don't work with it.



documentclass[chapterprefix=false,parskip=half]{scrreprt}
usepackage{mwe}
usepackage{fontspec}
usepackage[draft=false]{scrlayer-scrpage}
setmainfont[
Ligatures=TeX,
Extension=.otf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
]{Planer}
setsansfont{Planer-Medium}


addtokomafont{chapterentrypagenumber}{ttfamily}


begin{document}
tableofcontents
blinddocument
end{document}


enter image description here










share|improve this question




















  • 2





    Could you add a MWE ?

    – flav
    Feb 13 at 15:53











  • →tex.stackexchange.com/a/309208

    – Schweinebacke
    Feb 13 at 17:06











  • MWE added @flav ;)

    – Kai
    Feb 13 at 17:33
















0















I use in my document a font that is not a monospace.
This has to follow that I have jumping numbers in my table of contents. How can I assign a different font to the page number?
In the chapter addtokomafont{chapterentrypagenumber}{ttfamily} the rest of the elements section and subsequenten etc. don't work with it.



documentclass[chapterprefix=false,parskip=half]{scrreprt}
usepackage{mwe}
usepackage{fontspec}
usepackage[draft=false]{scrlayer-scrpage}
setmainfont[
Ligatures=TeX,
Extension=.otf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
]{Planer}
setsansfont{Planer-Medium}


addtokomafont{chapterentrypagenumber}{ttfamily}


begin{document}
tableofcontents
blinddocument
end{document}


enter image description here










share|improve this question




















  • 2





    Could you add a MWE ?

    – flav
    Feb 13 at 15:53











  • →tex.stackexchange.com/a/309208

    – Schweinebacke
    Feb 13 at 17:06











  • MWE added @flav ;)

    – Kai
    Feb 13 at 17:33














0












0








0








I use in my document a font that is not a monospace.
This has to follow that I have jumping numbers in my table of contents. How can I assign a different font to the page number?
In the chapter addtokomafont{chapterentrypagenumber}{ttfamily} the rest of the elements section and subsequenten etc. don't work with it.



documentclass[chapterprefix=false,parskip=half]{scrreprt}
usepackage{mwe}
usepackage{fontspec}
usepackage[draft=false]{scrlayer-scrpage}
setmainfont[
Ligatures=TeX,
Extension=.otf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
]{Planer}
setsansfont{Planer-Medium}


addtokomafont{chapterentrypagenumber}{ttfamily}


begin{document}
tableofcontents
blinddocument
end{document}


enter image description here










share|improve this question
















I use in my document a font that is not a monospace.
This has to follow that I have jumping numbers in my table of contents. How can I assign a different font to the page number?
In the chapter addtokomafont{chapterentrypagenumber}{ttfamily} the rest of the elements section and subsequenten etc. don't work with it.



documentclass[chapterprefix=false,parskip=half]{scrreprt}
usepackage{mwe}
usepackage{fontspec}
usepackage[draft=false]{scrlayer-scrpage}
setmainfont[
Ligatures=TeX,
Extension=.otf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
]{Planer}
setsansfont{Planer-Medium}


addtokomafont{chapterentrypagenumber}{ttfamily}


begin{document}
tableofcontents
blinddocument
end{document}


enter image description here







fonts table-of-contents koma-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 13 at 17:20







Kai

















asked Feb 13 at 15:36









KaiKai

284




284








  • 2





    Could you add a MWE ?

    – flav
    Feb 13 at 15:53











  • →tex.stackexchange.com/a/309208

    – Schweinebacke
    Feb 13 at 17:06











  • MWE added @flav ;)

    – Kai
    Feb 13 at 17:33














  • 2





    Could you add a MWE ?

    – flav
    Feb 13 at 15:53











  • →tex.stackexchange.com/a/309208

    – Schweinebacke
    Feb 13 at 17:06











  • MWE added @flav ;)

    – Kai
    Feb 13 at 17:33








2




2





Could you add a MWE ?

– flav
Feb 13 at 15:53





Could you add a MWE ?

– flav
Feb 13 at 15:53













→tex.stackexchange.com/a/309208

– Schweinebacke
Feb 13 at 17:06





→tex.stackexchange.com/a/309208

– Schweinebacke
Feb 13 at 17:06













MWE added @flav ;)

– Kai
Feb 13 at 17:33





MWE added @flav ;)

– Kai
Feb 13 at 17:33










1 Answer
1






active

oldest

votes


















2














KOMA-Script classes use package tocbasic to configure the ToC entries. So you can use DeclareTOCStyleEntry/DeclareTOCStyleEntries and their option pagenumberformat to change the format of the page number, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

DeclareTOCStyleEntries[%
pagenumberformat=texttt
]{section}{section,subsection}
DeclareTOCStyleEntry[%
pagenumberformat=textbftt
]{chapter}{chapter}
newcommand*{textbftt}[1]{textbf{texttt{#1}}}
begin{document}
tableofcontents
blinddocument
end{document}


KOMA-Script classes also provide to set ToC entry options using RedeclareSectionCommand/RedeclareSectionCommands by adding the prefix toc to the option name. So you can alternatively use, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

RedeclareSectionCommands[%
tocpagenumberformat=texttt
]{chapter,section,subsection}

begin{document}
tableofcontents
blinddocument
end{document}


However, the digits of the default LaTeX fonts are table digits, so even



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

begin{document}
tableofcontents
Blinddocument
Blinddocument
end{document}


does not result in jumping page numbers. If you are using a font, where the digits have different widths, you should have look, whether it also provides table digits with same width for all digits. In this case you should be able to use the format option also to select the table digits.






share|improve this answer
























  • Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

    – Kai
    Feb 13 at 17:33











  • @Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

    – Schweinebacke
    Feb 14 at 9:19











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%2f474722%2fchange-font-from-pagnumer-in-tableofcontents%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









2














KOMA-Script classes use package tocbasic to configure the ToC entries. So you can use DeclareTOCStyleEntry/DeclareTOCStyleEntries and their option pagenumberformat to change the format of the page number, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

DeclareTOCStyleEntries[%
pagenumberformat=texttt
]{section}{section,subsection}
DeclareTOCStyleEntry[%
pagenumberformat=textbftt
]{chapter}{chapter}
newcommand*{textbftt}[1]{textbf{texttt{#1}}}
begin{document}
tableofcontents
blinddocument
end{document}


KOMA-Script classes also provide to set ToC entry options using RedeclareSectionCommand/RedeclareSectionCommands by adding the prefix toc to the option name. So you can alternatively use, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

RedeclareSectionCommands[%
tocpagenumberformat=texttt
]{chapter,section,subsection}

begin{document}
tableofcontents
blinddocument
end{document}


However, the digits of the default LaTeX fonts are table digits, so even



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

begin{document}
tableofcontents
Blinddocument
Blinddocument
end{document}


does not result in jumping page numbers. If you are using a font, where the digits have different widths, you should have look, whether it also provides table digits with same width for all digits. In this case you should be able to use the format option also to select the table digits.






share|improve this answer
























  • Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

    – Kai
    Feb 13 at 17:33











  • @Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

    – Schweinebacke
    Feb 14 at 9:19
















2














KOMA-Script classes use package tocbasic to configure the ToC entries. So you can use DeclareTOCStyleEntry/DeclareTOCStyleEntries and their option pagenumberformat to change the format of the page number, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

DeclareTOCStyleEntries[%
pagenumberformat=texttt
]{section}{section,subsection}
DeclareTOCStyleEntry[%
pagenumberformat=textbftt
]{chapter}{chapter}
newcommand*{textbftt}[1]{textbf{texttt{#1}}}
begin{document}
tableofcontents
blinddocument
end{document}


KOMA-Script classes also provide to set ToC entry options using RedeclareSectionCommand/RedeclareSectionCommands by adding the prefix toc to the option name. So you can alternatively use, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

RedeclareSectionCommands[%
tocpagenumberformat=texttt
]{chapter,section,subsection}

begin{document}
tableofcontents
blinddocument
end{document}


However, the digits of the default LaTeX fonts are table digits, so even



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

begin{document}
tableofcontents
Blinddocument
Blinddocument
end{document}


does not result in jumping page numbers. If you are using a font, where the digits have different widths, you should have look, whether it also provides table digits with same width for all digits. In this case you should be able to use the format option also to select the table digits.






share|improve this answer
























  • Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

    – Kai
    Feb 13 at 17:33











  • @Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

    – Schweinebacke
    Feb 14 at 9:19














2












2








2







KOMA-Script classes use package tocbasic to configure the ToC entries. So you can use DeclareTOCStyleEntry/DeclareTOCStyleEntries and their option pagenumberformat to change the format of the page number, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

DeclareTOCStyleEntries[%
pagenumberformat=texttt
]{section}{section,subsection}
DeclareTOCStyleEntry[%
pagenumberformat=textbftt
]{chapter}{chapter}
newcommand*{textbftt}[1]{textbf{texttt{#1}}}
begin{document}
tableofcontents
blinddocument
end{document}


KOMA-Script classes also provide to set ToC entry options using RedeclareSectionCommand/RedeclareSectionCommands by adding the prefix toc to the option name. So you can alternatively use, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

RedeclareSectionCommands[%
tocpagenumberformat=texttt
]{chapter,section,subsection}

begin{document}
tableofcontents
blinddocument
end{document}


However, the digits of the default LaTeX fonts are table digits, so even



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

begin{document}
tableofcontents
Blinddocument
Blinddocument
end{document}


does not result in jumping page numbers. If you are using a font, where the digits have different widths, you should have look, whether it also provides table digits with same width for all digits. In this case you should be able to use the format option also to select the table digits.






share|improve this answer













KOMA-Script classes use package tocbasic to configure the ToC entries. So you can use DeclareTOCStyleEntry/DeclareTOCStyleEntries and their option pagenumberformat to change the format of the page number, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

DeclareTOCStyleEntries[%
pagenumberformat=texttt
]{section}{section,subsection}
DeclareTOCStyleEntry[%
pagenumberformat=textbftt
]{chapter}{chapter}
newcommand*{textbftt}[1]{textbf{texttt{#1}}}
begin{document}
tableofcontents
blinddocument
end{document}


KOMA-Script classes also provide to set ToC entry options using RedeclareSectionCommand/RedeclareSectionCommands by adding the prefix toc to the option name. So you can alternatively use, e.g.:



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

RedeclareSectionCommands[%
tocpagenumberformat=texttt
]{chapter,section,subsection}

begin{document}
tableofcontents
blinddocument
end{document}


However, the digits of the default LaTeX fonts are table digits, so even



documentclass{scrbook}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mwe}

begin{document}
tableofcontents
Blinddocument
Blinddocument
end{document}


does not result in jumping page numbers. If you are using a font, where the digits have different widths, you should have look, whether it also provides table digits with same width for all digits. In this case you should be able to use the format option also to select the table digits.







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 13 at 17:01









SchweinebackeSchweinebacke

21.7k4577




21.7k4577













  • Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

    – Kai
    Feb 13 at 17:33











  • @Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

    – Schweinebacke
    Feb 14 at 9:19



















  • Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

    – Kai
    Feb 13 at 17:33











  • @Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

    – Schweinebacke
    Feb 14 at 9:19

















Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

– Kai
Feb 13 at 17:33





Jap, Danke das war es. Die Schrift hat leider keine Tabellenziffern. siehe mwe ;)

– Kai
Feb 13 at 17:33













@Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

– Schweinebacke
Feb 14 at 9:19





@Kai I found several fonts named "Planer" in the net, but only one OTF font and that one is not free. So unfortunately, I cannot see anything with this MWE. However, if the answer is useful …

– Schweinebacke
Feb 14 at 9:19


















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%2f474722%2fchange-font-from-pagnumer-in-tableofcontents%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

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?