0

The following command works fine on my pc but doesn't work on Overleaf. The tableofcontents is strange and several errors appear. Any tips on how to resolve this?

\documentclass{report}

\usepackage{hyperref}
\usepackage{textcase}
\makeatletter
\renewcommand\l@chapter[2]{\@dottedtocline{1}{0pt}{4em}{\bf \MakeUppercase{#1}}{#2}}
\makeatother

\begin{document}
\tableofcontents
\chapter{Introduction}
\end{document}
3
  • Please compile your MWE twice, it produced error in PC too
    – MadyYuvi
    Commented Jul 18, 2023 at 11:04
  • @MadyYuvi No error compiled with TeX Live 2023. Commented Jul 18, 2023 at 11:12
  • @hair-splitter Oh! sorry, I'm using MikTeX 2.9
    – MadyYuvi
    Commented Jul 18, 2023 at 11:39

1 Answer 1

1

Instead of \MakeUppercase try with \uppercase

\documentclass{report}

\usepackage{hyperref}

\begin{document}
\makeatletter
\renewcommand\l@chapter[2]{\@dottedtocline{1}{0pt}{4em}{\bf \protect\uppercase{#1}}{#2}}
\makeatother

\tableofcontents

\chapter{Introduction}

\end{document}
2
  • It works perfectly. Thanks! Commented Jul 18, 2023 at 12:01
  • 1
    that can work if your titles are simple but it is not a stable solution long term. So once overleaf updates better switch back to \MakeUppercase. Commented Jul 18, 2023 at 16:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .