[texhax] conditional macros
Barry Dale
barryd at mtechIT.com
Thu Apr 29 03:59:01 CEST 2004
Of course...
Thanks :-)
--
Barry Dale
Technical Writer
M-Tech Information Technology Inc.
http://mtechIT.com http://psynch.com http://idsynch.com
--------------------------------------------
On Thu, 29 Apr 2004, Ross Moore wrote:
>
> On 29/04/2004, at 10:27 AM, Barry Dale wrote:
>
> > I seem to recall a discussion on this list recently about printing
> > terms in text in bold the first time they are used in a document, then
> > in normal font after that. I think the solution involved ifthen
> > commands.
> >
> > I have a similar situation. I use macros to insert boilerplate
> > responses to submitted questionaires. The macros can include graphics,
> > and can be used more than once. I would like the graphics to be
> > used only once (to save space and avoid multiple labels).
> >
> > Is there a way to check if a macro has already been used, and
> > treat it differently on subsequent uses?
>
> Yes, this is easy to do.
> Just make the macro redefine itself after the first usage.
>
> >
> > In other words, the macro \AnswerOne may be defined as:
> > \AnswerOne{%
> > text
> > text
> > \FigureOne{}
> > }%
> >
> > so that \FigureOne is expanded the first time but empty on subsequent
> > uses.
>
> e.g.
> \newcommand{\FigureOne}{... whatever you want ....
> \renewcommand{\FigureOne}{}}
>
> >
> > I'm familiar with basic LaTeX, but I'm not a programmer, so the
> > ifthen documentation is a little daunting. Sorry if it seems obvious.
>
>
> Easy, but not completely obvious. :-)
>
> Hope this helps,
>
> Ross Moore
>
>
> >
> > Many thanks
> >
> > --
> > Barry Dale
> > Technical Writer
> > M-Tech Information Technology Inc.
> > http://mtechIT.com http://psynch.com http://idsynch.com
> > --------------------------------------------
> >
> > _______________________________________________
> > TeX FAQ: http://www.tex.ac.uk/faq
> > TeX newsgroup: http://groups.google.com/groups?group=comp.text.tex
> > Mailing list archives: http://tug.org/pipermail/texhax/
> > More links: http://tug.org/begin.html
> >
> > Automated subscription management:
> > http://tug.org/mailman/listinfo/texhax
> > Human mailing list managers: postmaster at tug.org
> >
> ------------------------------------------------------------------------
> Ross Moore ross at maths.mq.edu.au
> Mathematics Department office: E7A-419
> Macquarie University tel: +61 +2 9850 8955
> Sydney, Australia fax: +61 +2 9850 8114
> ------------------------------------------------------------------------
>
More information about the texhax
mailing list