I'm down to the last pages of a 400+ page book -- the index. That's all working pretty well, except...

I have a few entries that are just badly type-set, such as the following entry for MOS Metallic-Oxide:

image showing bad full justification in index

The problem, it seems to me, is that I need to make it ragged right. The full justification is inappropriate for such short lines.

So looking at the posted questions like this, I find a package (idxlayout) and add at the beginning: \usepackage[justific=RaggedRight]{idxlayout}

This solves the MOS justification issue, but it has significant impact on the layout of other vertical spacing items, making the index larger, and costing me an extra page. Exploring why, we find that the RaggedRight option moved the page number up, but added extra vertical space in the index when it switches from one first letter to the next (like from "a" to "b", ...) as shown in the following image, comparing the original full-justification vertical spacing on the left, with the RaggedRight on the left. The extra vertical space moved items from the bottom of the first column to the top of the second column and this propagates until I have to have an extra page to accommodate the items from the last page that were pushed off onto a new last page.

enter image description here

But the capitalization of RaggedRight led me to search more and find that it is a particular option; the base option is "raggedright", so I tried \usepackage[justific=raggedright]{idxlayout} which also seems to be almost the same as just putting \raggedright right before my \printindex:


which almost works. But, for reasons I cannot understand, just adding \raggedright causes LaTex to decide to break the lines in different places. Consider these last lines on the first page of the index. On the left is the fully justified index, and on the right, the index with just \raggedright (or the \usepackage[justific=raggedright]{idxlayout} -- they seem to be the same):

image with \raggedright

The last index entry on the left column (ADD) shows how I would expect ragged right to work -- it takes the previous line break and shifts things to the left so that the right margin is uneven.

But the last index entry on the right column (AND) shows (in the left image) that all the page numbers fit on one line. The \raggedright option decides they will not all fit on one line, and breaks it into two lines. The cumulative affect of this sort of difference results in about 12 extra lines being pushed onto a new page at the end -- increasing the page count from 433 to 434.

Now it's possible that this doesn't matter -- a book has to have an even number of pages when it comes down to printing, but if I'm trying to get LaTeX to do what I want it to do, this is very frustrating.

And I apologize for not having a minimal working example, but it takes pages and pages and pages to get all the index entries defined in all the right places, and I'm not sure how to reduce it to just the right number of lines of index entries to show this. I've experimented quite a bit (with what little I know of LaTeX), and hope that the images will help to show the problem.

  • If you are happy with how RaggedRight from idxlayout deals with justification, and just want to reduce the vertical separation, the obvious thing to play with would be the value of initsep in idxlayout. Default apparently is 10pt plus 5pt minus 3pt. – Paul Stanley Dec 29 '18 at 18:38

Your Answer

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

Browse other questions tagged or ask your own question.