English 中文(简体)
How to number nonconsecutive addenda in LaTeX without disrupting original Theorem numbering?
原标题:

I am writing a thesis heavy with Definitions, Theorems, Lemmas and the like. I need to give a basic definition of a concept, and then later in the thesis expand on this definition as more parameters add to the complexity and thus to the definition. So I need something which would look (structurally) like this:

Definition 1

Definition 2

Definition 3

Addendum 1.a (Referring to Definition 1)

Addendum 1.b (Referring to Definition 1 )

Definition 4

Addendum 1.c (Referring to Definition 1)

Addendum 3.a (Referring to Definition 3)

Definition 5

I can t seem to find anything that will let me do this. Does anyone have an idea?

问题回答

In preambule:


ewtheorem{Definition}{Definition}

ewtheorem{Addendum}{Addendum}[Definition]
def	heAddendum{	heDefinition .alph{Addendum}}

Main text:


ewcountsaveDefCounter

egin{Definition} ... end{Definition}
egin{Definition} ... end{Definition}
egin{Definition} ... end{Definition}

saveDefCounterarabic{Definition}
setcounter{Definition}{1}

egin{Addendum} ... end{Addendum}
egin{Addendum} ... end{Addendum}

setcounter{Definition}{saveDefCounter}

egin{Definition} ... end{Definition}
egin{Definition} ... end{Definition}

Based on Alexey s answer, try

documentclass{article}

ewtheorem{Definition}{Definition}

makeatletter

ewenvironment{add}[1]{ % environment has one required arg, a label to follow
  @ifundefined{c@add@#1}{ % does a private counter exist for the label?
    
ewcounter{add@#1} % define if not
  }{ % do nothing if it does
  }
  stepcounter{add@#1}
  @begintheorem{Addendum}{
ef{#1}.csname theadd@#1endcsname}ignorespaces
  % use latex internal macro to write the theorem start environment
}{ % end the environment
  @endtheorem
}
makeatother

egin{document}

egin{Definition}label{def1} ... end{Definition}
egin{Definition}label{def2} ... end{Definition}
egin{Definition}label{def3} ... end{Definition}


egin{add}{def1} ... end{add}
egin{add}{def2} ... end{add}
egin{add}{def1} ... end{add}


egin{Definition} ... end{Definition}
egin{Definition} ... end{Definition}
end{document}

The add environment must get a label specifying the definition to which it is to append. Put the bit between makeatletter and makeatother in a style file if you want to make it reusable.





相关问题
Effective Version Control for Slides

I have to maintain a huge set of training material in forms of slides. At a first glance, I ve noticed there s no support for version control in OpenOffice OOImpress (but I might be wrong on this). ...

Maths in LaTex table of contents

I am trying to add a table of contents for my LaTex document. The issue I am having is that this line: subsubsection{The expectation of (X^2)} Causes an error in the file that contains the ...

Using vim s `gqap sometimes indents unusually

For the life of me, I cannot figure out the cause of this: when writing in LaTeX documents, I like to keep my line width to maximum of 80 characters. As such, I will execute the vim command gqap and ...

aligning math equations in Latex

I am trying to align the following equations around the equal sign. What can I do? Thanks! I am using the AMSMath package $$mddot{x}_{1}-K(x_{2}+x_{12})+C(dot{x}_{12}+dot{x}_{2})+2Cdot{x}_{1} ...

LaTeX output does not update

I have just begun using LaTeX. I am working in Windows and am using TeXnicCenter as my editor. When I build and output, having the following code: documentclass{article} egin{document} This is a ...

How to put line break in a math

I d like to express the following sentence (source_location is also italic, it s not correctly rendered): Each entry has a list of tuple: < source_location, R/W, trip_counter, occurrence, killed ...

热门标签