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.

I am using the ACM SIG alternate style, which automatically converts all section titles to upper case. I would like to include a reference in one of the section titles (Proof of Lemma X). The obvious way (shown in the MWE below) results in the following warning:

LaTeX Warning: Reference `SEC:INTRODUCTION' on page \thepage  undefined on input line 9.

Apparantly the argument of \ref is converted to upper case before the reference is generated. Is there a way to fix this without changing the label to upper case?

\documentclass{sig-alternate}
\begin{document}

\section{Introduction}
\label{sec:introduction}
The introduction.

\section{The section after Section~\ref{sec:introduction}}

\end{document}
share|improve this question
    
I don't have the style handy, but would placing a \protect prior to the \ref help? –  Steven B. Segletes Feb 25 at 18:46
1  
@StevenB.Segletes No, I tried that. I'll add a link to the style. –  Mangara Feb 25 at 18:47
    
Related: Reference undefined in \section with amsbook –  Mangara Feb 25 at 19:57

3 Answers 3

up vote 6 down vote accepted

Another option, sig-alternate.cls uses \uppercase in \@sect to format sectional unit titles; you can patch \@sect to use \MakeTextUppercase (from the textcase package) instead; in this way, the case of any math expressions in the titles won't be changed and the arguments of \cite, \label and \ref will also be prevented from being uppercased:

\documentclass{sig-alternate}
\usepackage{xpatch}
\usepackage{textcase}
\makeatletter
\xpatchcmd{\@sect}{\uppercase}{\MakeTextUppercase}{}{}
\xpatchcmd{\@sect}{\uppercase}{\MakeTextUppercase}{}{}
\makeatother
\begin{document}

\section{Introduction}
\label{sec:introduction}
The introduction.

\section{The section after Section~\ref{sec:introduction}}

\end{document}

In case xpatch is not available, one can do the patching using etoolbox, in this case, the lines

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@sect}{\uppercase}{\MakeTextUppercase}{}{}
\xpatchcmd{\@sect}{\uppercase}{\MakeTextUppercase}{}{}
\makeatother

must be replaced with

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@sect}{\uppercase}{\MakeTextUppercase}{}{}
\patchcmd{\@sect}{\uppercase}{\MakeTextUppercase}{}{}
\makeatother

(notice that now there's no "x" in the name of the patching command).

share|improve this answer
    
I'm having trouble with the xpatch package, so I can't verify whether this works. It looks like a better solution. –  Mangara Feb 25 at 19:28
1  
@Mangara I added to my answer an alternative using etoolbox instead of xpatch; if also etoolbox is not available in your system, let me know and I can give you an alternative with no packages for the patch (the code will be longer, though). –  Gonzalo Medina Feb 25 at 20:16
    
The etoolbox version worked for me. Thanks! –  Mangara Feb 25 at 20:23
1  
You should do the patch twice, because \uppercase appears twice in \@sect –  egreg Feb 25 at 20:24
    
@egreg Yes, you're right. I've added the missing patch. Thanks. –  Gonzalo Medina Feb 25 at 20:39

If this isn't too much of a nuisance...

\documentclass{sig-alternate}
\begin{document}

\section{Introduction}
\label{sec:introduction}
The introduction.

\def\x{\ref{sec:introduction}}
\section{The section after Section~\x}

\end{document}
share|improve this answer
    
Thanks! That works. I only need it in a few places, so it's not too much trouble. I'll accept this if no nicer solutions show up. –  Mangara Feb 25 at 18:56
    
@Mangara Gonzalo's solution is better, though it does require a package load. –  Steven B. Segletes Feb 25 at 19:18

After perusing the FAQ some more, I came across this answer, which gives another solution:

  • Download and incorporate the package lcsect.sty into your source .tex file.
  • Use the \lcsection command for sections, but convert the text to upper case by hand to stay consistent with the other titles.
\documentclass{sig-alternate}
\usepackage{lcsect}
\begin{document}

\section{Introduction}
\label{sec:introduction}

The introduction.

\lcsection{THE SECTION AFTER SECTION~\ref{sec:introduction}}

\end{document}
share|improve this answer

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.