6

The sig-alternate class by default disables page numbers, which breaks mparhack (amongst other things).

How can I include tex code only if \thepage is properly defined? I tried \ifcsname and \ifcsempty of etoolbox, but neither worked.

MWE:

\documentclass{sig-alternate}

%\pagenumbering{arabic}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{mparhack}

\begin{document}

\title{A Sample {\ttlit ACM} SIG Proceedings Paper in LaTeX}

\numberofauthors{1} 
\author{
\alignauthor
Ben Trovato\titlenote{Dr.~Trovato insisted his name be first.}\\
       \affaddr{Institute for Clarity in Documentation}\\
       \affaddr{1932 Wallamaloo Lane}\\
       \affaddr{Wallamaloo, New Zealand}\\
       \email{trovato@corporation.com}
}
\date{30 July 1999}

\maketitle

\section{Introduction}

The \textit{proceedings} are the records of a conference.
\end{document}
  • Try expl3 and the command IfNoValueTF, from http://tex.stackexchange.com/questions/9540/parsing-optional-macro-arguments?rq=1. This requires the xparse package. – 1010011010 May 08 '14 at 08:30
  • No success, IfNoValueTF always goes into the false-branch. – Cephalopod May 08 '14 at 08:50

1 Answers1

3

Use \@ifundefined:

\documentclass{sig-alternate}
%\pagenumbering{arabic}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{mparhack}

\makeatletter
\@ifundefined{thepage}{\def\thepage{\arabic{page}}}{}%
\makeatother

\begin{document}
\title{A Sample {\ttlit ACM} SIG Proceedings Paper in LaTeX}

\numberofauthors{1}
\author{
\alignauthor
Ben Trovato\titlenote{Dr.~Trovato insisted his name be first.}\\
       \affaddr{Institute for Clarity in Documentation}\\
       \affaddr{1932 Wallamaloo Lane}\\
       \affaddr{Wallamaloo, New Zealand}\\
       \email{trovato@corporation.com}
}
\date{30 July 1999}

\maketitle

\section{Introduction}

The \textit{proceedings} are the records of a conference.
\end{document}

Works with or without \pagenumbering{arabic}.

egreg
  • 1,121,712