0

A stub of my document:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{makeidx}
\makeindex

\begin{document}

\chapter{MyChapter}
This is a\index{A} test\index{\lstinline{TEST}}.

\printindex

\end{document}

I am compiling with pdflatex and makeindex.

I would like to use \lstinline{} for formatting some keywords at the index. My problem is that there is a wrong order at the index. TEST is ordered before A.

Is there a way to achieve that TEST would be ordered the right way?

1 Answer 1

1

That's the wrong way to apply special formatting to an index. You need to use the key@visual syntax:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{imakeidx,listings}
\lstset{basicstyle=\ttfamily}
\makeindex

\begin{document}

\chapter{MyChapter}
This is a\index{A} test\index{TEST@\lstinline{TEST}}.

\printindex

\end{document}

enter image description here

You must log in to answer this question.

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