Feature Request Tracker
ID: | 30 🔗 |
---|---|
Status: | Open |
Category: | glossaries |
Date: | 2015-01-04 18:12:37 |
Summary: | Always use ranges in number lists |
Report
I think it's inconsistent, that the number lists in glossaries use ranges when using option 2 or 3 and do not use ranges with option 1 (especially as option 1 seems to be the future due to its elegance). I recommend to either use always ranges or make it always configurable.
I implemented the first approach by replacing \glsnoidxloclist
and \glsnoidxloclisthandler
and added some additional code:
\renewcommand*{\glsnoidxloclist}[1]{% % Remove duplicates and compress the list by using ranges. % The basic idea is to save a range begin and a range end, without % immediately printing every element. % Only if the range is complete, print it. This can only be checked when % processing the next element or after processing the list. \def\@gls@noidxloclist@sep{\def\@gls@noidxloclist@sep{\delimN}}% \def\@gls@noidxloclist@prev{}% \forlistloop{\glsnoidxloclisthandler}{#1}% \ifdef\@gls@noidxloclist@range@end{% \@gls@noidxloclist@print@range \undef\@gls@noidxloclist@range@begin \undef\@gls@noidxloclist@range@end }{% \ifdef\@gls@noidxloclist@range@begin{% \@gls@noidxloclist@sep\@gls@noidxloclist@range@begin \undef\@gls@noidxloclist@range@begin }{% }% }% } \renewcommand*{\glsnoidxloclisthandler}[1]{% \ifdefstring{\@gls@noidxloclist@prev}{#1}{% }{% \ifdef\@gls@noidxloclist@range@begin{% \ifdef\@gls@noidxloclist@range@end{% \@gls@noidxloclist@ifsuccessor{\@gls@noidxloclist@range@end}{#1}{% \def\@gls@noidxloclist@range@end{#1}% }{% \@gls@noidxloclist@print@range \def\@gls@noidxloclist@range@begin{#1}% \undef\@gls@noidxloclist@range@end }% }{% \@gls@noidxloclist@ifsuccessor{\@gls@noidxloclist@range@begin}{#1}{% \def\@gls@noidxloclist@range@end{#1}% }{% \@gls@noidxloclist@sep\@gls@noidxloclist@range@begin \def\@gls@noidxloclist@range@begin{#1}% }% }% }{% \def\@gls@noidxloclist@range@begin{#1}% }% \def\@gls@noidxloclist@prev{#1}% }% } \def\@gls@noidxloclist@print@range{% \expandafter\@gls@noidxloclist@ifsuccessor\expandafter\@gls@noidxloclist@range@begin\expandafter{\@gls@noidxloclist@range@end}{% \@gls@noidxloclist@sep\@gls@noidxloclist@range@begin\@gls@noidxloclist@sep\@gls@noidxloclist@range@end }{% \@gls@noidxloclist@sep\@gls@noidxloclist@range@begin\delimR\@gls@noidxloclist@range@end }% } % Executes the true branch if #2 is a successor of #1 in a mathematical sense (e.g., 5 is successor of 4). \def\@gls@noidxloclist@ifsuccessor#1#2{% % The first argument gets expanded once so that both arguments consist of five tokens. \expandafter\@gls@noidxloclist@ifsuccessor@\expandafter{#1}{#2}% } \def\@gls@noidxloclist@ifsuccessor@#1#2{% % The fifth token is extracted and expanded, as it contains a group. \expandafter\edef\expandafter\@gls@noidxloclist@firstnum\expandafter{\@fifthoffive#1}% \expandafter\edef\expandafter\@gls@noidxloclist@secondnum\expandafter{\@fifthoffive#2}% % The page number can be checked now. \ifnumequal{\@gls@noidxloclist@firstnum + 1}{\@gls@noidxloclist@secondnum}% } \long\def\@fifthoffive#1#2#3#4#5{#5}The code can probably be quite a bit improved, simplified and generalized. Testing is also necessary, I only tested it with one document in one configuration.
Patrick Häcker
Evaluation
Option 1 is an option of last resort if you are unable to use any external indexing tools for some reason. The build time is already slow with option 1, range-forming would further add to it. If you require ranges then you are far better off using an indexing application which can perform this action far more efficiently than TeX.
Note that if you use explicit ranges (with the Add comment or return to search results. If you would like to be notified whenever updates are made to this report,
please fill in your email address in the box below and click on
"Notify Me of Changes" button. (Please ensure the address is valid.)
Your details won't be passed on to third parties in line with this site's
Privacy Policy. If you supply your name, it will be used in the email greeting, which
provides a more personal message, otherwise you'll just get a generic greeting.
If you have previously supplied your name when signing up for
notifications, you don't need to resupply it unless you want to change it. If you have previously subscribed to notifications for this report, you can
unsubscribe by clicking on the "Stop Notification"
button. The "Confirm Topic ID" field helps to protect against spambots. Please enter the feature request ID
(which you can find at the top of this page). To unsubscribe from all notifications use the notifications page.
You can append a comment to this report using the form below.
Comments are checked first before being added. Any spam or offensive content
will be removed first according to this site's Terms of Website Use.
Please bear in mind that I develop and maintain free software in my spare time.
If you want commerical level support then you can hire a TeX consultant.
The "Confirm Feature Request ID" field helps to protect against spambots. Please enter the feature request ID
(which you can find at the top of this page).(
and
)
formats), the glossaries-extra.sty (which modifies
\glsnoidxdisplayloc
) will implement the range.Watch This Report
Comment