1

I am using the JHEP template to write my dissertation. This is how the table of contents presently looks,enter image description here

In the document code, I wanted the section font to be bigger and hence I added \Large to the section definition. For example:

\section{\Large Introduction}. 

But, this change in font size is being reflected in the table of contents. What should I do in order to have a uniform font size in the table of contents?

From some online lecture notes written in JHEP template, I am aware that it is possible to have different font sizes for section names within the document and in the table of contents.

  • 1
    Welcome to TeX.SX! If you’re required to use a template to write your dissertation, then I don’t think it’s a good idea to change the design of the template (Are you sure you want to impose your own taste on your university’s requirement?). – Ruixi Zhang Jul 28 '18 at 16:36
  • @RuixiZhang I am not required to use any particular template. I chose JHEP as find its format pretty good. But, JHEP is for academic articles while I am writing a thesis. Hence, I would like to have titles of chapters with bigger font sizes which lead to the above problem. – Rajath Krishna R Jul 28 '18 at 16:39
  • I see. Please put your code fragment into a compilable document, starting with \documentclass{...} and ending with \end{document}. Using JHEP3.cls or using jheppub.sty may need different solutions. You can have a look at this guide for how to prune your code for this purpose. – Ruixi Zhang Jul 28 '18 at 17:45
  • Just modify \section by etoolbox's \patchcmd or with titlesec, and remove the manual \Large. – Jhor Jul 28 '18 at 18:44
  • Thank you everyone for your suggestions. My problem got solved. – Rajath Krishna R Jul 28 '18 at 20:03
1

After loading the style file for JHEP, i.e., after the line

\usepackage{jheppub}

add the following lines:

\usepackage{xpatch}
\xpatchcmd\section{\large}{\Large}{}{}
%\xpatchcmd\subsection{\normalsize}{\normalsize}{}{}
%\xpatchcmd\subsubsection{\normalsize}{\normalsize}{}{}

This code replaces \large by \Large in all section titles. If you want to change also the size of sub-sections and sub-sub-sections, uncomment the corresponding line and replace the second \normalsize by the new size.

Don't add the font size \Large to the section title itself, since then the size command will be used everywhere the section title is used, including in the table of contents.

As an example, modify the preamble of jhepexample.tex (the sample file coming with the jhep style) to look like

\usepackage{jheppub} % for details on the use of the package, please
                     % see the JHEP-author-manual
\usepackage{xpatch}
\xpatchcmd\section{\large}{\Large}{}{}    
\usepackage[T1]{fontenc} % if needed

(without modifying anything else!). Then the document will start like that:

enter image description here

For comparison, here is the output of the unmodified document:

enter image description here

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.