Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the following to create my index file.

heading_prefix "{\n\\bfseries\\color{black} "      % insert in front of letter
heading_suffix "\\hfil}\\nopagebreak\n"  % append after letter
headings_flag  1                 % turn on headings(uppercase)

delim_0 "\\dotfill"

The index entries appear in one column, which is fine. I wonder if there is a way to make the sub index entries appear in more than one column, as they are short in length?

An MWE to illustrate is as follows:

\documentclass{article}
\usepackage{fontspec,lipsum}
\defaultfontfeatures{Ligatures=TeX}

\setromanfont{Georgia}

\usepackage{index}\makeindex

\makeatletter
\renewenvironment{theindex}
   {%\section*{\indexname}%
    \setlength\parindent{0pt}%
    \setlength\parskip{0pt plus .3pt}%
    \let\item\@idxitem
%    \vspace*{-25mm}
    }
\makeatother 


\begin{document}

\section{Introduction}

Lorem \index{ipsum dolor sit amet, consectetuer} \index{adipiscing elit. Ut purus} elit, vestibu-
lum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, \index{consectetuer id}, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi \index{tristique senectus} et ne-
tus et \index{form!malesuada} \index{form!fames} \index{form!ac} turpis egestas. Mauris ut leo. Cras viverra metus
rhoncus sem. Nulla et lectus vestibulum urna \index{form!fringilla} \index{form!ultrices}. Phasellus eu
tellus sit amet tortor gravida placerat. \index{form!Integer} sapien est, iaculis in, pretium
quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, \index{form!mollis} \index{form!ac}, nulla. Cur-
abitur \index{form!auctor} semper \index{form!nulla}. \index{form!Donec} varius \index{form!orci} eget risus. \index{form!Duis} \index{form!nibh} mi, congue
eu, \index{form!accumsan} \index{form!eleifend}, \index{form!sagittis} \index{form!quis}, \index{form!diam}. \index{form!Duis} \index{form!eget} \index{form!orci} \index{form!sit} \index{form!amet} \index{form!orci} \index{form!dignissim}.
rutrum.

\bigskip

\printindex

\end{document}

I have used the following instructions to create the index file.

xelatex tst.tex

makeindex -s MyIST.ist tst.idx

xelatex tst.tex

evince tst.pdf

The content of MyIST.ist is follows.

heading_prefix "{\n\\bfseries\\ "      % insert in front of letter
heading_suffix "\\hfil}\\nopagebreak\n"  % append after letter
headings_flag  1                 % turn on headings(uppercase)

delim_0 "\\dotfill"

As seen from the output, all the entries under 'form' are short in length. I would like to arrange these entries in, say, 2 or even 3 columns, rather than 1 column as it stands.

share|improve this question
    
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jubobs Mar 21 '13 at 19:05
    
@Jubobs I have added an MWE to my original question. –  Reza Mar 21 '13 at 21:12
    
A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or select your code and hit Ctrl+K. –  Jubobs Mar 21 '13 at 21:13
    
@jubobs thank you. I didn't know about Ctrl+K. –  Reza Mar 21 '13 at 21:17

2 Answers 2

Plan A set as a paragraph:

enter image description here

\renewcommand\subitem{\unskip\hspace{0pt plus .7\textwidth}\linebreak[3]\hspace{1em plus -.4\textwidth minus .2em}}
\printindex

or...

Plan B: set in 3 columns:

enter image description here

don't redefine \subitem instead

heading_prefix "{\n\\bfseries\\ "      % insert in front of letter
heading_suffix "\\hfil}\\nopagebreak\n"  % append after letter
headings_flag  1                 % turn on headings(uppercase)

delim_0 "\\dotfill"

item_x1 "\n\\begin{multicols}{3}\n\\subitem "
group_skip "\n\\ifdim\\columnwidth<\\textwidth\\end{multicols}\\fi\n\n \\indexspace\n"

and

add

\usepackage{multicol}
share|improve this answer

Variant of David's plan A: Use my idxlayout package. (Note: Compile the following MWE using MakeIndex without any -s option.)

\documentclass{article}

\usepackage{index}
\makeindex

\usepackage[columns=1,itemlayout=singlepar]{idxlayout}

\usepackage{filecontents}

\begin{filecontents}{\jobname.mst}
heading_prefix "{\n\\bfseries\\ "
heading_suffix "\\hfil}\\nopagebreak\n"
headings_flag  1
delim_0 "\\dotfill"
\end{filecontents}

\begin{document}

\section{Introduction}

Lorem \index{ipsum dolor sit amet, consectetuer} \index{adipiscing elit. Ut purus} elit, vestibu-
lum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, \index{consectetuer id}, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi \index{tristique senectus} et ne-
tus et \index{form!malesuada} \index{form!fames} \index{form!ac} turpis egestas. Mauris ut leo. Cras viverra metus
rhoncus sem. Nulla et lectus vestibulum urna \index{form!fringilla} \index{form!ultrices}. Phasellus eu
tellus sit amet tortor gravida placerat. \index{form!Integer} sapien est, iaculis in, pretium
quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, \index{form!mollis} \index{form!ac}, nulla. Cur-
abitur \index{form!auctor} semper \index{form!nulla}. \index{form!Donec} varius \index{form!orci} eget risus. \index{form!Duis} \index{form!nibh} mi, congue
eu, \index{form!accumsan} \index{form!eleifend}, \index{form!sagittis} \index{form!quis}, \index{form!diam}. \index{form!Duis} \index{form!eget} \index{form!orci} \index{form!sit} \index{form!amet} \index{form!orci} \index{form!dignissim}.
rutrum.

\printindex

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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