ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan BRASLAU <alan.braslau@cea.fr>
To: ntg-context@ntg.nl
Subject: Re: Formatting Indexed Words Within the Text
Date: Fri, 23 Mar 2012 14:04:53 +0100	[thread overview]
Message-ID: <20120323140453.744bae2f@sole.extra.cea.fr> (raw)
In-Reply-To: <67926749-1A4E-4701-BCDC-86C2979590C0@stien.de>

On Fri, 23 Mar 2012 21:57:04 +1100
Malte Stien <malte@stien.de> wrote:

> Hi all,
> 
> Is it possible to format indexed words in a particular style within
> the text more or less automatically. For example, if I write
> 
>   There are some \index[ducks] in the zoo.
> 
> ...I would like the term "ducks" to appear in small-capitals to
> indicate the that term can be found in the index. Ideally, I'd like
> to do that without explicit manual formatting. Is that possible?
> 
> Thank you,
> Malte.

Your example above would not print the word "ducks" at all.


I commonly use:
\def\Index#1{\index{#1}#1}

There are some \Index{ducks} in the zoo.


In ConTeXt, text to be typeset typically appears within {}.
Of course, you can then modify the definition to format the text as you
wish:
\def\Index#1{\index{#1}\sc #1}

I'm sure that there is a more clever way.

Note that the \index{} command appears *before* the word, not after.
Otherwise, the word might get placed at the end of a page and the index
point to the following page. I believe that the \index{} command takes
care to avoid the opposite case.

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  parent reply	other threads:[~2012-03-23 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23 10:57 Malte Stien
2012-03-23 11:30 ` Rogers, Michael K
2012-03-23 13:04 ` Alan BRASLAU [this message]
2012-03-23 18:42 ` Hans Hagen
2012-03-24 10:20   ` Alan Braslau
2012-03-24 10:28     ` Hans Hagen
     [not found] <mailman.204.1332507708.3819.ntg-context@ntg.nl>
2012-03-24  4:19 ` Malte Stien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120323140453.744bae2f@sole.extra.cea.fr \
    --to=alan.braslau@cea.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).