1

Is there any way of force the titles of subsections in the amsart to be in title case by default? I tried this but no luck:

\documentclass{amsart}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\usepackage{titlecaps}

\makeatletter
\patchcmd{\subsection}{\bfseries}{\titlecap}{}{}
\makeatother

\begin{document}

\maketitle

\section{Section}

\subsection{Subsection with lowercase letters}

\end{document}
2

2 Answers 2

2

The reason why replacing \bfseries with \titlecap does not work is that \bfseries is a declaration that does not take an argument, whereas \titlecap is a macro requiring an argument.

However, this approach may work, of redefining \@sect to look for subsections (when #2 = 2) and, upon finding so, replace the subsection title #8 with \titlecap{#8}. I also turned off \bfseries in #6 since that seems to be what the OP wanted.

\documentclass{amsart}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\usepackage{titlecaps}

\makeatletter
\let\sv@sect\@sect
\def\@sect#1#2#3#4#5#6[#7]#8{%
  \ifnum#2=2 
    \def\next{\sv@sect{#1}{#2}{#3}{#4}{#5}{\normalfont}[#7]{\titlecap{#8}}}%
  \else
    \def\next{\sv@sect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{#8}}%
  \fi
  \next
}
\makeatother

\begin{document}

\section{Section}

\subsection{Subsection with lowercase letters}

\subsection{another test case}

\end{document}

enter image description here

1
  • 1
    Thank you for not only answering but providing a clear explaination. May 18, 2021 at 14:40
0

look at my code. It solves your problem by using \uppercase

\documentclass{amsart}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\usepackage{titlecaps}

\makeatletter
\patchcmd{\subsection}{\bfseries}{\titlecap}{}{}
\makeatother

\begin{document}


\maketitle

\section{\uppercase{Section}}

\subsection{\uppercase{Subsection with lowercase letters}}

\end{document}

Hope this works.

enter image description here

1
  • 1
    I want it in Title case, not uppercase and I want to automate it fully. May 18, 2021 at 14:00

You must log in to answer this question.

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