markboth: How to use to insert a nouppercase heading in LaTeX

A friend of mine asked me to solve the following issue in LaTeX: in his master thesis he made use of the command markboth to insert the string “Elenco delle figure” (“List of figures”) on the upper corner of the heading of table the of contents. This modify works however, at the second building of the source file, he got the inserted string (“Elenco delle figure” in this specific case) in capital letters just in the first page after the title (as you can see in the pictures below).

 

1pic

before_2

 

So the problem is: in LaTeX markboth has been set by default to produce uppercase heading.

To modify this setting, just put the patchcmd code snippet before begin{document}, loading the required package xpatch as follow:

 

documentclass[a4paper,12pt,twoside]{book}
usepackage[utf8x]{inputenc}
usepackage[italian]{babel}
usepackage{fancyhdr}
usepackage{xpatch}

[…]

makeatletter
%% patch listoffigures not to issue @mkboth but markboth
%% and to issue addcontentsline
patchcmd{listoffigures}
{@mkboth{MakeUppercaselistfigurename}{MakeUppercaselistfigurename}}
{addcontentsline{toc}{chapter}{listfigurename}markboth{listfigurename}{}}
{}{}
makeatother

begin{document}

tableofcontentsmarkboth{Indice}{}
newpage
listoffiguresmarkboth{Elenco delle figure}{}
newpage
listoftables
newpage

end{document}

[…]

 

And the result is what my friend was looking for!

after

Happy hacking!

About Daniele Dalla Torre

I'm a Civil Engineering student but I love to learn everything about technology, from the basics to the new frontiers! Here my gpg public key!

Leave a Reply

Your email address will not be published.

*