Text FormattingText in Subject index with multind.sty

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Zoran S
Posts: 9
Joined: Thu Dec 11, 2014 6:20 am

Text in Subject index with multind.sty

Post by Zoran S »

I try to make two indices at the end of the book. For one of them I would like to add some text right above the title. There is a simple example:

Code: Select all


\documentclass{book}

\usepackage{multind}\ProvidesPackage{multind}

\makeindex{first} \makeindex{second}

\begin{document}
test\index{first}{test}, some text test 2\index{second}{test 2} some text.

\indextext{I want this text above the title of the first index.}
\printindex{first}{First Index}
\printindex{second}{Second Index}
\end{document}

But I got the same text in both indices. So, how to restrict it to the first index only?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Text in Subject index with multind.sty

Post by Stefan Kottwitz »

Hi Zoran,

here is an example which patches \printindex.

Code: Select all

\documentclass{book}
\usepackage{multind}
\usepackage{etoolbox}
\newcommand*{\indextext}{text above the title of the first index\par}
\patchcmd{\printindex}{\Large\bf}{\indextext\Large\bf}{}

\makeindex{first} \makeindex{second}

\begin{document}
test\index{first}{test}, some text test 2\index{second}{test 2} some text.

\printindex{first}{First Index}
\renewcommand*{\indextext}{}
\printindex{second}{Second Index}
\end{document}
Stefan
LaTeX.org admin
Zoran S
Posts: 9
Joined: Thu Dec 11, 2014 6:20 am

Re: Text in Subject index with multind.sty

Post by Zoran S »

Package etoolbox error: Not running under E-Tex.

But I found another solution. Thanks!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Text in Subject index with multind.sty

Post by Stefan Kottwitz »

Hi Zoran,

most modern TeX installation use E-TeX. Which TeX are you using?
Zoran S wrote:But I found another solution.
how did you make it? It would be great if you would post it here. People are usually googling for solutions and may get here with a similar problem. If people would always just find "found it", "fixed it", without the actual solution, they might feel disappointed. ;-)

Stefan
LaTeX.org admin
Zoran S
Posts: 9
Joined: Thu Dec 11, 2014 6:20 am

Re: Text in Subject index with multind.sty

Post by Zoran S »

Hi Stefan,

You re correct about old version of MikTex. I had 2.2, today I upgrade it to 2.9. I also did not fix the problem correctly (in my way). I have just putted

printindex{first{First Index\\ \bigskip
\footnotesize{text above the title}}

This works unless I want to insert the title into the toc.

Now, I returned to your solution. It works in your simple example, but does not in my file. After I applied it I received the message:

! Latex Error: Command \indextext already defined

My documentclass is cambridge7A. If I rename \indextext to \indextextA, it compiles regularly, but does not produce the text above the title. In fact, what do I need is the text below the the title of the first index.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Text in Subject index with multind.sty

Post by Johannes_B »

Can you try to get us some useful code? Nicola Talbot describes the algorithm to get it at creating a minimal working example.

btw: Package multind is very very old. I suggest to have a look at splitindex and co.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Zoran S
Posts: 9
Joined: Thu Dec 11, 2014 6:20 am

Text in Subject index with multind.sty

Post by Zoran S »

I know about makeind, but this package is required by the publisher. Below you can see the code sample. Let someone insert what is needed.

Code: Select all


\NeedsTeXFormat{LaTeX2e}[1996/06/01]

  \documentclass{cambridge7A}

\usepackage{mathptmx, amsmath, amsfonts, amssymb, amstext}
\usepackage{multicol}

\usepackage[figuresright]{rotating}
\usepackage{rotating}
\usepackage{floatpag}
\rotfloatpagestyle{empty}


\usepackage{amsthm}
\usepackage{graphicx}


\def\makeRRlabeldot#1{\hss\llap{#1}}
\renewcommand\theenumi{{\rm (\roman{enumi})}}
\renewcommand\theenumii{{\rm (\alph{enumii})}}
\renewcommand\theenumiii{{\rm (\arabic{enumiii})}}
\renewcommand\theenumiv{{\rm (\Alph{enumiv})}}


\def\d#1{{\hspace{0.5mm}\raise0.7ex\hbox{-}\kern-0.5em #1}}



\def\Line{{\rm Line}}

\def\theendA{ \hfill $\square$  \medskip }
\def\theend{ \hfill $\blacksquare$  \medskip }

  \usepackage{multind}\ProvidesPackage{multind}
  \makeindex{subj}
  \makeindex{ineq}

  \usepackage[number=none]{glossary}


  \setcounter{tocdepth}{2}

  \newcommand\cambridge{cambridge7A}

\begin{document}

\title[]{\textsc{Inequalities for Graph Eigenvalues}}


\frontmatter \maketitle \tableofcontents


\mainmatter

\backmatter

\printindex{ineq}{Inequalities}


 \printindex{subj}{Subject Index}

\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Text in Subject index with multind.sty

Post by Johannes_B »

The example you just gave seems to be as old as multind itself. A lot of the commands therein became obsolete when multind did, back in 1994.

So i think, even though you are using a hack, it works.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply