LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsCase sensitive sorts with makeindex

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
kaiserkarl13
Posts: 626
Joined: Tue Mar 25, 2008 5:02 pm

Case sensitive sorts with makeindex

Postby kaiserkarl13 » Thu Aug 13, 2009 12:37 am

Is it possible to get makeindex to sort A>B>a instead of A>a>B? I'm using nomencl.sty both with and without prefixes; I've also tried setting the prefix to '+' or '=' instead of 'a' to no avail.

I can get symbols to sort ahead of all other characters, but I can't get capital letters grouped ahead of small ones.

What it looks like now:

\Gamma
\Pi
\pi
A
a
B
b
...


What I'd like:
\Gamma
\Pi
\pi
A
B
...
a
b
...

Any suggestions?

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Thu Aug 13, 2009 9:57 am

Could be difficult in the best case. You may try Xindy as an alternative. For Windows it is only included in the TeX Live distribution at the moment. I don't know if the upcoming version 2.8 of MiKTeX will come with it.


Best regards
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

kaiserkarl13
Posts: 626
Joined: Tue Mar 25, 2008 5:02 pm

Postby kaiserkarl13 » Thu Aug 13, 2009 10:12 pm

I figured out how to get it to work with minimal effort:

Declare symbols via
  1. \nomenclature[*C]{$\Gamma$}{blah}

Declare upper case letters via
  1. \nomenclature[+C]{$C$}{blah}

Declare lower case letters via
  1. \nomenclature[-c]{$c$}{blah}


This way, the first letter of each is *, +, or - (which are sorted in that order due to their ASCII codes).

For those that use VIM, the following commands are handy for updating the upper and lower case letters:
  1. %s/\(nomenclature\[\)\([A-Z]\)/\1+\2/
  2. %s/\(nomenclature\[\)\([a-z]\)/\1-\2/

You'll have to do the symbols manually, since those don't typically have a sorting argument (e.g., [c]). I used optional arguments like [*H], [*Y], etc. to ensure that \Psi ([*Y]) gets sorted after \Theta ([*H]).

Working example:
  1. \nomenclature[-aa]{$a_a$}{asntoehu}%
  2. \nomenclature[*C]{$\Gamma$}{asnteohu}%
  3. \nomenclature[*H]{$\Omega$}{asnteohu}%
  4. \nomenclature[+Aa]{$A_a$}{asontehu}%
  5. \nomenclature[+AA]{$A_A$}{santoehu}%
  6. \nomenclature[+Ba]{$B_a$}{asntoehu}%
  7. \nomenclature[*Y]{$\Psi$}{asnteohu}%

which produces the order
\Gamma
\Omega
\Psi
A_A
A_a
B_a
a_a

This seems to solve the problem adequately.


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest