TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 4 down vote accepted

\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.

share|improve this answer

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:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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