[OS X TeX] Only referencing once
Ross Moore
ross at ics.mq.edu.au
Mon Jul 1 04:15:51 EDT 2002
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi;
>
> I'm looking for a package (or a macro command) to have the following
> capability:
>
> I have command which I used throught my PhD to typeset standard words
> (like program names), so that they will be always typed the same, and
> referenced in the index. On top of that I would like that a
> bibliographic reference be added the FIRST time the program name appear
> in the document. The best for me would be to have a command used this
> way:
>
> \newcommand{\Foo}{\firt{{Foo \index{Foo} \cite{foo:program}},{Foo
> \index{Foo}}}}
Interesting problem.
This could be done by making the command redefine itself, the first
time it is used.
e.g.
\newcommand{\Foo}{Foo\index{Foo}~\cite{foo:program}%
\gdef\Foo{Foo \index{Foo}}}
or slightly shorter and neater:
\newcommand{\Foo}{\gdef\Foo{Foo\index{Foo}}\Foo~\cite{foo:program}}
However, there is a problem with this approach if the command \Foo
is used within a figure/table caption, or section-title.
or anything else that puts \Foo into the .aux file of your document.
In that case, the first \Foo will occur within the document-preamble,
--- well, actually as the \begin{document} is encountered --
or in the Table-of-Contents or List of Figures.
In these cases the first index reference and the citation will point
to page 1, or the page where the Contents/Figures listing occurs.
Thus a more sophisticated macro-definition would involve a test
for whether we are beyond the preamble or Preface, and branch
its behaviour accordingly.
For example, you could test the page-number, or the page-numbering
style if this changes between front-matter and main-matter.
> Or eventually giving one more argument, giving a name for the variable
> (counter, boolean???) holding the number of time the command appeared.
>
> Thanks for any info/help.
Hope this helps,
Ross Moore
>
> Serge.
>
> - ----------------------------------------------------
> Serge Cohen
>
> GPG Key ID: 1024D/69B1D346
> - ----------------------------------------------------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (Darwin)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE9GyXFMygj1Wmx00YRAuWKAJ901R5GD5Lk8H+NbLTAwGb3hcILKgCaAu0e
> Dy2Z413KxfRbGSsuaxhcJSw=
> =vzG3
> -----END PGP SIGNATURE-----
>
>
> -----------------------------------------------------------------
> Threaded list archives can be found at:
> <http://www.masda.vxu.se/~pku/MacOSX_TeX/>
> -----------------------------------------------------------------
> To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
> "unsubscribe macosx-tex" (no quotes) in the body.
> For additional HELP, send email to <info at email.esm.psu.edu> with
> "help" (no quotes) in the body.
> -----------------------------------------------------------------
-----------------------------------------------------------------
Threaded list archives can be found at:
<http://www.masda.vxu.se/~pku/MacOSX_TeX/>
-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
-----------------------------------------------------------------
More information about the MacOSX-TeX
mailing list