# Index sorting problem with Vietnamese

I use Texmker 4.1 and Texlive 2013 in my Xubuntu. I use this system to write my teacher's book with the AMS package (gsm in fact), which is in Vietnamese. There is a problem in sorting the index, it did not display the order correctly, and some indices were missed. I have searched on Tex Stack Exchange, there are indeed two topic about this kind of problem ( here and here ), but the solution there did not work in my case.

Here is the MWE:

\documentclass{gsm-l}
\usepackage[papersize={160mm,240mm},inner=20mm, outer=15mm, vmargin=15mm]{geometry}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath,enumitem}% http://ctan.org/pkg/{amsmath,enumitem}
\setlist[enumerate]{leftmargin=*}
\usepackage[utf8]{vietnam}
\usepackage{makeidx}
\makeindex

\begin{document}
\chapter{Hello}
This is the MWE

\index{Đồng biến}
\index{Nghịch biến}
\index{Dao động điều hòa}
\index{Ếch}
\index{Alphabetical}
\index{Albert Einstein}
\index{Bổ đề}
\index{Đường thẳng}
\index{Chương}
\printindex
\end{document}


Makeindex command in the terminal will produce the Index sorting like this :

Ếch>Đồng biến>Đường thẳng>Albert Einstein>Alphabetical>Bổ đề>Chương>Dao động điều hòa>Nghịch biến.

This is not the sorting I want as in Vietnamese, it should be like this

Albert Einstein>Alphabetical>Bổ đề>Chương>Dao động điều hòa>Đồng biến>Đường thẳng>Ếch

• Both the questions you referenced recommend xindy rather than makeindex as makeindex is hard-coded for English. If those answers don't solve your problem, using makeindex certainly won't. It might be easier to say in what way those solutions didn't work. (For example, is the problem that you can't get xindy to work?) – Nicola Talbot Jan 8 '14 at 9:43
• @NicolaTalbot xindy did not work, I have said above. It removed the utf8 encoded like Ê, Đ. It also changed the header style of the Index page, therefore I asked the new question. – Knumber10 Jan 8 '14 at 9:52
• @NguyễnDuyKhánh There's no point try to solve the problem using makeindex. It would be better if you edited your question to show how you tried to create the index using xindy (for example, did you use xindy directly or did you use texindy and what were the arguments). Also it might help if you added the contents of the .idx file (so we can see if the utf8 characters were correctly written to the index file) and the .ilg (so we can see if there were any error messages or warnings). – Nicola Talbot Jan 8 '14 at 10:02
• @NicolaTalbot -- i'm familiar with the gsm style. it has an index page style that is quite "nonstandard" and incompatible with all index packages except for amsmidx. (amsmidx was built to avoid messing up this special page layout, and at the moment, i am trying to devise a modification to imakeidx to correct the problem, since imakeidx is superior to amsmidx.) it may be possible to patch xindy or texindy to fix the page layout problem with gsm, but otherwise the only (unpleasant) approach i can see is to insert sort fields for the index terms. – barbara beeton Jan 8 '14 at 13:46

the problem here is that the gsm document class (based on amsbook) has a very "nonstandard" page style. (most other ams document classes based on amsbook do not have quite as nasty a problem, but other problems may occur; amsbook hasn't been tested, as far as i know, with xindy or texindy, and since it already contains the basic \index commands, can't even be used with makeidx.)
although the workaround is, to say the least, unpleasant, makeindex can be used if a sort field is added to every index term that doesn't sort where it is wanted. for example:
\index{Dong bien@Đồng biến}

i am trying to work on the compatibility problem (specifically with imakeidx), but as this hasn't actually been requested by an author writing a book for the ams, it doesn't have high priority. (assistance is also needed from the authors of the affected packages, not always easy to get -- it's not high priority for then either).