[NTG-context] table cell minimum heights -- help needed

2018-12-13 Thread Taco Hoekwater
Hi all,

I am attempting to process html tables that are styled using css,
and I have problem with the ‘height’ property. CSS (or rather, the 
html browser) interprets ‘height’ as if it was a “minheight”, and
if the content does not fit, it will just enlarge the height until
it does fit.

Needless to say: I want that same functionality from the ConTeXt
table I am using to generate the PDF and not end up with text 
crossing row boundaries. And I cannot figure out how
to do it, as neither bTABLE’s \bTD nor xtable’s \startxcell
interpret a “minheight" parameter. And whatever I put in “height”
becomes the absolute value of the cell height. 

Did I miss something? I cannot imagine that this problem has not
come up before…

Best wishes,
Taco

Example code:

\starttext
\bTABLE[frame=on]
\bTR \bTD[height=20pt] \input tufte \eTD \eTR
\eTABLE
\blank[10*line]
\startxtable[frame=on]
\startxrow \startxcell[height=20pt] \input tufte \stopxcell \stopxrow
\stopxtable
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] indented headings possible?

2018-12-13 Thread Taco Hoekwater
Hi again,

Is there a way to make section headings automatically honour the current 
left- and rightskip? For example, like this:

\starttext
\showframe
\startnarrower[left]
\section{Section 1}
stuff
\stopnarrower
\stoptext

I know I could rig this up with 

  \dontleavehmode\vbox{\advance\hsize-\leftskip\section{Section 1}}\par

but that is horrible code. Is there any way to get the correct effect
using \setuphead ?

Best wishes,
Taco

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] \startnarrower

2018-12-13 Thread Hans van der Meer
Is it possible to not indent the very first line of narrower content?

Thus
\startnarrower
first line
second line
etc.
\stopnarrower

resulting in:
first line
second line
etc.

dr. Hans van der Meer


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] graphics

2018-12-13 Thread Otared Kavian
Hi Mikael,

Thank you, as ell as Alan and Henri, for giving us a simple way to use Bessel 
functions, directly in ConTeXt.
However I have a question, which may show my total ignorance of the maths 
libraries ffi and consorts: how do you specify the value of the integr $n$ when 
you want to use $J_{n}(x)$?

Best regards: OK

> On 12 Dec 2018, at 21:13, Mikael P. Sundqvist  wrote:
> 
> On Wed, Dec 12, 2018 at 9:02 PM Henri Menke  wrote:
>> 
>> On 13/12/18 8:56 AM, Alan Braslau wrote:
>>> On Wed, 12 Dec 2018 20:42:56 +0100
>>> "Mikael P. Sundqvist"  wrote:
 
 Thanks, Alan! That looks very promising. I could not make it work,
 though, and I guess that is because I use linux and do not know what
 to change for what. I installed libcerf but I assume something else is
 missing. In any case, this is one of the things it would be nice to
 have, at least as a module. I have no idea on how to realize that,
 though.
 
 /Mikael
>>> 
>>> You likely also need to install libffi - I do not know what package
>>> this is on your flavor of linux - Luigi is the ffi specialist!
>> 
>> FFI is integrated in LuaTeX >= 1.03
>> 
>> In you example you load libcerf but you are not using it.  What you are
>> actually using are the Bessel function from the C Standard library.  GCC
>> includes them as a GNU extension.
>> https://www.gnu.org/software/libc/manual/html_node/Special-Functions.html#index-j0
>> Your example also works if you remove libcerf (at least for me on Linux).
>> 
> 
> Thanks Henri! Indeed it worked now. The following example (just in
> case someone else did not get what to change) compiles here, and shows
> the expected graph. This is very good news!
> 
> \startluacode
> 
> ffi = require("ffi")
> ffi.cdef[[
> double j0(double x);
> double j1(double x);
> double jn(double x);
> ]]
> 
> \stopluacode
> 
> \startMPdefinitions{doublefun}
>  vardef jzero primary x = scantokens(lua("mp.quoted( ffi.C.j0(" &
> decimal x & "))")) enddef ;
>  vardef jone  primary x = scantokens(lua("mp.quoted( ffi.C.j1(" &
> decimal x & "))")) enddef ;
>  vardef jnprimary x = scantokens(lua("mp.quoted( ffi.C.jn(" &
> decimal x & "))")) enddef ;
> \stopMPdefinitions
> 
> 
> \starttext
> \startMPpage[instance=doublefun]
> draw function(1,"x","jone(x)",epsed(0),epsed(10),1/10) scaled 1cm;
> \stopMPpage
> \stoptext
> 
> /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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] graphics

2018-12-13 Thread Alan Braslau
Of course, it is:

double jn(int n,double x);

and

vardef jn(expr n, x) = scantokens(lua("mp.quoted( ffi.C.jn(" & decimal n & "," 
& decimal x & "))")) enddef ;

Alan

(shows that I have yet to use jn ;-)


On Thu, 13 Dec 2018 14:32:39 +0100
Otared Kavian  wrote:

> Hi Mikael,
> 
> Thank you, as ell as Alan and Henri, for giving us a simple way to use Bessel 
> functions, directly in ConTeXt.
> However I have a question, which may show my total ignorance of the maths 
> libraries ffi and consorts: how do you specify the value of the integr $n$ 
> when you want to use $J_{n}(x)$?
> 
> Best regards: OK
> 
> > On 12 Dec 2018, at 21:13, Mikael P. Sundqvist  wrote:
> > 
> > On Wed, Dec 12, 2018 at 9:02 PM Henri Menke  wrote:  
> >> 
> >> On 13/12/18 8:56 AM, Alan Braslau wrote:  
> >>> On Wed, 12 Dec 2018 20:42:56 +0100
> >>> "Mikael P. Sundqvist"  wrote:  
>  
>  Thanks, Alan! That looks very promising. I could not make it work,
>  though, and I guess that is because I use linux and do not know what
>  to change for what. I installed libcerf but I assume something else is
>  missing. In any case, this is one of the things it would be nice to
>  have, at least as a module. I have no idea on how to realize that,
>  though.
>  
>  /Mikael  
> >>> 
> >>> You likely also need to install libffi - I do not know what package
> >>> this is on your flavor of linux - Luigi is the ffi specialist!  
> >> 
> >> FFI is integrated in LuaTeX >= 1.03
> >> 
> >> In you example you load libcerf but you are not using it.  What you are
> >> actually using are the Bessel function from the C Standard library.  GCC
> >> includes them as a GNU extension.
> >> https://www.gnu.org/software/libc/manual/html_node/Special-Functions.html#index-j0
> >> Your example also works if you remove libcerf (at least for me on Linux).
> >>   
> > 
> > Thanks Henri! Indeed it worked now. The following example (just in
> > case someone else did not get what to change) compiles here, and shows
> > the expected graph. This is very good news!
> > 
> > \startluacode
> > 
> > ffi = require("ffi")
> > ffi.cdef[[
> > double j0(double x);
> > double j1(double x);
> > double jn(double x);
> > ]]
> > 
> > \stopluacode
> > 
> > \startMPdefinitions{doublefun}
> >  vardef jzero primary x = scantokens(lua("mp.quoted( ffi.C.j0(" &
> > decimal x & "))")) enddef ;
> >  vardef jone  primary x = scantokens(lua("mp.quoted( ffi.C.j1(" &
> > decimal x & "))")) enddef ;
> >  vardef jnprimary x = scantokens(lua("mp.quoted( ffi.C.jn(" &
> > decimal x & "))")) enddef ;
> > \stopMPdefinitions
> > 
> > 
> > \starttext
> > \startMPpage[instance=doublefun]
> > draw function(1,"x","jone(x)",epsed(0),epsed(10),1/10) scaled 1cm;
> > \stopMPpage
> > \stoptext
> > 
> > /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://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] \startnarrower

2018-12-13 Thread Wolfgang Schuster

Hans van der Meer schrieb am 13.12.18 um 12:15:

Is it possible to not indent the very first line of narrower content?

Thus
\startnarrower
first line
second line
etc.
\stopnarrower

resulting in:
first line
    second line
    etc.

Use a negative value for the indentation of the paragraph.

When you use the delimitedtext environment instead of narrower you can
do it with the indenting key.

\definedelimitedtext
  [narrowtext]
  [leftmargin=2em,
   indenting={yes,-2em}]

\showframe [text] [text]

\starttext

\startdelimitedtext [narrowtext]
\samplefile{zapf}
\stopdelimitedtext

\stoptext

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] graphics

2018-12-13 Thread luigi scarso
On Thu, Dec 13, 2018 at 4:45 PM Alan Braslau 
wrote:

> Of course, it is:
>
> double jn(int n,double x);
>
> and
>
> vardef jn(expr n, x) = scantokens(lua("mp.quoted( ffi.C.jn(" & decimal n &
> "," & decimal x & "))")) enddef ;
>
> Alan
>
> (shows that I have yet to use jn ;-)
>

I often use this as reference
source/texk/web2c/luatexdir/luaffi/test.lua

-- 
luigi
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] indented headings possible?

2018-12-13 Thread Wolfgang Schuster

Taco Hoekwater schrieb am 13.12.18 um 11:12:

Hi again,

Is there a way to make section headings automatically honour the current
left- and rightskip? For example, like this:

\starttext
\showframe
\startnarrower[left]
\section{Section 1}
stuff
\stopnarrower
\stoptext

I know I could rig this up with

   \dontleavehmode\vbox{\advance\hsize-\leftskip\section{Section 1}}\par

but that is horrible code. Is there any way to get the correct effect
using \setuphead ?


\setuphead
  [section]
  [aligntitle=yes]

\showframe [text] [text]

\starttext

\startnarrower[left]

\startsection[title={Section 1}]

stuff

\stopsection

\stopnarrower

\stoptext

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Drops Module

2018-12-13 Thread Peter Rolf
Hi Aditya,

thanks for the hint. I run into the same problem some time ago (also
uploaded a new version). Sadly no final fix, because I had a naming
problem (number part) with luajit some days later. The current (local)
version works so far, but is a bit hackish (no time for a clean
solution). I'll look into it on the weekend.


Peter


Am 10.12.2018 um 18:47 schrieb Aditya Mahajan:
> Hi Peter,
> 
> I noticed that the drops module recently stopping running with the error:
> 
> /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: bad
> argument #3 to 'format' (number has no integer representation)
> stack traceback:
>     [C]: in function 'string.format'
>     /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: in
> upvalue 'get_IM_paths'
>     /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1380: in
> field 'shadow'
>     [ctxlua]:1: in main chunk
> 
> This is due to the change in Lua5.3 with respect to floating point
> numbers. The simplest solution is to change '%d' to '%.0f' at
> appropriate places.
> 
> Thanks,
> Aditya
> ___
> 
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] graphics

2018-12-13 Thread Henri Menke

On 14/12/18 5:07 AM, luigi scarso wrote:
> On Thu, Dec 13, 2018 at 4:45 PM Alan Braslau 
> wrote:
> 
>> Of course, it is:
>>
>> double jn(int n,double x);
>>
>> and
>>
>> vardef jn(expr n, x) = scantokens(lua("mp.quoted( ffi.C.jn(" & decimal n &
>> "," & decimal x & "))")) enddef ;
>>
>> Alan
>>
>> (shows that I have yet to use jn ;-)
>>
> 
> I often use this as reference
> source/texk/web2c/luatexdir/luaffi/test.lua

I have some Gists on GitHub using the FFI.

Binding interpreters of other scripting languages (so far Python, R,
Guile, and Lua):
https://gist.github.com/hmenke/2d57a3aa1d3d59a265f935dd4b384c36

Rendering SVG to PDF using Cairo and rsvg2:
https://gist.github.com/hmenke/9facc3fe5ede9ed46c1838a919f7376f#file-svg-to-pdf-lua

---

Some of the code on GitHub was inspired by answers of mine on the
StackExchange network.  Here is a collection of answers using FFI.  All
the answers from TeX Stack Exchange use LaTeX.  ConTeXt is not so
popular there.

How to implement X11 code for LuaJIT's FFI?
https://stackoverflow.com/a/53689893

How to plot a function in integral form with TikZ?
https://tex.stackexchange.com/a/403797
https://tex.stackexchange.com/a/403794

Erf function in LaTeX
https://tex.stackexchange.com/a/407087

Plot a factorial function
https://tex.stackexchange.com/a/371899

Plot bessel functions
https://tex.stackexchange.com/a/368692
https://tex.stackexchange.com/a/456772
https://tex.stackexchange.com/a/160749

(Lua) LaTeX & HeVeA with partly generated things
https://tex.stackexchange.com/a/429994

How to include SVG diagrams in LaTeX?
https://tex.stackexchange.com/a/408014

> 
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] unicode table in the fontloader

2018-12-13 Thread Ulrike Fischer
Since 29.11  l-unicode.lua disables the slnunicode library with

unicode = nil

Functions from unicode.utf8 are used in various packages (latex and
plain). They are documented in the luatex manual. Simply disabling
them is not really an option for us. As we import l-unicode.lua
through the lualibs package, this means that I currently have to
revert the change manually. Would it be possible to disable the
table only in context? 

Side question: are there any plans to remove the library from the
binary?

-- 
Ulrike Fischer 
https://www.troubleshooting-tex.de/

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___