[NTG-context] Bugs in linenumbering ?

Fri Apr 4 02:15:54 CEST 2014

Le Thu, 03 Apr 2014 13:01:04 -0400,
Rik Kabel <context at rik.users.panix.com> a écrit :

> On 2014-04-03 13:16, Stéphane Goujet wrote:
> > Le Thu, 03 Apr 2014 16:19:18 +0200,
> > Hans Hagen <pragma at wxs.nl> a écrit :
> >
> >> with respect to text: you need to go narrower or set the distance
> >> to (e.g.) -1cm
> >    It seems I can indeed get nice results with
> >
> > \setuplinenumbering[location=text]
> > \startnarrower[left]
> > \startlinenumbering
> >
> >> i've added support for notes (somewhat tricky)
> >>
> >> \starttext
> >> Here we have a footnote \footnote{%
> >>       \startlinenumbering
> >>           \input tufte
> >   A few numbers : 012345679.
> >>           \par % somehow needed
> >>       \stoplinenumbering
> >> }
> >> \stoptext

> As to the size in footnotes, try:
>
>     \definelinenumbering[fntext]
>     \setuplinenumbering[fntext][style=\ssxx]

If I could avoid defining another set of different macros, I would
prefer... (For I have already 2 start macros, 2 stop macros, and 1
intermediate macro: it already lacks a bit of automatising).

> However, for the general case, there is still an issue with
> linenumbering that begins after the beginning of a paragraph. The
> work-around of \startnarrower cannot help in this case, since it
> appears to always start a new paragraph.

So, with the [before=] (and [after=] for continuing text after
\stopnarrower), it is possible.

Here is what I have done so far. Not too bad a result, but there are
still 2 main problems:
-- when the quotation begins after the beginning of the paragraph, the
whole paragraph is affected by *narrower*;
-- when the text continues after the end of the quotation, it is
impossible to insert the *\par* that, as Hans noticed and told us, is
needed to have *narrower* work, so it is as if there was no *narrower*
and the whole line numbering of the paragraph is messed up.

and 2 minor ones:
-- no paragraph indentation in footnotes.
-- Alignment of the first quoted paragraph in respect to the following
quoted paragraphs is not perfect (because I use different symbols for
the quotation opening («) and the quotation repetition (»), I guess).
But this point is good enough for me.

==========================
\setuppapersize[A4]
\enableregime[utf-8]
\mainlanguage[fr]
\language[fr]
\setcharacterspacing[frenchpunctuation]
\setupindenting[first,yes,medium]

\setupnotation[footnote][location=margin]

\define\repsym{»}
\newdimen\repshift
\repshift=.75em
\definelinenumbering[repcite]
\setuplinenumbering[repcite][location=text,command=\repmark,before=,after=]
\definelinenumbering[repcitel]
\setuplinenumbering[repcitel][location=text,command={\repsym\gobbleoneargument}]
\defineexpandable[1]\repmark{\doifnot{#1}{1}{\repsym}}

\definenarrower[narcite][left=\repshift,before=,after=]

\define\startbloccite{\startnarcite[left]\setupindenting[first,yes,\dimexpr\parindent-\repshift]\startlinenumbering[repcite]«}
\define\startbloccitel{\startnarcite[left]\setupindenting[first,yes,\dimexpr\parindent-\repshift]\startlinenumbering[repcitel]«}
\define\stopbloccite{»\par\stoplinenumbering\stopnarrower}
\define\stopbloccitel{»\stoplinenumbering\stopnarrower}

\define\bloccitepar{\stoplinenumbering
\par
\startlinenumbering[repcite]\leavevmode\hbox to\repshift{\repsym}\hskip0pt
}

\starttext

First check: «normal spacing of guillemets».

Second check: a normal paragraph, to show {\bf normal right margin limit}.
\input tufte

«Third check : paragraph starting with guillemets.»

Let's start with a quote block on a {\bf new line} :

\startbloccite
%First paragraph ({\bf quote repetition symbol is really not wanted here}): \input tufte (\the\hsize)
Second paragraph ({\bf indenting and margins are correct}): \input tufte
\bloccitepar
Second paragraph ({\bf indenting and margins are correct}): \input tufte
\bloccitepar
Third paragraph ({\bf now I put a different sentence here to check hyphenation.
Weird, it looks OK now, I cannot reproduce the overflow.}): \input tufte
\stopbloccite

Now, a quote block starting just there, {\bf in the middle of a line}
({\bf the problem is that \char\\startnarrower affects the whole paragraph :
every lines are narrowed, even the ones before the environment starts}):\startbloccitel\input tufte
\bloccitepar
\input tufte
\stopbloccitel . This a bit of text at the end of the quotation.
{\bf The whole paragraph is wrong because I could not end it with a \char\\par}.

And let's call a {\bf footnote}\footnote{\startbloccite\input tufte
\bloccitepar
\input tufte
\stopbloccite}. {\bf Fine : quote repetition symbols do now appear
in it. But there is no paragraph indentation.}.

\stoptext

==========================

Goodbye,
Stéphane.