0

I am using a bespoke document class which I have not developed.

When declaring theorems or lemmas within the main body, the counter is correctly associated to the subsection number with no further qualifiers e.g. Theorem 1.2.

However when doing so in the appendix, I am getting the following format e.g. Lemma Appendix A.2. The word "Appendix" is undesired in here.

How can I get rid of it? Not sure where I need to look at in the bespoke class; the following definitions are included:

\def\@xthm#1#2{\@begintheorem{#2}{\csname the#1\endcsname}{}\ignorespaces}
\def\@ythm#1#2[#3]{\@opargbegintheorem{#2}{\csname the#1\endcsname}{#3}\ignorespaces}

as well as for \@begintheorem; \@opargbegintheorem; and \@endtheorem. But I see no counter definition.


Edit: I have included some MWE as suggested, where I display the relevant definitions for theorem-like environments. But because I am using a proprietary bespoke class, as specified at the top of the question, the below code does not reproduce the error.

\documentclass{article}

\def\@xthm#1#2{\@begintheorem{#2}{\csname the#1\endcsname}{}\ignorespaces}
\def\@ythm#1#2[#3]{\@opargbegintheorem{#2}{\csname
        the#1\endcsname}{#3}\ignorespaces}%
%
\let\Theoremfont\itshape
%
\let\Theoremheadfont\bfseries
%
\def\@begintheorem#1#2#3{\par\addvspace{8pt plus3pt minus2pt}%
    \noindent{\csname#1headfont\endcsname#1\ \ignorespaces#3 #2.}%
    \csname#1font\endcsname\hskip6pt\ignorespaces}
\def\@endtheorem{\par\addvspace{8pt plus3pt minus2pt}\@endparenv}
%
\def\@opargbegintheorem#1#2#3{\par\addvspace{6pt plus3pt minus2pt}%
    \def\@tempa{#3}%
    \noindent{\bf #1 #2 \ifx\@tempa\empty\unskip\else\unskip\ (#3).\fi\hskip.5em}\csname#1font\endcsname\ignorespaces
    %   \noindent{\bf #2 \ifx\@tempa\empty\unskip\else\unskip: #3\fi\hskip1em}\it
    \ignorespaces}

%
\def\@endtheorem{\par\addvspace{6pt plus3pt minus2pt}}
%
%\newtheorem{theorem}{Theorem}[section]
%
\newif\iflogo
\def\prbox{\par
    \vskip-\lastskip\vskip-\baselineskip\hbox to \hsize{\hfill\fboxsep0pt\fbox{\phantom{\vrule width5pt height5pt depth0pt}}}\global\logofalse}

\begin{document}
    \appendix
    \section{Appendix}
    \subsection{First Appendix}
    \begin{theorem}
        Latex is useful.
    \end{theorem}
\end{document}
2
  • 1
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for the users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Commented Mar 30 at 16:20
  • @samcarter_is_at_topanswers.xyz I did not include the class because the problem would not be reproducible, as I am having to use some bespoke template. I think the solution by jlab is probably the most hassle-free considering the circumstances. Commented Mar 30 at 16:27

2 Answers 2

2

Without knowing the full definitions set by the class, you can redefine the commands that print the numbers in the appendix:

\appendix
\renewcommand{\thetheorem}{\Alph{chapter}.\arabic{theorem}}
\renewcommand{\thelemma}{\Alph{chapter}.\arabic{lemma}}
4
  • Thank you @jlab. I was hoping for something "cleaner" i.e. a global setting but considering I am having to use some bespoke class with non-standard settings, this is probably the most effective solution all in all. Cheers. Commented Mar 30 at 16:25
  • A downside of this approach is that it treats a symptom rather than the cause of the problem. As a result, if the appendix sections contain proposition, corollary, equation, etc environments, their respective associated \the<counter> macros will also have to be modified. In a subsequent answer, the OP revealed that the \appendix-related code in the bespoke cls file contains the highly problematic instruction \renewcommand\thesection{\appendixname\ \Alph{section}}. A better solution is suggested here.
    – Mico
    Commented Jun 13 at 2:50
  • 1
    @Mico You right, but I posted my answer before the OP edited his question. In the first version we know nothing about the "bespoke class" (see also his comment).
    – jlab
    Commented Jun 13 at 4:57
  • @jlab - Good point! I'll take down this comment (but will leave the one I posted below the OP's own answer).
    – Mico
    Commented Jun 13 at 4:59
0

I ended up finding the following code in the bespoke cls file:

\newcounter{appendix}
\newcommand\appendix{\par
    \refstepcounter{appendix}
    \setcounter{section}{0}
    \setcounter{lemma}{0}
    \setcounter{theorem}{0}
    \setcounter{equation}{0}
    \@addtoreset{equation}{section}
\renewcommand\thesection{\appendixname\ \Alph{section}}
\renewcommand\thesubsection{\Alph{section}.\arabic{subsection}}
\renewcommand\theequation{\Alph{section}.\arabic{equation}}}%

To solve the issue, it sufficed to add the following two lines inside the definition of the appendix counter, which correspond to the ones suggested by @jlab (although here the behaviour is set at global level):

\renewcommand\thetheorem{\Alph{section}.\arabic{theorem}}%
\renewcommand\thelemma{\Alph{section}.\arabic{lemma}}%

Voilà.

1
  • This approach treats a symptom rather than the root cause of the problem, which lies in the instruction \renewcommand\thesection{\appendixname\ \Alph{section}}. A better solution is suggested here.
    – Mico
    Commented Jun 13 at 2:55

You must log in to answer this question.

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