I'm writing a document which references bug reports in Debian. The official format of a Debian bug report number is '#999999'. In order to make these numbers even more clearly Debian bug report numbers, in my document, I'm prefixing them whe 'BTS', so now they look like 'BTS#999999'. I would prefer to stick to this format instead of losing the '#' or the 'BTS'
When compiling to DVI, I get the following LaTeX error: you can't use `macro parameter character #' in horizontal mode \item BTS# 287585, 28 Sorry, but I'm not programmed to handle this case; I'll just pretend that you didn't ask for it. If you're in the wrong mode, you might be able to return to the right one by typing `I}' or `I$' or `I\par'. So I tried a couple of things. First Google led me to this: At http://theoval.sys.uea.ac.uk/~nlct/latex/novices/cantusehash.html I found some *TeX*-level advice to do backslash-prefixing. I could see this wasn't really going to work at LyX level, but I tried it. The result was that the index is generates, the index entry is correct, but the actual text in the body of the document has a backslash in front of it. I.e. ... see BTS\#287585 ... Index BTS#287585, 28 (Actually it's on page 27, but ... one thing at a time.) Second, the LyX wiki at http://wiki.lyx.org/Tips/Indexing suggested an ERT-based way to make indexes yourself, rather than letting LyX do it. But this did not go well: I inserted the following in the preamble: \newcommand{\index2page}{ \renewcommand{\indexname}{My second index} \printindex[index2] } \newcommand{\index2}[1]{\index[index2]{#1}} but immediately the syntax highlighting indicated that 'index2...' was being treated as 'index' + '2....' and compiling produced: LaTex Error: Command \index already defined. Fine. So I changed all occurences of 'index2' to 'indexa' in the preamble, in my ERT for the index entry and the ERT for the index itself. This was better, but still, I got: Undefined control sequence. with the ERT for the index itself '\indexapage' highlighted. But the entry defining this is in the preamble. (By putting a 'date >> /tmp/log' inside the script that the wiki says to create to generate the index, I determined that that script was never called before the above error occurred. Not sure if that's relevent.) Can anybody offer any advice please? Thanks! Alexis