I want to create a range index for some part of my document. But when I do the following:
\documentclass{article}
\makeindex
\begin{document}
\index{test|(}
Some Text
\[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \ldots \]
\index{test|)}
\paragraph{Test2:} More Text after too much space.
\end{document}
there is too much vertical space in front of the paragraph "Test2". I tried using \leavevmode or \ignorespace as recommended in » \index causing spurious whitespace « but that did not work.
Please notice also that I'm putting this construction into an abstract environment definition, so the specifics of the section to be indexed or what comes after may change. So to make that clearer, the example above would take the form:
\documentclass{article}
\newenvironment{idx}[1]{%
\index{#1|(}%
\def\currentidx{#1}}%
{\index{\currentidx|)}}
\makeindex
\begin{document}
\begin{idx}{test}
Some Text
\[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \ldots \]
\end{idx}
\paragraph{Test2:} More Text after too much space.
\end{document}
\index{test|)}inside the math expression – Jun 20 '12 at 07:23