建立索引而不排序

建立索引而不排序

我可以使用makeindex但不排序嗎?這個問題看起來很奇怪,但我想使用索引,而索引條目(例如\index{Peace}在文件中)已經根據冰島字母表正確排序。原因是xindy冰島語(目前)的排序不正確(根據這個答案

答案1

你的問題不是很清楚,但如果我從連結的問題中獲取 MWE 並在字串中添加 ascii 近似值,然後@makeindex 根據需要進行排序。 (我可能會排序順序錯誤,但想法是,如果順序是 A Á B,則將 Á 更改為在 A 和 B 之間排序的任何內容(例如 A1),並將損壞的字串放在前面,@以便它僅用於排序。

\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}

在此輸入影像描述

答案2

不建議

以防萬一有人需要建立索引而不進行排序xindy。我將計數器中的數字加到索引項中,它們成為排序過程的一部分。無論如何我們都會失去字母組。

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

生成的idx看起來像這樣:

\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}

文件的內容ind是這樣的:

\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} 

我也會將tex文件和第 2 頁的預覽附在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}

姆韋

相關內容