TransWikia.com

How to right align wrapped lines in index

TeX - LaTeX Asked on May 7, 2021

I would like to right align the page numbers in my index. I was able to achieve to right align my first line, but unable to do so for the other lines.

I tried setting indent_space "hfill" in my ist file, but it didn’t work

Here is my code:

documentclass{article}

makeatletter
newcommand{mdotfill}[1][2em]{%
    leavevmode
    linebreak[0]%
    mbox{}nobreak
    cleaders hb@xt@ .44em{hss.hss}hskip #1 plus 1fill
    kernz@
}
makeatother

usepackage{indextools}
usepackage{imakeidx}
makeindex[options= -l -s ownindexstyle.ist]

usepackage{ifthen}

begin{document}

newcounter{int}
setcounter{int}{1}
loop
foo
index{longkeyname} index{longkeyname2} clearpage aa clearpage index{longkeyname} clearpage bar index{longkeyname2} clearpage
addtocounter{int}{2}
ifnum value{int}<10
repeat

printindex
end{document}

And here is my ist file:

item_0 "nn {item} "
delim_0 "mdotfill"
delim_1 "mdotfill"
delim_2 "mdotfill"
indent_space "hfill"
indent_length "30"

The actual situation is on the picture. I would like to right align the second lines of the associated page numbers.
enter image description here

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP