Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.

Feature Request Tracker

ID30
StatusOpen
Categoryglossaries
SummaryAlways 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

Add comment.

Watch This Report

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).

(Optional.)
E mail:
Confirm E mail:
Confirm Topic ID:

To unsubscribe from all notifications use the notifications page.

Comment

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).

(Optional. If provided, it will be shown with the comment.)
Confirm Feature Request ID:

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace text[/tt]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

Click on the Preview button to preview the message.

Return to list.

© 2019 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs