Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using the amsart document class, how can I replace all the running heads with the title of the current section? Is there a way to do this natively in the class, or am I looking at needing fancyhdr, or something? What even is the command which fills in the name of the current section, and is it available in amsart?

Thanks so much.

share|improve this question
    
\pagestyle{headings} same as article class is I think what you are looking for. –  David Carlisle May 24 '13 at 22:27
1  
Welcome to TeX.SX! You may have a look on our starter guide. –  mafp May 24 '13 at 22:34

1 Answer 1

up vote 4 down vote accepted

The amsart class is a rather closed one. It disables commands such as \sectionmark and similar ones and also redefines the sectioning commands for not updating the marks necessary for the job.

It's possible to do it, but remember that something might go wrong, as it's complicated to keep up with all the adjustments the class does.

\documentclass{amsart}

\usepackage{regexpatch}

\usepackage{kantlipsum} % just for the example

%%% let's patch the amsart macros
\makeatletter
\renewcommand{\sectionmark}[2]{%
  \ifnum#1<\@m
    \markboth{\thesection. #2}{\thesection. #2}%
  \else
    \markboth{#2}{#2}%
  \fi}
\xpatchcmd*{\@sect}
  {\@tocwrite}
  {\csname #1mark\endcsname{#2}{#7}\@tocwrite}
  {}{}
\makeatother


\begin{document}
\author{Me}
\title{Whatever}
\maketitle

\section{First}
\kant

\section{Second}
\kant

%%% let's provide a mock bibliography
\begin{thebibliography}{99}

\count255=0
\loop\ifnum\count255<60
\advance\count255 1
\expandafter\bibitem\expandafter{\number\count255 } x
\repeat

\end{thebibliography}


\end{document}

enter image description here

share|improve this answer
    
Absolutely fantastic, my friend. I sure wouldn't have been able to do that myself. Thanks so very much! –  etalli May 25 '13 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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