Formatting Indexed Words Within the Text
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.
On Mar 23, 2012, at 6:57 AM, Malte Stien wrote:
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.
One way is to use your own macro: \def\MyIndex#1{\index{#1}{\sc #1}} \starttext There are some \MyIndex{ducks} in the zoo. \stoptext By the way, your \index[ducks] didn't work for me the way I thought you wanted; I changed the [] to {} and added the word to the text body. As far as I can tell, \index only adds entries to the index register and not to the text. ________________________________ This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments).
On Fri, 23 Mar 2012 21:57:04 +1100
Malte Stien
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
On 23-3-2012 11:57, Malte Stien wrote:
s 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?
in the test suite: registers/processors-001.tex \defineprocessor[bf][style=bold] \defineprocessor[it][style=italic] \starttext \index{it->italic}\index{normal} This is a \index[bf->bold]{test with bold number}test. This is a less important \index{test}test. \placeindex \stoptext so the magic word is 'processors' ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Fri, 23 Mar 2012 19:42:38 +0100
Hans Hagen
in the test suite: registers/processors-001.tex
\defineprocessor[bf][style=bold] \defineprocessor[it][style=italic]
\starttext
\index{it->italic}\index{normal} This is a \index[bf->bold]{test with bold number}test. This is a less important \index{test}test.
\placeindex
\stoptext
so the magic word is 'processors'
Magic indeed! So processors can be used *wherever* text is to be typeset, as a prefix: name->text \defineprocessor[name][...,...=...,...] with keys: style=, color=, left=, right=, command= I'm not sure that I understand, but once I do, I'll have to add a wiki page... Alan
On 24-3-2012 11:20, Alan Braslau wrote:
On Fri, 23 Mar 2012 19:42:38 +0100 Hans Hagen
wrote: in the test suite: registers/processors-001.tex
\defineprocessor[bf][style=bold] \defineprocessor[it][style=italic]
\starttext
\index{it->italic}\index{normal} This is a \index[bf->bold]{test with bold number}test. This is a less important \index{test}test.
\placeindex
\stoptext
so the magic word is 'processors'
Magic indeed!
So processors can be used *wherever* text is to be typeset, as a prefix: name->text
\defineprocessor[name][...,...=...,...] with keys: style=, color=, left=, right=, command=
I'm not sure that I understand, but once I do, I'll have to add a wiki page...
not yet but they will be used for cases like this Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Alan Braslau
-
Alan BRASLAU
-
Hans Hagen
-
Malte Stien
-
Rogers, Michael K