There is the following code:

\subsection{some subsection}
Some \mindex[mean=aaa]{sentence} with some \mindex[mean=bbb]{unknown} words.

The expected output:

Some subsection

Some sentence with some unknown words.

Mini index: sentence - aaa unknown - bbb

I would like to create something like a mini index, which can create a small dictionary. All words from specific subsection which are arguments of \mindex[mean=something]{word} should be collected and when the command \listminiindexfromsubsection is written, then the output should contain all of these words with their meaning.

What is the method to collect specific words from a subsection and then printing them out?

  • Where is the \mindex command defined?
    – egreg
    Jun 16 '11 at 22:45
  • it's not yet defined, it's just example how it could be defined
    – scdmb
    Jun 16 '11 at 22:47

\newcommand{\mindex}[2]{\g@addto@macro\mindexlist{\textbf{#1} --- #2\par}#2}

Some \mindex{sentence}{aaa} with some \mindex{unknown}{bbb} words.


Some \mindex{sentence}{ccc} with some \mindex{unknown}{ddd} words.


Each \printmindex command resets the list.


Perhaps not as simple as you expected, but also not much difficult. You can use the glossaries package and create one glossary for each subsection:


 % Define new glossaries
\newglossary[sco]{seco}{oin}{ofi}{Short Index}
\newglossary[sct]{sect}{tin}{tfi}{Short Index}


% declare the entries
\newglossaryentry{seco:unk}{type=seco, name={unknown}, description={Not known}}

\newglossaryentry{seco:sen}{type=seco,name={sentence},description={Some description}}

\newglossaryentry{sect:rin}{type=sect,name={ring},description={Not known}}

\newglossaryentry{sect:gro}{type=sect,name={group},description={Simple structure}}


\section{Test section}

\subsection{First subsection}
This is a \gls{seco:sen} with some \gls{seco:unk} words.

\subsection{Second subsection}
A \gls{sect:rin} is an algebraic structure whose definition is not known; A \gls{sect:gro} is a simple algebraic structure.


The example (let's call the above document test.tex) can be compiled using:

(pdf)latex test
makeglossaries test
(pdf)latex test
(pdf)latex test

The result:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.