MWE showing one of my indexing problems [ALL PROBLEMS SOLVED]
Steve Litt
slitt at troubleshooters.com
Sat Dec 11 09:01:41 UTC 2021
Herbert Voss said on Fri, 10 Dec 2021 10:14:29 +0100
>Steve Litt via lyx-users schrieb:
>> Attached please find mwe.lyx and mwe.pdf, which was created by
>> mwe.lyx. This document is standard book class, sized 6 inches high
>> by 4 inches wide to fit on reasonably sized mobile devices. The
>> symptom is that index item "Incremental/Differential Learning" spans
>> about 35 pages, but there's no index begin tag on the first of those
>> pages, or anywhere near it. You can read the rest of the symptom
>> description as chapter 1 of the actual document.
>>
>> I could have refined it further, but after 3 days I'm so punch drunk
>> I was afraid I'd make the symptom vanish and have to start all over
>> again, so if some of you could take a look at it, I'd be very
>> grateful.
>
>do not write an \index command into a sectioning command. Use it after
>such a command. See image
>
>Herbert
Thanks Herbert,
Moving all index commands from the headline to the text immediately
following solved most of of the problems.
And thanks to all the rest of you who helped me.
Stephan Witt recommended looking at the .ilg file. Unfortunately, for
some reason I haven't figured out yet, my shellscript didn't create a
.ilg file, so I just figured there were no warnings (bzzt, wrong).
Then I compiled using el's command:
lyx -f -e luatex lawnmower.lyx && latexmk -lualatex lawnmower.tex
The preceding command gave me a .ilg file with tens or maybe over 100
warnings, and I just didn't think that was possible, because I hadn't
wrongly interlaced anything or used a |( where I was supposed to use a
|).
After I fixed the MWE according to Herbert's advice and compiled with
el's command, I got no warnings in the .ilg.
Armed with such knowledge, I pulled up the real file and, chapter by
chapter, moved any \index commands on headlines to the start of the
text immediately below them. With each chapter so fixed, there were
less and less warnings in the .ilg. Once I'd fixed all the chapters,
the .ilg contained no warnings.
But wait, there's more. Once I got to that point, I had to uncomment
the \input{./seealso.inc} from the layout file. This immediately
produced several warnings of the type:
"Conflicting entries: multiple encaps for the same page under same key"
Ugh! A suitable period of web searching and experimentation brought me
to the conclusion that the following seealso.inc lines, although they
appear logical and correct, produce the preceding error message:
\index{Mental Model!Runit|see{Runit}}
\index{Mental Model!Runit|seealso{ runsv}}
You can't have one lookup phrase produce multiple references. So
instead, you need to incorporate this one inobvious command to replace
the preceding two:
\index{Mental Model!Runit|see {Runit,}, \seealso{runsv}}
Notice the following:
* "Runit," contains a comma that shows through in the index.
* The comma after the closing brace on "{Runit,}," is necessary
* The space after the comma after the closing brace prevents the
seealso from butting up against the comma in "Runit,"
* The seealso must be in command form (\seealso)
Uuuuugly, but it works.
A slightly less challenging requirement is what seems like would be
expressed like the following:
\index{Runit|seealso{runsv}}
\index{Runit|seealso{Runit=>lessons learned}}
But once again, "Conflicting entries: multiple encaps for the same page
under same key", for the exact same reasons: One lookup phrase with
multiple references. Fortunately, because these are both seealso instead
of one of each, the solution is simpler:
\index{Runit|seealso{runsv, Runit=>lessons learned}}
For some reason I'll never understand, the following produces some, but
not all, pages that are off by a page or two:
====================================
lyx -f --export luatex lawnmower.lyx
lualatex lawnmower.tex
makeindex lawnmower.idx
luatex lawnmower.tex
====================================
So instead I use el's method, which appears to give correct page
numbers every time:
====================================
lyx -f --export luatex lawnmower.lyx
latexmk -gg -lualatex lawnmower.tex
====================================
One thing I learned the hard way is what Stephan Witt told me: From the
very first index mark or index range, look at your .ilg file and get
rid of all errors and warnings before going on. When warnings get too
numerous, debugging becomes like swimming through molasses.
I put this all into a shellscript, which repeatedly deletes all
intermediate files, does a texhash, a LyX reconfigure, lyx export and
latexmk, displaying the .ilg file with line numbering in the less
command on the CLI, and displaying the resulting PDF in the GUI. Each
compile takes a little longer with all that stuff in there, but I'm
guaranteed that whether the change I made was installation of a new TeX
package, changing my layout file, or just changing the LyX file, all
will be regenerated and accounted for. I just keep pressing Enter every
time I want a new compile.
Thanks for all the help everybody!
SteveT
Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques
More information about the lyx-users
mailing list