1

The following document uses a different font for the indexname, unfortunately it affects the table of contents as well.

\documentclass[10pt]{book}
\usepackage{makeidx}
\makeindex

\renewcommand*{\indexname}{\Huge my index name}


\usepackage{xpatch}
\xpatchcmd\theindex{\indexname}{\makebox[1.0\linewidth]{\indexname}}{}{}


\begin{document}
\tableofcontents

\chapter{First chapter}
\index{hello}
\cleardoublepage
\addcontentsline{toc}{chapter}{\indexname}


\printindex
\end{document} 
  • What \documentclass are you using? – Werner Nov 15 '16 at 6:01
1

\indexname is also used in the running heads, so changing it directly to include the font is not a good idea. Instead, use a package to update the font changes to your index chapter, like sectsty:

enter image description here

\documentclass{report}

\usepackage{makeidx,sectsty}

\makeindex
\renewcommand*{\indexname}{my index name}

\begin{document}
\tableofcontents

\chapter{First chapter}
\index{hello}

\cleardoublepage

\addcontentsline{toc}{chapter}{\indexname}
\chapterfont{\Huge\bfseries}
\printindex

\end{document}
  • Thank you, unfortunately for other reasons, I also use \usepackage{titlesec} \titleformat{\chapter}[display] {\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\huge} \titlespacing*{\chapter} {0pt}{.26\textheight}{40pt} in my document and this solution does not work with this. Can I ask a new question with using this or I modify this question? – Name Nov 15 '16 at 6:19
  • @Name: That's why you should include all the details necessary as part of your question. titlesec is most certainly important when you're talking about sectional titles! My solution uses sectsty which is not truly compatible with titlesec. I'll update my answer... – Werner Nov 15 '16 at 6:22
  • Yes you are right, I tried to provide a minimal working document that reproduces the problem, but it turned out that the document was too minimal. – Name Nov 15 '16 at 6:24
  • 1
    @Name: Just add an updated \titleformat immediately before \printindex. This will overwrite the former definition. By updated I mean you can change \normalfont\Huge\bfseries into whatever you need. – Werner Nov 15 '16 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.