1

I wanted to custom my index so I used a latex makeindex -s myfile.ist texfile.idx latex compilation.

myfile.ist contains :

% 
heading_prefix "{\\bfseries\\hfil "
heading_suffix "\\hfil}\\nopagebreak\n"
headings_flag 1

% 
delim_0 "\\dotfill"
delim_1 "\\dotfill"
delim_2 "\\dotfill"

my TeX file contains:

% arara: pdflatex: { synctex: on }
% arara: makeindex
% arara: pdflatex: { synctex: on }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[l2tabu, orthodox]{nag}  %
\documentclass[11pt,a4paper,openright]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{makeidx}
\usepackage{lipsum}


\makeindex

\author{Romain}
\title{Index Book}

\begin{document}

\maketitle
\frontmatter        

\chapter{Preface}
    \lipsum \index{preface}

\mainmatter         

\chapter{Intro}
    \lipsum \index{intro}

\appendix

\chapter{balala}
    \lipsum \index{annxes}


\chapter{balba}
    \lipsum \index{annxes} 

\backmatter
\chapter{epilogue}\index{epilogue}
    toto. 

    \printindex \label{index} 


\end{document}

And I get the error message: Undefined control sequence. \item preface \dotfill

I tried to remove delim_* "\\dotfill" or \index{preface}, in both case it works. So index in frontmatter and delim_* "\\dotfill" is compatible ?

2
  • 1
    also might be an idea to use \dotfill " notice the space.
    – daleif
    Nov 4, 2014 at 14:22
  • Thanks, that works perfectly! But can you explain to me why ?
    – R. N
    Nov 5, 2014 at 12:40

1 Answer 1

3

When I tried your code LaTeX complained that \dotfillii was not defined. Thus I concluded that the ii page number from the frontmatter was added directly after the addition of the delim_0.

I had a look in the generated .ind file and found

\begin{theindex}
{\bfseries\hfil A\hfil}\nopagebreak

  \item annxes\dotfill4, 6

  \indexspace
{\bfseries\hfil E\hfil}\nopagebreak

  \item epilogue\dotfill7

  \indexspace
{\bfseries\hfil I\hfil}\nopagebreak

  \item intro\dotfill2

  \indexspace
{\bfseries\hfil P\hfil}\nopagebreak

  \item preface\dotfillii

\end{theindex}

not the expected

\begin{theindex}
{\bfseries\hfil A\hfil}\nopagebreak

  \item annxes\dotfill 4, 6

  \indexspace
{\bfseries\hfil E\hfil}\nopagebreak

  \item epilogue\dotfill 7

  \indexspace
{\bfseries\hfil I\hfil}\nopagebreak

  \item intro\dotfill 2

  \indexspace
{\bfseries\hfil P\hfil}\nopagebreak

  \item preface\dotfill ii

\end{theindex}

Adding the space was the logical conclusion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .