[NTG-context] Footnote markers

2016-03-25 Thread Robert Krug
Greetings,

Is there a way to attach a footnote marker to the text following the
footnote, rather than to the text preceding? That is, given something
like:

Some text
\footnote{note.}
more text.

I would get (using an asterisk here, but that is not important):

Some text *more text.

rather than:

Some text* more text.

I am trying to re-typeset a couple of documents from circa 1600
where it is done that way.

Many thanks for Context. It is quite nifty.

Robert

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Length range control of the last line of paragraph

2016-03-25 Thread Jan Tosovsky
On 2016-03-25 Hans Hagen wrote:
> On 3/25/2016 2:40 PM, Jan Tosovsky wrote:
> > On 2016-03-24 Hans Hagen wrote:
> >> On 3/24/2016 8:36 PM, Jan Tosovsky wrote:
> >>>
> >>> We basically need:
> >>> 
> >>>
> >>> and I thought this is exactly what \parfillskip ensures
> >>> \parfillskip XX plus (hsize - 3*indent)
> >>>
> >>
> >> the fil is taken into account when calculating the best break 
> >> points and then the XX is fixed but plus/minus can lead to if 
> >> being less or more, all relative to other fill (distributed)
> >>
> >> so, XX plus (hsize - 3*indent) is not a fixed value, it's XX or
> >> more
> >>
> >> take this:
> >>
> >> \ruledhbox to 10cm {x\hskip0pt plus 1cm x}
> >>
> >> the skip will stretch more than 1cm
> >
> > I can see.
> >
> > But sorry for my ignorance, as far as I understand, \parfillskip 
> > is added to the end of the paragraph, so we have rather
> > \ruledhbox to 10cm {x\hskip0pt plus 1cm} % without that 'x' at the
> > end, so no 'glue' distribution is performed
> 
> there is but not enough stretch so there will be a warning ... you
> can see it from
> 
> \ruledhbox to 10cm {x}
> \ruledhbox to 10cm {x\hskip0pt plus 1cm}
> \ruledhbox to 10cm {x\hskip0pt plus 1fill}
> 

I get it, thanks.

> > If '\parfillskip 2em plus (hsize - 3*(2em) - 2em)' is specified, I
> > still think we should get space of width at least 2em '' which 
> > can be extended as indicated by hyphens '-' here:
> >
> > emememememememememememememememememememem
> > emememememem
> >
> > So there are two last line lengths extrems:
> > (shortest)
> > emememememememememememememememememememem
> > emememememem
> >
> > (longest)
> > emememememememememememememememememememem
> > emememememememememememememememememem
> 
> you always add a 2em skip so there will never be a word touching the
> right margin in the last line; 

yes, but this is my goal (!)

See https://mailman.ntg.nl/pipermail/ntg-context/2016/084858.html - case (2)

I am afraid I hasn't been clear enough yet.


> > Can I somehow define command globally which takes local block widths?
> >
> > \parfillskip #1 plus \localhsize-#1-#2, where
> > #1 gap width
> > #2 shortest line width
> 
> \availablehsize
> 


So the following \parfillskip specification finally seems to be what I was 
looking for as it covers both cases in my original question:

\setupindenting[yes,2em]

\newdimen\lastlineminlength
\newdimen\lastlinemingap

\lastlineminlength=3em
\lastlinemingap=1em

\parfillskip \lastlinemingap plus 
\dimexpr\availablehsize-\lastlineminlength-\lastlinemingap\relax

\edef\ward{\cldloadfile{ward}}

\starttext

\dorecurse{100}{
 \hsize\dimexpr\textwidth-#1mm\relax
 \ward  \par
 \ward  \par
 \startnarrower[left]
 \ward \par
 \ward \par
 \stopnarrower
 \page
}

\stoptext

As it can be done in one place globally and in almost single line, no special 
new command is necessary (as requested originally).

Jan


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Length range control of the last line of paragraph

2016-03-25 Thread Hans Hagen

On 3/25/2016 2:40 PM, Jan Tosovsky wrote:

On 2016-03-24 Hans Hagen wrote:

On 3/24/2016 8:36 PM, Jan Tosovsky wrote:


We basically need:


and I thought this is exactly what \parfillskip ensures
\parfillskip XX plus (hsize - 3*indent)



the fil is taken into account when calculating the best break points
and then the XX is fixed but plus/minus can lead to if being less
or more, all relative to other fill (distributed)

so, XX plus (hsize - 3*indent) is not a fixed value, it's XX or more

take this:

\ruledhbox to 10cm {x\hskip0pt plus 1cm x}

the skip will stretch more than 1cm


I can see.

But sorry for my ignorance, as far as I understand, \parfillskip is added to 
the end of the paragraph, so we have rather
\ruledhbox to 10cm {x\hskip0pt plus 1cm} % without that 'x' at the end, so no 
'glue' distribution is performed

If '\parfillskip 2em plus (hsize - 3*(2em) - 2em)' is specified, I still think 
we should get space of width at least 2em '' which can be extended as 
indicated by hyphens '-' here:

emememememememememememememememememememem
emememememem

So there are two last line lengths extrems:
(shortest)
emememememememememememememememememememem
emememememem

(longest)
emememememememememememememememememememem
emememememememememememememememememem

I slightly modified your example and even with verystrict settings all seems to 
be fine (except too narrow blocks, which is not my use case).

\showmakeup[glue]

\setupindenting[yes,2em]

\edef\ward{\cldloadfile{ward}}

\setupalign[verystrict,hz]

\starttext
\dorecurse{100}{
  \hsize\dimexpr\textwidth-#1mm\relax
  \dimen0=\hsize
  \advance\dimen0 by -8em % 3*em - 2em
  \parfillskip 2em plus \dimen0\relax
  \ward  \par
  \parfillskip 2em plus \dimen0\relax
  \ward  \par
  \startnarrower[left]
  \parfillskip 2em plus \dimen0\relax
  \ward \par
  \stopnarrower
  \startnarrower[left]
  \parfillskip 2em plus \dimen0\relax
  \ward \par
  \stopnarrower
  \page
}
\stoptext

The problem here this settings cannot be done globally if there are various 
block widths.

Can I somehow define command globally which takes local block widths?

\parfillskip #1 plus \localhsize-#1-#2, where
#1 gap width
#2 shortest line width


As expected, results are on the average worse than an occasional 
relatively short last line. One cannot expect to find good solutions 
when the solutionspace is too small.


\startluacode
function builders.paragraphs.constructors.methods.crap(head)
local needed  = 2 * tex.parindent
if needed > 0 then
local maximum = tex.hsize
local cycles  = 500
local step= 65536
local done= 0
local tail= node.tail(head)
while true and done < cycles do
local h = nodes.copy_list(head)
local t = nodes.tail(h)
local d, r = tex.linebreak(h)
local l = node.tail(d)
if d ~= l and l.subtype == nodes.listcodes.line then
local natural = nodes.dimensions(l.list,t.prev)
node.flush_list(d)
if natural >= needed then
break
elseif natural >= maximum then
break
else
local maybe = maximum - needed - done*step
if maybe > 0 then
tail.width   = maybe
tail.stretch = 0
tail.shrink  = 0
done = done + 1
else
break
end
end
else
node.flush_list(d)
end
end
if done > 0 then
logs.report("crap","last line enforced in %i steps",done)
end
end
end
\stopluacode

\edef\ward {\cldloadfile{ward}}

\defineparbuilder[crap]

\starttext

\dorecurse{20} {
\dostepwiserecurse{0}{80}{2} {
\indenting[##1mm,yes]
\dontcomplain
\setupalign[tolerant,stretch]
\blackrule[width=\textwidth]
\hsize=\dimexpr\textwidth-#1pt\relax
\ward \par
\startparbuilder[crap]%
\ward \par
\ward \par
\stopparbuilder
\page
}
}

\stoptext



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : 

Re: [NTG-context] Length range control of the last line of paragraph

2016-03-25 Thread Hans Hagen

On 3/25/2016 2:40 PM, Jan Tosovsky wrote:

On 2016-03-24 Hans Hagen wrote:

On 3/24/2016 8:36 PM, Jan Tosovsky wrote:


We basically need:


and I thought this is exactly what \parfillskip ensures
\parfillskip XX plus (hsize - 3*indent)



the fil is taken into account when calculating the best break points
and then the XX is fixed but plus/minus can lead to if being less
or more, all relative to other fill (distributed)

so, XX plus (hsize - 3*indent) is not a fixed value, it's XX or more

take this:

\ruledhbox to 10cm {x\hskip0pt plus 1cm x}

the skip will stretch more than 1cm


I can see.

But sorry for my ignorance, as far as I understand, \parfillskip is added to 
the end of the paragraph, so we have rather
\ruledhbox to 10cm {x\hskip0pt plus 1cm} % without that 'x' at the end, so no 
'glue' distribution is performed


there is but not enough stretch so there will be a warning ... you can 
see it from


\ruledhbox to 10cm {x}
\ruledhbox to 10cm {x\hskip0pt plus 1cm}
\ruledhbox to 10cm {x\hskip0pt plus 1fill}



If '\parfillskip 2em plus (hsize - 3*(2em) - 2em)' is specified, I still think 
we should get space of width at least 2em '' which can be extended as 
indicated by hyphens '-' here:

emememememememememememememememememememem
emememememem

So there are two last line lengths extrems:
(shortest)
emememememememememememememememememememem
emememememem

(longest)
emememememememememememememememememememem
emememememememememememememememememem

I slightly modified your example and even with verystrict settings all seems to 
be fine (except too narrow blocks, which is not my use case).

\showmakeup[glue]

\setupindenting[yes,2em]

\edef\ward{\cldloadfile{ward}}

\setupalign[verystrict,hz]

\starttext
\dorecurse{100}{
  \hsize\dimexpr\textwidth-#1mm\relax
  \dimen0=\hsize
  \advance\dimen0 by -8em % 3*em - 2em
  \parfillskip 2em plus \dimen0\relax
  \ward  \par
  \parfillskip 2em plus \dimen0\relax
  \ward  \par
  \startnarrower[left]
  \parfillskip 2em plus \dimen0\relax
  \ward \par
  \stopnarrower
  \startnarrower[left]
  \parfillskip 2em plus \dimen0\relax
  \ward \par
  \stopnarrower
  \page
}
\stoptext

The problem here this settings cannot be done globally if there are various 
block widths.


you always add a 2em skip so there will never be a word touching the 
right margin in the last line; furthermore you permit some stretch, but 
as said before this stretch is not frozen, it's a ratio relative to 
other stretch


\ruledhbox to 10cm {x\hskip2em plus 1cm x\hskip2em plus 1cm x}

so, the plus 1cm can become more than that depending on needs (onlky the 
warning is influenced



Can I somehow define command globally which takes local block widths?

\parfillskip #1 plus \localhsize-#1-#2, where
#1 gap width
#2 shortest line width


\availablehsize

i think that the #1 gap is irrelevant and actually makes it worse as it 
add space while you actually want it to move the other direction


anyway, this is why using a couple of non-hyphenated words or a minimum 
amount of characters makes more sense


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Length range control of the last line of paragraph

2016-03-25 Thread Jan Tosovsky
On 2016-03-24 Hans Hagen wrote:
> On 3/24/2016 8:36 PM, Jan Tosovsky wrote:
> >
> > We basically need:
> > 
> >
> > and I thought this is exactly what \parfillskip ensures
> > \parfillskip XX plus (hsize - 3*indent)
> >
> 
> the fil is taken into account when calculating the best break points
> and then the XX is fixed but plus/minus can lead to if being less 
> or more, all relative to other fill (distributed)
> 
> so, XX plus (hsize - 3*indent) is not a fixed value, it's XX or more
> 
> take this:
> 
> \ruledhbox to 10cm {x\hskip0pt plus 1cm x}
> 
> the skip will stretch more than 1cm

I can see. 

But sorry for my ignorance, as far as I understand, \parfillskip is added to 
the end of the paragraph, so we have rather 
\ruledhbox to 10cm {x\hskip0pt plus 1cm} % without that 'x' at the end, so no 
'glue' distribution is performed

If '\parfillskip 2em plus (hsize - 3*(2em) - 2em)' is specified, I still think 
we should get space of width at least 2em '' which can be extended as 
indicated by hyphens '-' here:

emememememememememememememememememememem
emememememem

So there are two last line lengths extrems:
(shortest)
emememememememememememememememememememem
emememememem

(longest)
emememememememememememememememememememem
emememememememememememememememememem

I slightly modified your example and even with verystrict settings all seems to 
be fine (except too narrow blocks, which is not my use case).

\showmakeup[glue]

\setupindenting[yes,2em]

\edef\ward{\cldloadfile{ward}}

\setupalign[verystrict,hz]

\starttext
\dorecurse{100}{
 \hsize\dimexpr\textwidth-#1mm\relax
 \dimen0=\hsize
 \advance\dimen0 by -8em % 3*em - 2em
 \parfillskip 2em plus \dimen0\relax
 \ward  \par
 \parfillskip 2em plus \dimen0\relax
 \ward  \par
 \startnarrower[left]
 \parfillskip 2em plus \dimen0\relax
 \ward \par
 \stopnarrower
 \startnarrower[left]
 \parfillskip 2em plus \dimen0\relax
 \ward \par
 \stopnarrower
 \page
}
\stoptext

The problem here this settings cannot be done globally if there are various 
block widths.

Can I somehow define command globally which takes local block widths?

\parfillskip #1 plus \localhsize-#1-#2, where 
#1 gap width
#2 shortest line width

Jan

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___