TransWikia.com

How can I use a custom font in a new list of elements using tocloft?

TeX - LaTeX Asked by maxxxroma on June 14, 2021

I’m trying to create a custom list of equations using tocloft, but I’m not really sure how to use a custom font for each entry and its page number.

Here’s the code I’m using:

documentclass[12pt,a4paper,english]{extbook}
[...]
usepackage[titles]{tocloft}
usepackage[T1]{fontenc}
usepackage{fontspec}
[...]

begin{document}

%%%%% To be used in case of custom font %%%%%
myCustomFont
fancyhead[EL]{myCustomFontnouppercaseleftmark}
fancyhead[OR]{myCustomFontnouppercaserightmark}
% Table of Contents
renewcommand{cftchapfont}{bfseriesmyCustomFont}
renewcommand{cftsecfont}{myCustomFont}
renewcommand{cftsubsecfont}{myCustomFont}
renewcommand{cftchappagefont}{bfseriesmyCustomFont}
renewcommand{cftsecpagefont}{myCustomFont}
renewcommand{cftsubsecpagefont}{myCustomFont}
% List of Figures
renewcommand{cftfigfont}{myCustomFont}
renewcommand{cftfigpagefont}{myCustomFont}
% List of Tables
renewcommand{cfttabfont}{myCustomFont}
renewcommand{cfttabpagefont}{myCustomFont}
% Lists of Equations
newcommand{listequationsname}{List of Equations}
newcommand{listequationsfont}{myCustomFont}
newcommand{listequationspagefont}{myCustomFont}
newlistof{myequations}{equ}{listequationsname}
newcommand{myequations}[1]{%
addcontentsline{equ}{myequations}{protectnumberline{theequation}#1}par}
setlength{cftmyequationsnumwidth}{2.5em}% Width of equation number in List of Equations
%%%%% Lists of equations %%%%%
%%%%% To be used in case of custom font %%%%%

    frontmatter
    {
        pagenumbering{roman}
        input{content/titlepage}
        setcounter{page}{0}
        cleardoublepagenullnewpage
        
        input{content/dedica}
        cleardoublepage
                
        {
          tableofcontents
          
          listoffigures
          
          listoftables
          
          lstlistoflistings
          
          listofmyequations
        }
        
        cleardoublepagenullnewpage
    }
[...]

I have already managed to change the font family for the Table of Contents and List of Tables and List of Figures, but I’m not sure how to do the same for my new custom List.
Correct font

Incorrect font

One Answer

As soon as I asked the question, I realized how dumb I was.

renewcommand{cftmyequationsfont}{myCustomFont}
renewcommand{cftmyequationspagefont}{myCustomFont}

Yup.

Answered by maxxxroma on June 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP