# [texhax] Help on cross-references

Fri Mar 13 21:42:59 CET 2009

What Christian wants (I believe) is for Equations to be labeled as (1), (2),
..., and within the same section in which they are first displayed, they
would be referred to as Equation (1), etc. When referring to Equations in a
different section, but in the same chapter, it would display Equation (1.2)
for the second equation in the first section. When referring to equations in
a different chapter, it would display Equation (1.2.3) for the third
equation in the second section of the first chapter.

Although I'm out of my league here, I envision a solution wherein you
redefine the \theequation command, and use the ifthen package to exame the
\section and \chapter of the current location, compare with the location of
the equation, and display different results accordingly. Something like:

\def\theequation {%
\ifthenelse{ \equal{\chapter}{\Eq_chapter} }% If same chapter
{\ifthenelse{ \equal{\section}{\Eq_section} }% and same section
{\equation}% print just the number.
{\Eq_section.\equation}% If different section, print section number as
well
}% If different chapter, print the chapter and section numbers
{\Eq_chapter.\Eq_section.\equation} }

Hopefully I closed all my brackets. The only thing that you're missing now
is how to figure out in what chapter/section an equation begins (I made up
the commands \Eq_chapter and \Eq_section). Hopefully someone else can post
that information.

Cheers,
Bob Wilson

On Fri, Mar 13, 2009 at 1:10 PM, Tom Schneider <toms at ncifcrf.gov> wrote:

> Christian:
>
> > Chapter 1
> >
> > text text text text
> > text text text text
> >
> > Section 1
> >
> > An equation
> >
> > 2+2 < 5                (1)
> >
> > A reference to the equation
> > now looks like: (1)
> >
> > Section 2
> >
> > text text text text
> > text text text text
> >
> > A ref to the equation
> > is now (1.1)
>
> This probably would give some readers a bit of confusion since the
> notation has changed.  I would design it to have the first reference
> be (1.1) [section.equation] in all cases.
>
> > Chapter 2
> >
> > text text text text
> > text text text text
> >
> > A ref to the equation
> > is now (1.1.1)
>
> At this point I'm completely confused.  The third time one
> would cite it as (1.1.1.1) and the fourth time (1.1.1.1.1)?
>
> (I'll let others say how to do these things technically.)
>
> Tom
>
>  Dr. Thomas D. Schneider
>  National Institutes of Health
>  National Cancer Institute
>  Center for Cancer Research Nanobiology Program
>  Molecular Information Theory Group
>  Frederick, Maryland  21702-1201
>  toms at ncifcrf.gov
>  permanent email: toms at alum.mit.edu
>  http://www.ccrnp.ncifcrf.gov/~toms/<http://www.ccrnp.ncifcrf.gov/%7Etoms/>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/