[comp.text] Cross Referencing in TeX

piaw@soda.Berkeley.EDU (Na Choon-Piaw) (11/16/89)

I'd like to know how to do cross-referencing in TeX.  Preferably
automatically.  For instance, I'd like to be able to say something like:

\beginsection{This is a test}
\label{foo}
\endsection
....
This is talked about in section{foo}

I'd like to be able to program TeX to do it.  (No, I hate LaTeX, and haven't
bothered replacing my manual since it got lost)  This would be useful for
things like computer manuals, or wargames rules, for instance.

I have no idea how to do it, other than by writing to a file, and that's kinda
messy:

1.1
title1
1.2
title2

And I can't do forward referencing in that case.

Ideas, suggestions?  I'd particularly like to know how LaTeX does it (no, I 
don't find that code readable...)

Na Choon Piaw
piaw@cory.berkeley.edu

spqr@ecs.soton.ac.uk (Sebastian Rahtz) (11/16/89)

>>>>> On 15 Nov 89 17:03:06 GMT, piaw@soda.Berkeley.EDU (Na Choon-Piaw) said:

 > I'd like to know how to do cross-referencing in TeX.  Preferably
 > automatically.  For instance, I'd like to be able to say something like:
.
.
.
 > I'd like to be able to program TeX to do it.  (No, I hate LaTeX, and haven't
 > bothered replacing my manual since it got lost)  This would be useful for
 > things like computer manuals, or wargames rules, for instance.
What is the point of Lamport writing a set of macros to implement
structured  writing on top of TeX, and then you asking for someone to
do it again?

 > I have no idea how to do it, other than by writing to a file, and
 > that's kinda messy:
thats how LaTeX does it. its the only way in TeX, so far as I can see;
it MUST involve two passes, in anybody's game, and its not
unreasonable to dump pass 1 onto disk, then read it in pass 2

--
Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)
Computer Science                       S.Rahtz@ecs.soton.ac.uk (Bitnet)
Southampton S09 5NH, UK                S.Rahtz@sot-ecs.uucp    (uucp)

piaw@soda.Berkeley.EDU (Na Choon-Piaw) (11/18/89)

In article <SPQR.89Nov16140043@caxton.ecs.soton.ac.uk> spqr@ecs.soton.ac.uk (Sebastian Rahtz) writes:

   What is the point of Lamport writing a set of macros to implement
   structured  writing on top of TeX, and then you asking for someone to
   do it again?

No, I'm not asking someone else to do it again, I'm going to do it myself. 
And if I recall right, LaTeX was never meant to be "a set of macros to
implement structured writing".  It was more like a Scribe clone than anything
else (at least, that's the way it looks to me --- feel free to correct
if I'm wrong).  In any case, LaTeX's defaults are real irritating to me, and
I'd rather just start from scratch and get rid of all that overhead involved
in using LaTeX than to try and tweak LaTeX's output routines to my liking.

The other objections I have about LaTeX is that:
	1)	It's too fragile for what I want to play with.
	2)	The only way to understand how it does what it does
		is to read that HUGE file that has all the code in it,
		and that's not something that appeals to me.
	3)	The LaTeX manual is not half as well written as the TeXbook.

The last statement, of course, is baised.

And of course, I prefer specialized macros for specialized tasks anyway. 
Putting the kitchen sink into a macro set is one sure way to step on your
own toes when you're not careful..

   thats how LaTeX does it. its the only way in TeX, so far as I can see;
   it MUST involve two passes, in anybody's game, and its not
   unreasonable to dump pass 1 onto disk, then read it in pass 2

Well, that wasn't my question.. But let it slide.. someone else answered
the question for me, anyway.  (Thanks everyone!)  It basically involves
writing to a file something like:

	\def\thelabel{Section number}

and then \inputing it back in at the beginning of the file.  (See the latest
issue of the TUGBOAT (Vol. 10 No. 2) for more details in the article 
entitled: \string and \csname in the tutorial section.)

I'm going to work out the details (as soon as I can find the time) and then 
hack on it for awhile.  Anyone who's interested can mail me for them.

   Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)

Na Choon Piaw
piaw@cory.berkeley.edu
"My opinions."
% flames >/dev/null
 

spqr@ecs.soton.ac.uk (Sebastian Rahtz) (11/19/89)

>>>>> On 18 Nov 89 09:02:19 GMT, piaw@soda.Berkeley.EDU (Na Choon-Piaw) said:

 > The other objections I have about LaTeX is that:
 > 	1)	It's too fragile for what I want to play with.
 > 	2)	The only way to understand how it does what it does
 > 		is to read that HUGE file that has all the code in it,
 > 		and that's not something that appeals to me.
 > 	3)	The LaTeX manual is not half as well written as the TeXbook.
you have some valid points; its worth noting that the proposals for
the new version of LaTeX include a) getting rid of the need for
\protect anywhere, and b) making the code more modular, for people to
take out the bits they want, such as cross-referencing.

The LaTeX Book is a manual for writers, not macro-writers; it is not
comparable to the TeX book, which is (in _my_ view) at all a good
reference book, however entertaining and full of brilliance it may be.

--
Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)
Computer Science                       S.Rahtz@ecs.soton.ac.uk (Bitnet)
Southampton S09 5NH, UK                S.Rahtz@sot-ecs.uucp    (uucp)