# [NTG-context] Protrusion cancellation by index term

Hans Hagen pragma at wxs.nl
Sun Apr 10 16:47:54 CEST 2016

On 4/10/2016 12:53 PM, Jan Tosovsky wrote:
> On 2016-04-03 Hans Hagen wrote:
>> On 4/1/2016 9:59 PM, Jan Tosovsky wrote:
>>> On 2016-04-01 Hans Hagen wrote:
>>>> On 3/31/2016 10:47 PM, Wolfgang Schuster wrote:
>>>>>> On 2016-03-31 Jan Tosovsky wrote:
>>>>>>
>>>>>> I couldn't find any details for that \leftboundary
>>>>>
>>>>> spac-ver.mkiv:
>>>>>
>>>>> \unexpanded\def\leftboundary   {\boundary\plusone}
>>>>> \unexpanded\def\rightboundary  {\boundary\plustwo}
>>>>
>>>> it will instruct the protrusion checker to skip the next or
>>>> previous node (e.g. a char or hbox or ...) when looking for
>>>> an edge
>>>
>>> Thanks for details. So if that worked with plain \hbox should be
>> taken rather as coincidence?
>>
>> a hbox becomes one node so that one node is ignored
>>
>
> I found a nasty drawback of this method. If that hbox is used, the first paragraph is not evaluated correctly and considered as the second one. When indentation is enabled, the first paragraph after the title is not usually indented, but now it is. Additionaly, even if indenting is disabled, there is a bigger distance between title and the following para.
>
> \setupindenting[yes, 2em]
>
> \starttext
>
> \section{The first section}\index{the first section}
>
> The first para.\par
> The second para.
>
> \section{The second section}\leftboundary\hbox{\index{the second section}}
>
> The first para.\par
> The second para.
>
> \stoptext
>
>
> I could eventually avoid inserting that 'index' tweak into titles, but this is another exception which an end-user should keep in mind ..and.. I hate exceptions ;-)
>
> Any idea?

everything protrusion is an exception

\unexpanded\def\myindex#1%
{\dontleavehmode
\ifcase\normalprotrudechars\else\leftboundary\hbox\fi
{\index{#1}}}

might work (untested) given that protrusion is off in the title

Hans

-----------------------------------------------------------------