Latest news 2024-03-02: Ebook sale (3rd–9th March 2024): short story cybercrime fiction Unsocial Media free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99. For further details, see latest blog post.

Bug Tracker RSS feed

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 99🔗
Date: 2015-11-12 03:49:52
Status Closed (Fixed)
Category datatool
Version 2.23
Summary strange behavior of \dtlcompare

Sign in to subscribe to notifications about this report.


I used the example from the doc-code and I cannot explain the result of \dtlcompare{\mycount}{\noopsort{z}foo}{bar}\number\mycount{} that should be 1 and not -1 as {z}foo is greater than bar.


Download (886B)




\verb+\newcommand*{\noopsort}[1]{}+ then \verb+\noopsort{a}foo+  produces the text: foo, however the following 


produces: -1, since the command \verb+\noopsort+ is disregarded when the comparison is made, so \verb+\dtlcompare+ just compares \{a\}foo with bar, and since a is less than b, the first string is considered to be less than the second string.

A. result with \verb+\noopsort{a}foo}+ \dtlcompare{\mycount}{\noopsort{a}foo}{bar}\number\mycount{} as expected

B. result with \verb+\noopsort{z}foo}+
\dtlcompare{\mycount}{\noopsort{z}foo}{bar}\number\mycount{}. Should it not be 1? 


I'm sorry, it turns out the documentation was wrong. What actually happens is that commands are treated as though they have a character code of 0. Since this may cause a problem for backward-compatibility for documents that rely on the actual behaviour (rather than the intended behaviour) I've added a switch \ifdtlcompareskipcs to version 2.32. This is false by default to maintain current behaviour but if you switch it to true (\dtlcompareskipcstrue) before making the comparison you should get the intended behaviour.



Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.


You can use the following markup:


[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]

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

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

You can use the Preview button to review your message formatting before submitting.

Page permalink: