MakeIndex, Nomenclature, Glossaries and Acronyms ⇒ Forcing a blank index line alphabetically
Forcing a blank index line alphabetically
However, I would like a solution that is handled at the source file level. Something like \indexspace{masquerades as} where "masquerades as" would indicate where, in alphabetical order, the blank space should reside.
For example, I have the index entries
cable
cat
coin
but want a space between cable and cat. I would like to add this to my source file:
\indexspace{cac}
(cac is not a valid word, but it lands where I want a blank line).
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Forcing a blank index line alphabetically
Code: Select all
\documentclass{article}\usepackage{makeidx}% You could add this to your .ist file, if you're using one (makeindex -s .ist); .mst is loaded by makeindex automatically, if it has the same basename as the file to be processed (unless suppressed via -s argument):\begin{filecontents*}{\jobname.mst}delim_0 "\\idxcomma"delim_1 "\\idxcomma"delim_2 "\\idxcomma"\end{filecontents*}\makeindex\newif\ifidxskippage %flag for skipping over page entry ... and its delimeter\newcommand*\skipindex[1]{%\index{#1@\protect\idxskippagetrue~|skippageentry}%% this reads: create an index under #1 (`cac' in this example), set the skipping flag, use a non-breaking space as entry, and use \skippageentry for encapsuling the entry's page number.}\newcommand*\skippageentry[1]{\idxskippagefalse}% ignore the parameter (the page number) and reset the skipping flag\newcommand*\idxcomma{% now the reason for creating the skipping flag:\ifidxskippage% if skipping flag is active, do nothing\else % otherwise, output the usual comma, followed by space,\fi}\begin{document}foo\index{cat}\index{coin}\index{cable}\skipindex{cac}\printindex\end{document}
Rainer
Forcing a blank index line alphabetically
IndexTest.ist:
Code: Select all
preamble"\\thispagestyle{empty}\n\\begin{theindex}\n"postamble"\\end{theindex}\n"
When I run your code in conjunction with this, the commas are not suppressed on the blank index line.
Index
cable, 1
,
cat, 1
coin, 1
the revision replaces
\makeindex
with\makeindex[options=-s IndexTest.ist]
(I am using the imakeindex package.)
Re: Forcing a blank index line alphabetically
Forcing a blank index line alphabetically
so what? Can't you just add the three lines from my .mst file (delim...) to your .ist file?gossett wrote:Unfortunately, I have the following .ist file:
IndexTest.ist:Code: Select all
preamble"\\thispagestyle{empty}\n\\begin{theindex}\n"postamble"\\end{theindex}\n"
Or was your .ist file automagically created?
KR
Rainer
Re: Forcing a blank index line alphabetically
I will upload sample files.
- Attachments
-
- IndexTest.tex
- The main file
- (1.3 KiB) Downloaded 593 times
Forcing a blank index line alphabetically
well, I still don't see the problem you're describing---after merging the three lines from my .mst into your .ist, that is.gossett wrote:Adding your code into my .ist file did not eliminate the extra commas.
Code: Select all
preamble"\\thispagestyle{empty}\n\\begin{theindex}\n"postamble"\\end{theindex}\n"delim_0 "\\idxcomma"delim_1 "\\idxcomma"delim_2 "\\idxcomma"
KR
Rainer