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.

Can someone please tell me how to make definitions, theorems etc. in the appendix look like Definition A1 or Definition 1A (an "A" should be somewhere), if the appendix is "numbered" with A (meaning latex shows A Appendix, if I compile the document). Right now all the definitions, theorems etc.are numbered from 1 to n, where n is the last definition, theorem etc. of my document (sections don't change the numbering), even if this last one is in the appendix.

Equation numbering is ok though; the first numbered equation is "A.1".

The thing is, I'm using LyX, so I would prefer it, if there were some command that I could use to reset the counter and globally change the look of definitions, theorems etc. in the appendix, so that I

1) don't have to remove all the LyX-created environments (like for example the LyX-created definition environment) and replace them by hand-coded ones in order to maybe pass some additional arguments to each them, because that looks horrible in LyX.

2) don't have to use a different way to insert the appendix other then the one LyX provides and that is via \appendix (not via the appendix package).

FYI: I'm using LyX 2; the document class is article; my appendix is situated after several sections (I don't used any other divisioning of my document like subsections etc. - if that makes any difference).

share|improve this question

1 Answer 1

up vote 9 down vote accepted

Add the following code to the preamble settings of your LyX document:

\usepackage{chngcntr}

In the document body, add the following "Evil Red Text" (LaTeX code) immediately after \appendix to effect the desired change for an environment called thm:

\counterwithin{thm}{section}
% \renewcommand{\thethm}{\thesection\arabic{thm}}% optional

You'll have to check your preamble for the existing theorem-like environments and their names (AFAIK, this depends on the loaded LyX modules) and apply the above code for every environment.

Here's a compilable example:

\documentclass{article}

\newtheorem{thm}{Theorem}

\usepackage{chngcntr}

\begin{document}

\section{First}

\begin{thm}
A theorem.
\end{thm}

\section{Second}

\begin{thm}
Another theorem.
\end{thm}

\appendix

\counterwithin{thm}{section}
% \renewcommand{\thethm}{\thesection\arabic{thm}}% optional

\section{App-First}

\begin{thm}
An appendix theorem.
\end{thm}

\section{App-Second}

\begin{thm}
Another appendix theorem.
\end{thm}

\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.