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{[email protected]}
}
\date{30 July 1999}

\maketitle

\section{Introduction}

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

1 Answer 1

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{[email protected]}
}
\date{30 July 1999}

\maketitle

\section{Introduction}

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

Works with or without \pagenumbering{arabic}.

2
  • Is there a version to test if a package was already loaded? A kind of \@ifloaded{}?
    – Sigur
    Feb 19, 2016 at 19:03
  • 1
    @Sigur \@ifpackageloaded{<package>}{<true>}{<false>}
    – egreg
    Feb 19, 2016 at 20:36

You must log in to answer this question.

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