[texhax] index entries in verbatim text?

E. Krishnan ekmath at asianetindia.com
Sat Oct 18 14:09:40 CEST 2008


On Fri, 17 Oct 2008, Ilya N. Golubev wrote:

> In latex document have large (possibly spanning many pages) stretches
> of verbatim text, something like program source, normally to be
> written inside `verbatim' environment.  Index entries are to point to
> locations in the middle of such text.
>
> Is there a way to write `\index' commands to achieve this?

Please see whether this helps:

   \usepackage{fancyvrb}

   \begin{Verbatim}[commandchars=\|\[\]]
   TEXT BEFORE
   LINE TO POINT TO|index[KEY]
   TEXT AFTER
   \end{Verbatim}

Note that here the default escape character \ is changed to | and the 
default argument delimiters  { and } are changed to [ and ] using 
"commandchars". You can use any other characters (including the default 
ones) for these as long as they don't appear in the verbatim text.






-- 
Krishnan


More information about the texhax mailing list