[NTG-context] page range reference (how to compare references)

2016-09-23 Thread MF
Hello list,
I'm trying to reference a page range (think of a long quote spanning on
2 pages).

I need to discriminate ranges collapsing to one page from "real" ranges
(2 or more pages): "1-1" should become "1", while "1-2" should stay
like that.

Here's a not working snippet:

\starttext

Tufte quote at p.
\at[tufte:start]\doifelse{\ref[realpage][tufte:start]}{\ref[realpage][t
ufte:stop]}
{}
{-\at[tufte:stop]}

% start of quote reference
\pagereference[tufte:start]
\input{tufte}

%\page  % comment/uncomment this to toggle from range to single page

\input{tufte}
% end of quote reference
\pagereference[tufte:stop]

\stoptext

The \doifelse is always false, I think because \ref[realpage][...] is
not a string.

Thanks in advance.
BTW, best wishes for next week's meeting (hoping to join next year).
Best regards,
Massi
___
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] Size of the last shipped page by Lua?

2016-09-23 Thread Procházka Lukáš Ing .

Hello,

still a problem - consider the following code:


\ifx\startpapersize\undefined
  \unprotect
\def\startpapersize{\page\pushmacro\page_paper_restore\setuppapersize}
  \protect
\fi

\ifx\stoppapersize\undefined
  \unprotect
\def\stoppapersize{\page\popmacro\page_paper_restore\setuppapersize}
  \protect
\fi

%

\startluacode
  local tomm = function(v) return v * (210 / 39158276) end

  pgsz = function()
context("w=%.1f, h=%.1f", tomm(tex.dimen.paperwidth), 
tomm(tex.dimen.paperheight))
  end
\stopluacode

%

\starttext
  A
  \ctxlua{pgsz()}

  \startpapersize[A3,landscape]
B
\ctxlua{pgsz()}
  \stoppapersize

  \startTEXpage[width=200mm,height=100mm]
C % 3rd page
\ctxlua{pgsz()}
  \stopTEXpage
\stoptext


In the case of 3rd page (with text "C"), page size "w=210.0, h=297.0" is printed instead 
of "w=200.0, h=100.0".

So how to access values 200 and 100 mm for the page produced by 
\startTEXpage[width=...,height=...]?

Best regards,

Lukas


On Thu, 08 Sep 2016 22:12:49 +0200, Hans Hagen  wrote:


On 9/8/2016 9:47 PM, josephcan...@gmail.com wrote:

If by messing it’s meant modifying their values, I agree that’s a bad
idea 😊, the requirement is likely to read the value only (at least this
is my usage of these in shipouts « after » callback).

If these are not reliable, what’s the reliable way to get the page width
and height ?


\starttext

\ctxlua{context(number.topoints(tex.dimen.paperwidth))}

\ctxlua{context(number.topoints(tex.dimen.paperheight))}

\stoptext


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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
___



--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

PgSz.mkiv
Description: Binary data


PgSz.pdf
Description: Adobe PDF document
___
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] Size of the last shipped page by Lua?

2016-09-23 Thread Hans Hagen

On 9/23/2016 1:50 PM, Procházka Lukáš Ing. wrote:

Hello,

still a problem - consider the following code:


\ifx\startpapersize\undefined
  \unprotect
\def\startpapersize{\page\pushmacro\page_paper_restore\setuppapersize}
  \protect
\fi

\ifx\stoppapersize\undefined
  \unprotect
\def\stoppapersize{\page\popmacro\page_paper_restore\setuppapersize}
  \protect
\fi

%

\startluacode
  local tomm = function(v) return v * (210 / 39158276) end

  pgsz = function()
context("w=%.1f, h=%.1f", tomm(tex.dimen.paperwidth),
tomm(tex.dimen.paperheight))
  end
\stopluacode

%

\starttext
  A
  \ctxlua{pgsz()}

  \startpapersize[A3,landscape]
B
\ctxlua{pgsz()}
  \stoppapersize

  \startTEXpage[width=200mm,height=100mm]
C % 3rd page
\ctxlua{pgsz()}
  \stopTEXpage


the papersize of a TEXpage is known when that page is flushed and when 
you ask for it the way you do now tex is still constructing the box


it's all a matter of timing

\starttext

\appendtoks
\ctxlua{
print(
number.topoints(tex.dimen.paperwidth ),
number.topoints(tex.dimen.paperheight)
)
}%
\to \everyshipout

\setuppapersize[A4] test

\startTEXpage test \stopTEXpage

\setuppapersize[A3] test

\stoptext



\stoptext


In the case of 3rd page (with text "C"), page size "w=210.0, h=297.0" is
printed instead of "w=200.0, h=100.0".

So how to access values 200 and 100 mm for the page produced by
\startTEXpage[width=...,height=...]?

Best regards,

Lukas


On Thu, 08 Sep 2016 22:12:49 +0200, Hans Hagen  wrote:


On 9/8/2016 9:47 PM, josephcan...@gmail.com wrote:

If by messing it’s meant modifying their values, I agree that’s a bad
idea 😊, the requirement is likely to read the value only (at least this
is my usage of these in shipouts « after » callback).

If these are not reliable, what’s the reliable way to get the page width
and height ?


\starttext

\ctxlua{context(number.topoints(tex.dimen.paperwidth))}

\ctxlua{context(number.topoints(tex.dimen.paperheight))}

\stoptext


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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
___






___
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
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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] page range reference (how to compare references)

2016-09-23 Thread MF
I found a solution, but it's tricky (and there's no check on reference
existence in structures.references.collected).


\directlua{
  function userdata.printrange(singular, plural, label)
local coll_ref = structures.references.collected[""]
local pagestart = coll_ref[label .. ":start"].references.realpage
local pagestop = coll_ref[label .. ":stop"].references.realpage
if pagestart == pagestop then
  context(singular)
else
  context(plural)
end
context("~")
context.ref({"page"}, {label .. ":start"})
if pagestart ~= pagestop then
  context("-")
  context.ref({"page"}, {label .. ":stop"})
end
  end

  function userdata.printpagerange(label)
userdata.printrange("page", "pages", label)
  end
}

\def\printpagerange#1{\ctxlua{userdata.printpagerange("#1")}}

\starttext

Tufte quote at \printpagerange{tufte}.

% start of quote reference
\pagereference[tufte:start]
\input{tufte}

%\page  % comment/uncomment this to toggle from page range to single
page

\input{tufte}
% end of quote reference
\pagereference[tufte:stop]

\stoptext
___
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
___

[NTG-context] Center a framedtext

2016-09-23 Thread Fabrice Couvreur
Hello,
How to make the algorithm is centered vertically and horizontally ?
thank you,
Fabrice

\defineframedtext
  [algorithmframe]
  [width=fit,
   background=color,
   backgroundcolor=lightgray,
   framecolor=darkred,
   corner=round]

\definelines
  [algorithm]
  [space=on,
   before=\startalgorithmframe,
   after=\stopalgorithmframe]

\starttext

\startlinecorrection[blank]
\startmidaligned

\startalgorithm
Initialisation :
  \math{u} prend la valeur 2\,000
  \math{S} prend la valeur 2\,000
Traitement :
  Pour \math{i} allant de 2 à \math{n}
 \math{u} prend la valeur \math{u\times 1,008}
 \math{S} prend la valeur \math{S +u}
  Fin Pour
Sortie :
  Afficher \math{S}

\stopalgorithm

\stopmidaligned
\stoplinecorrection

\stoptext
___
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
___

[NTG-context] Problem with Cambria

2016-09-23 Thread Lutz Haseloff
Hi all,

i found a Problem with Cambria. The use of í and ì results in wrong kerning.

\setupbodyfont[cambria]
\starttext
Víctor Lidio Jara Martínez
\stoptext

gives:

Ví ctor Lidio Jara Martí nez

in the pdf.

I use latest context and luatex on Windows and Linux.


Greetings Lutz
___
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
___

[NTG-context] update/install error

2016-09-23 Thread Mikael P. Sundqvist
Hi, trying to update (running standalone, updating with

sh ./first-setup.sh --update

it runs for a while, and then halts on:

lua error   > lua error on line 74 in file
/home/mickep/ConTeXt/tex/texmf-context/tex/context/base/mkiv/node-rul.mkiv:

...eXt/tex/texmf-context/tex/context/base/mkiv/node-rul.lua:369: table
index is nil
stack traceback:
...eXt/tex/texmf-context/tex/context/base/mkiv/node-rul.lua:369: in
function 'code'
...eXt/tex/texmf-context/tex/context/base/mkiv/util-lua.lua:84: in
function 'loadedluacode'
...eXt/tex/texmf-context/tex/context/base/mkiv/luat-env.lua:104: in
function 'luafilechunk'
...eXt/tex/texmf-context/tex/context/base/mkiv/luat-cod.lua:45: in
function 'registercode'
[ctxlua]:1: in main chunk

64 %D to deal with local settings at the \TEX\ end and remembering
parameters
65 %D at the \LUA\ end. We might do things differently now, but as
settings normally
66 %D don't change that often, we're not in a hurry to do that
now. The problem at
67 %D the \LUA\ end is that we don't know when to clean up.
68
69 \unprotect
70
71 %definesystemattribute[ruled]
72 %definesystemattribute[shifted]
73
74 >>  \registerctxluafile{node-rul}{1.001}
75
76 \installcorenamespace{bar}
77 \installcorenamespace{barindex}
78 \installcorenamespace{barattribute}
79 \installcorenamespace{barstack}
80
81 \installcommandhandler \??bar {bar} \??bar
82
83 \newtoks\t_node_rules_checklist
84

The same happens when I try to install in a fresh directory.

This happens on a ubuntu machine where the standalone usually works very well.

Best regards, Mikael
___
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] Columnset and footnotes

2016-09-23 Thread Jose Luis Arellano
Hello list.
Sorry for bump my own thread. I just want to know if there is a bug in
new code (\usemodule[newcolumnsets]), if not, how can i solve the
overwrite text issue described above?

Thanks

2016-09-22 4:47 GMT-03:00 Jose Luis Arellano :
> Thank you Hans, Otared.
>
> Hans, when I use the new module, I get some errors in my document. A
> couple of question about it:
> 1. How can I balance the the text in columns?
> 2. As you can see, at compiling the following code, the text at final
> of page is overwritten. Is there a way to solve this?
>
> \usemodule[newcolumnsets]
> \definecolumnset[n2][n=2]
> \starttext
> \startcolumnset[n2]
> Footnote \footnote[foo]{This is a footnote.} \dorecurse{5}{\input linden}
> \stopcolumnset
> \stoptext
>
> Thanks again
___
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
___