Home > Archive > Tex > December 2005 > Using counters in different locations in a document ...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using counters in different locations in a document ...
|
|
| fivenastydisco@hotmail.com 2005-12-15, 7:58 am |
| I'm trying to use a counter to place a number in a number of locations
within a use case document, so that if one of these numbers changes,
the change is reflected elsewhere in the document. For example:
using the format Section-ID-x , where x is a number that autoincrements
when a new section is created, e.g.
Section-ID-1
Section-ID-2
Section-ID-3
.... document body ...
Section-ID-1-Test
Section-ID-2-Test
Section-ID-3-Test
What I want to know is, if I deleted Section-ID-1 and
Section-ID-1-Test, is there anyway to get LaTeX to automatically
decrement the remaining sections: i.e.
Section-ID-2 becomes Section-ID-1
Section-ID-2-Test becomes Section-ID-1-Test
etc
Any ideas?
Thanks in advance!!
Jack
| |
| Ulrike Fischer 2005-12-15, 7:58 am |
| fivenastydisco@hotmail.com schrieb:
> I'm trying to use a counter to place a number in a number of locations
> within a use case document, so that if one of these numbers changes,
> the change is reflected elsewhere in the document. For example:
>
> using the format Section-ID-x , where x is a number that autoincrements
> when a new section is created, e.g.
>
> Section-ID-1
> Section-ID-2
> Section-ID-3
>
> ... document body ...
>
> Section-ID-1-Test
> Section-ID-2-Test
> Section-ID-3-Test
>
> What I want to know is, if I deleted Section-ID-1 and
> Section-ID-1-Test, is there anyway to get LaTeX to automatically
> decrement the remaining sections: i.e.
>
> Section-ID-2 becomes Section-ID-1
> Section-ID-2-Test becomes Section-ID-1-Test
> etc
>
LaTeX is doing this all the time. Look at the tableofcontents, look at
\label/\ref, look at the header.
If you want more specific advice, you will have to sent more specific
information, e.g. a complete minimal example.
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
| |
| fivenastydisco@hotmail.com 2005-12-15, 7:58 am |
| What I'm trying to achieve is:
\subsection{SectionName-UniqueID-x}
%subsection text
% ... repeats
\subsection{SectionName-UniqueID-x-Test}
.... so that the x's stay in sync. throughout the document. Does this
help?
| |
| Robin Fairbairns 2005-12-15, 7:58 am |
| In article <1134647979.585522.28290@g47g2000cwa.googlegroups.com>,
fivenastydisco@hotmail.com writes:
>What I'm trying to achieve is:
>
>\subsection{SectionName-UniqueID-x}
>%subsection text
>
>% ... repeats
>
>\subsection{SectionName-UniqueID-x-Test}
>
>... so that the x's stay in sync. throughout the document. Does this
>help?
it doesn't help much with understanding your motivation. however:
....
\newcounter{xcounter}
....
\begin{document}
....
\refstepcounter{xcounter}
\label{this-value-of-xcounter}
\subsection{SectionName-UniqueID-\thexcounter}
....
\subsection{SectionName-UniqueID-\ref{this-value-of-xcounter}-Test}
....
--
Robin Fairbairns, Cambridge
| |
| fivenastydisco@hotmail.com 2005-12-15, 7:58 am |
| Thanks for the pointers -- here's a little more about what I'm trying
to achieve:
I have a use case document, where in one section of the document I have
a use case, called for example "App-BR-UseCase-1: Get results". Later
on in the document, I will have a number of test cases which need to
reference this use case -- for example, "App-BR-UseCase-1-TestCase-1".
A use case may have a number of test cases associated with it, e.g.
App-BR-UseCase-1-TestCase-1, App-BR-UseCase-1-TestCase-2, etc.
The use cases are numbered in increments of one, e.g. App-BR-UseCase-1,
App-BR-UseCase-2, ... App-BR-UseCase-n, etc. What I want to be able to
do is link the Test Cases to the Use Case numbers, so if a use case is
removed, the numbering of the remaining use cases and their associated
test cases are automatically updated to reflect the changes.
Does this help/make sense?
Jack
| |
| Ulrike Fischer 2005-12-15, 7:58 am |
| fivenastydisco@hotmail.com schrieb:
> Thanks for the pointers -- here's a little more about what I'm trying
> to achieve:
>
> I have a use case document, where in one section of the document I have
> a use case, called for example "App-BR-UseCase-1: Get results". Later
> on in the document, I will have a number of test cases which need to
> reference this use case -- for example, "App-BR-UseCase-1-TestCase-1".
> A use case may have a number of test cases associated with it, e.g.
> App-BR-UseCase-1-TestCase-1, App-BR-UseCase-1-TestCase-2, etc.
>
> The use cases are numbered in increments of one, e.g. App-BR-UseCase-1,
> App-BR-UseCase-2, ... App-BR-UseCase-n, etc. What I want to be able to
> do is link the Test Cases to the Use Case numbers, so if a use case is
> removed, the numbering of the remaining use cases and their associated
> test cases are automatically updated to reflect the changes.
>
> Does this help/make sense?
What's wrong with the code Robin sent you?
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
|
|
|
|
|