This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Extra Spaces Caused by <indexterm>s


[ Dave, FAQ? ]

/ Jeffrey Oldham <oldham@codesourcery.com> was heard to say:
| Processing expectations for <indexterm> include:
|
|     IndexTerms are suppressed in the primary text flow, although they
|     contribute to the population of an index and serve as anchors for
|     cross references. Under no circumstances is the actual content of
|     IndexTerm rendered in the primary flow.
|
| The DVI/PostScript file produced from the attached DocBook/XML file
| has one erroneous space for each indexterm in the source.  Which tool
| (or me?) is responsible for these erroneous spaces and how do we fix
| it?

Consider your source:

<para>Why does adding indexterms cause spaces to appear here:
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
     <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
    <indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>
ending here?</para>

For clarity, let's replace spaces by '+' characters:

<para>Why+does+adding+indexterms+cause+spaces+to+appear+here:
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
+++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
++++<indexterm>
+++++<primary>data-parallel+operation</primary>
++++</indexterm>
ending+here?</para>

Now, unless you've taken special care, multiple adjacent spaces are
generally treated as a single space, so we can reduce this to:

<para>Why+does+adding+indexterms+cause+spaces+to+appear+here:
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
+<indexterm>
+<primary>data-parallel+operation</primary>
+</indexterm>
ending+here?</para>

Now, remove the index terms and what's left?

<para>Why+does+adding+indexterms+cause+spaces+to+appear+here:
+
+
+
+
+
+
+
+
+
ending+here?</para>

Those spaces are not "adjacent" unfortunately, so each one is produced
in the output. That's the source of the extra spaces.

Unfortunately, the only way to avoid this problem is either to put the
indexterms between paragraphs (which is logically wrong) or to make
sure that you don't introduce extra spaces with your index terms:

<para>Why does adding indexterms cause spaces to appear here:<indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm><indexterm>
     <primary>data-parallel operation</primary>
    </indexterm>ending here?</para>

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | No man is more than another if he
http://www.oasis-open.org/docbook/ | does no more than
Chair, DocBook Technical Committee | another.--Cervantes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]