# Ledmac \pagelinesep and Makeindex

I'm doing multiple indices for a document, using Ledmac with the Memoir class. By default, page and line numbers (produced using \edindex[]{}) are separated by a dash. I actually would like a colon instead. Ledmac documentation specifies that :

The page & linenumber combination is written as page\pagelinesep line, where the default definition is \newcommand{\pagelinesep}{-} so that an item on page 3, line 5 will be noted as being at 3-5. You can renew \pagelinesep to get a different separator (but it just so happens that - is the default separator used by the MakeIndex program)

So, I've tried with :

\renewcommand*{\pagelinesep}{:}


or with :

\renewcommand{\thepageline}{%
\thepage : \lineref{\edindexlab\thelabidx}


But, if, in both cases, the entries are correctly written in the .idx file, Makeindexrejects them, speaking of :

-- Illegal Arabic digit: position 3 in 60:741.

Also, I can't add space, or more than one characters, or I get :

Illegal space within numerals in second argument

I think the problem is with Makeindex rules, rather than Ledmac. Has anyone an idea ?

[Edit :] Here is a MWE

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ledmac}
\makeindex[names]

\renewcommand*{\pagelinesep}{:}

\begin{document}
\beginnumbering
\pstart
Here is my numbered text.\edindex[names]{text@Text}
\pend
\endnumbering
\printindex[names]
\end{document}


If I suppress \renewcommand*{\pagelinesep}{:}, everything works fine after the two pdflatex compilations, the makeindex one, and the last pdflatex compilation. Otherwise, I get the error I mentioned.

-
It is always best to compose a MWE that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. –  Peter Grill Oct 25 '11 at 16:24
It's done ! Thank you for pointing that out. –  Jean-Baptiste Camps Oct 26 '11 at 10:48

You have to prepare a MakeIndex style containing the two lines

page_compositor ":"
delim_r ":"


Save this as mystyle.ist in the same directory as your main file and call makeindex by

makeindex -s mystyle names


MakeIndex has two groups of string constants: input and output strings. For example the actual variable, default "@", tells MakeIndex that when it finds an entry of the form

\indexentry{abc@def}{1}


it will alphabetize the entry as if it were abc, but it will output def. When indexing LaTeX internal commands that can start with @, it's convenient to say

actual "="


in a style file, so that one can say in the document

\index{@ifundefined=\texttt{\string\@ifundefined}}


and MakeIndex will do the right thing.

In your case, ledmac uses \pagelinesep both for the document and the index production, so it's necessary to change page_compositor (default "-") so that it can interpret correctly

\indexentry{xyz}{1:2}


When MakeIndex detects a page range, it will output it with the page numbers separated by the string specified as value of delim_r (default "--"). Setting

delim_r ":"


we achieve our goal. Here we are setting an output related string.

There's a number of .ist files in <TeX>/makeindex (where <TeX> represents the main distribution tree on your machine) that can be studied.

-
Thanks, it works perfectly. Would you have some reference that you would recommend about writing .ist files ? –  Jean-Baptiste Camps Oct 28 '11 at 9:49
The primary reference is the "LaTeX Companion", but also texdoc makeindex.man1 is quite informative. –  egreg Oct 28 '11 at 10:12