3

I'm using the knowledge package to mark definitions and simplify the creation of an index.

My entries are all defined as in the following example:

\documentclass{book}    
\usepackage[paper,makeidx]{knowledge}
\makeindex

\knowledge{index style=textbf,index=time!sidereal}
 | sidereal time
 | Sidereal time
\knowledge{index style=textbf,index=time!solar}
 | solar time
 | Solar time

\begin{document}
\intro{Sidereal time} is defined as a thing.
\newpage
If you remember, \kl{sidereal time} is a thing.
\newpage
Stuff\index{time} is still a thing. \kl{Solar time} is something else.

\printindex

\end{document}

This results in the following index entry:

time, 3

sidereal, 1, 2

solar, 2

The \intro term for "sidereal time" is on page 1, while the remaining references are a \kl entry and a simple \index entry.

There's no \intro term (i.e. a definition) for "solar time".

I would like the \intro terms to be the only ones referenced in bold.

I found this customization example in the knowledge package documentation but it changes both \intro and \kl:

\def\knowledgeIntroIndexStyle#1{\fbox{#1}}

How can I differentiate the \intro style (automatically or even only partially automatically)?

5
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – DG'
    Apr 22 at 12:49
  • To clarify, why I'm using the knowledge package: it allows me to mark definitions in my textbook (I have hundreds) just with the \intro, then I periodically populate the preamble with the intros list from a .diagnose file created by the package; then with a bit of vim magic I get a proper list and a working index mid-draft without the hassle of writing single \index entries (that will happen later to finalize the index).
    – armaninux
    Apr 22 at 14:17
  • 1
    The command \knowledgeIntroIndexStyle is defined by the knowledge package, but I didn't find where it is used it in its source code.
    – jlab
    Apr 22 at 15:33
  • @jlab in fact it's not described in the documentation either and I thought a counterpart kl style might exist too
    – armaninux
    Apr 22 at 16:07
  • 1
    @armaninux kl style is set by the style key (see documentation, section 3.3.4 Knowledge styles and the \knowledgestyle command).
    – jlab
    Apr 22 at 16:18

1 Answer 1

4

It works if you set it through a style. Define the style

\knowledgestyle{indexbf}{index style=textbf}

and use it as intro style

\knowledge{intro style=indexbf, index=time!sidereal}
...

Note that you can also set it by default

\knowledgedefault*{intro style=indexbf}

Full example:


\documentclass{book}
\usepackage[paper,makeidx]{knowledge}
\makeindex

\knowledgestyle{indexbf}{index style=textbf}
\knowledgedefault*{intro style=indexbf}

\knowledge{index=time!sidereal}
 | sidereal time
 | Sidereal time
\knowledge{index=time!solar}
 | solar time
 | Solar time

\begin{document}
\intro{Sidereal time} is defined as a thing.
\newpage
If you remember, \kl{sidereal time} is a thing.
\newpage
Stuff\index{time} is still a thing. \kl{Solar time} is something else.

\printindex

\end{document}

Full example

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .