The \indextriple in the code below works for most operands, but it fails when one of the operands expands to contain the symbol \epi or \mon.

Error message

! Use of \@index doesn't match its definition.
\ifnextchar ...t \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.106       {into2@{$\into$}}

from the code

\usepackage{xparse} % loads expl3
%See interface3.pdf

%Remove when xybarr.tex bug fixed
\newdir_{ (}{{ }*!/-.5em/@_{(}}

% Select font for functions and sequences of functions
\newcommand \funcname [1] {\mathit{#1}}
\newcommand \funcseqname [1] {\bm{#1}}

\DeclareMathOperator \Functor {\mathop{\mathcal{F}}}

\DeclareMathOperator \head {\mathrm{head}}

\DeclareMathOperator \Hom {\mathrm{Hom}}

\DeclareMathOperator \Id {\mathrm{Id}}

\DeclareMathOperator \ID {\mathbf{Id}}

% suppress verbatim for \index
\newcommand \indexfold [1] {\index{#1}}

% Generate paired subindex entries
\newcommand \indexpair [2] {\index{#1!#2}\index{#2!#1}}

% Generate paired subsubindex entries 2!3, 3!2, 1!2!3, 1!3!2
\newcommand \indextriple [3]%

\newcommand \into {\!\mon}


\hypersetup {
      Author={Shmuel (Seymour J.) Metz},
      Keywords={fiber bundles,manifolds},
      Title={A guide to my private preamble macros}



\section {Symbols}

\begin{longtable}[t]{| l | l | p{2.9in} |}
  \multicolumn{3}{|c|}{\small\sl continued from previous page} \\
  Macro & Rendering & Meaning \\
  Macro & Rendering & Meaning \\
  \multicolumn{3}{|c|}{Symbols} \\
  \multicolumn{3}{|c|}{\small\sl continued on next page} \\
& $\into$
& Separate domain from range for monomorphism:
  $\backslash\mathrm{funcname}\{\mathrm{f}\}\  \backslash\mathrm{maps}\ \mathrm{A}\ \backslash\mathrm{into}\ \mathrm{B}$


  • do you really use all those packages in a single document? Apr 11, 2018 at 20:03
  • Yes, but that document is over 100 pages long.
    – shmuel
    Apr 11, 2018 at 20:20

2 Answers 2


that was far from a minimal example:-) but anyway the problem is the expansion of \into so you can make it a robust command by using

\DeclareRobustCommand\into {\!\mon}

instead of \newcommand


\into is not robust and needs protection, since the index macros are using non-verbatim mode.

  {into1@\textbackslash into}%

The .idx file contains:

\indexentry{into1@\textbackslash into!into2@$\into $|hyperpage}{1}
\indexentry{into2@$\into $!into1@\textbackslash into|hyperpage}{1}
\indexentry{Symbols!into1@\textbackslash into!into2@$\into $|hyperpage}{1}
\indexentry{Symbols!into2@$\into $!into1@\textbackslash into|hyperpage}{1}

Also a typewriter font is possible for the command \into:

  {into1@{\textbackslash into}}%

Result with

\usepackage[T1]{fontenc}% text font for \textbackslash
\usepackage[variablett]{lmodern}% variable width typewriter font


  • \into and \onto are intended for use in math mode; I would rarely, if ever, want a typewriter font.
    – shmuel
    Apr 11, 2018 at 20:24
  • @shmuel The typewriter font was not referring to math mode, but to the macro text representation (\into) and not the math symbol generated by the macro. But font choices are a matter of taste. Apr 11, 2018 at 20:45

You must log in to answer this question.

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