6

Can I use makeindex but without sorting? This question looks peculiar but I would like to use index while the index entries (for example \index{Peace} in the document) are already sorted correctly according to Icelandic alphabet. The reason is that xindy sorting of Icelandic (for now) is incorrect (according to this answer)

  • Do you mean you already have a generated (or hand written) index file? In which case you don't need an external program at all, latex will just input it. – David Carlisle Mar 14 '14 at 10:25
  • No. I have edited the question. I hope it is now clear. – chejnik Mar 14 '14 at 10:35
  • 1
    You mean that the occurrences of \index in the document are in order? So it's not an index? Please (always) include a complete small document that shows the problem. – David Carlisle Mar 14 '14 at 10:50
6

Your question isn't very clear but if I take the MWE from the linked question and add ascii approximations to the strings before @ then makeindex sorts as required. (I may have the sort order wrong but the idea is that if the order is A Á B then change Á to anything that sorts between A and B (say A1) and put the mangled string before @ so it is only used for sorting.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[]{makeidx}
\usepackage[icelandic, czech]{babel}
\makeindex
\begin{document}
Hello
\index{z1ari@Þari - Franz Eugen Kohler, Public Domain}
\index{z1istill@Þistill - ŠARŽÍK František, COPYRIGHT/PD}
\index{O2nd@Önd - Karney, Lee, PD}
\index{a3d@Æðarkóngur - Whitehouse, Laura L., PD}
\index{Avo1@Avókadó - Forest \& Kim [[p:2684;Starr]], CC-BY}
\index{Aud1@Auðnutittlingur - Arnstein Rønning, CC BY-SA 3.0}
\index{Asni@Asni - Zicha Ondřej, COPYRIGHT/CC-BY-NC}
\index{A1@Á - hvalur.org, CC Unported Licence}
\index{A1lft@Álft - Bukovský Jiří, COPYRIGHT/CC-BY-NC}
\index{A1lka@Álka - Jack Spellingbacon from Scotland, CC BY-SA 3.0}

\printindex
\end{document}

enter image description here

  • It is very interesting idea! Mangled string could be first letter + increased number.. !? One last think - does makeindex recognise the á (í, ó, ý, ú, é) letter as a separate letter in index? If not, how can we force him to recognize? – chejnik Mar 14 '14 at 12:16
  • 1
    makeindex is basically ascii use a1 for á if you want it sorted after a similarly for other accented letters. Use the same ascii string for each occurrence of the letter, you don't want an "increasing number" This is assuming that you do in fact want sorting in your real case. If you don't want sorting and just want to print a list in the order that it is in the file, just use latex (eg a description environment) \item[] instead of \index{}. and no makeindex or xindy is needed. – David Carlisle Mar 14 '14 at 12:26
  • Exactly - I dont want sorting, but I would like to use the page number (with hyperlink) that enables user to visit the page the index entry (in index) shows. – chejnik Mar 14 '14 at 12:32
  • @chejnik Well OK but you could just use \pageref for that and not need any external files or indexing program. – David Carlisle Mar 14 '14 at 12:43
  • Thank you for your suggestions. I will wait until the bug in xindy is repaired. – chejnik Mar 14 '14 at 14:23
1

Not recommended

Just in case if someone is in need of creating an index without sorting in xindy. I am adding a number from counter to the index terms and they become a part of sorting process. We lose letter groups anyway.

lualatex mal-xindy-nosorting.tex
xindy -M texindy -M makeindex mal-xindy-nosorting.idx
lualatex mal-xindy-nosorting.tex

The generated idx looks like this:

\indexentry{1 dog@dog|hyperpage}{1}
\indexentry{2 mouse@mouse|hyperpage}{1}
\indexentry{3 horse@horse|hyperpage}{1}
\indexentry{4 cat@cat|hyperpage}{1}
\indexentry{5 bird@bird|hyperpage}{1}
\indexentry{6 girafa@girafa|hyperpage}{1}
\indexentry{7 zebra@zebra|hyperpage}{1}
\indexentry{8 jellyfish@jellyfish|hyperpage}{1}
\indexentry{9 lion@lion|hyperpage}{1}
\indexentry{10 cow@cow|hyperpage}{1}
\indexentry{11 octopus@octopus|hyperpage}{1}
\indexentry{12 ant@ant|hyperpage}{1}
\indexentry{13 worm@worm|hyperpage}{1}
\indexentry{14 wolf@wolf|hyperpage}{1}
\indexentry{15 owl@owl|hyperpage}{1}

And the content of the ind file is this:

\begin{theindex}
  \providecommand*\lettergroupDefault[1]{}
  \providecommand*\lettergroup[1]{%
      \par\textbf{#1}\par
      \nopagebreak
  }

  \lettergroupDefault{default}
  \item dog, \hyperpage{1}
  \item mouse, \hyperpage{1}
  \item horse, \hyperpage{1}
  \item cat, \hyperpage{1}
  \item bird, \hyperpage{1}
  \item girafa, \hyperpage{1}
  \item zebra, \hyperpage{1}
  \item jellyfish, \hyperpage{1}
  \item lion, \hyperpage{1}
  \item cow, \hyperpage{1}
  \item octopus, \hyperpage{1}
  \item ant, \hyperpage{1}
  \item worm, \hyperpage{1}
  \item wolf, \hyperpage{1}
  \item owl, \hyperpage{1}

\end{theindex} 

I also enclose the tex file and a preview of page 2 in pdf:

%! *latex mal-xindy-nosorting.tex
%! xindy -M texindy -M makeindex mal-xindy-nosorting.idx
%! *latex mal-xindy-nosorting.tex
\documentclass{article}
\pagestyle{empty}
\usepackage[colorlinks]{hyperref}
\usepackage{makeidx}
\makeindex
\begin{document}
The first paragraph of text.
\let\oldindex=\index
\newcount\malcount \malcount=0
\def\index#1{\advance\malcount by 1%
  \oldindex{\the\malcount\space#1@#1}%
  }% End of \index redefinition...
\index{dog}\index{mouse}\index{horse}
\index{cat}\index{bird}\index{girafa}\index{zebra}
\index{jellyfish}\index{lion}\index{cow}\index{octopus}
\index{ant}\index{worm}\index{wolf}\index{owl}
\begingroup\def\thispagestyle#1{}\printindex\endgroup
\end{document}

mwe

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.