Re: [NTG-context] Can I just put a footnote without marking in the main text?

2022-05-18 Thread mf via ntg-context

Is this what you mean?

\starttext
Hello\footnotetext{Footnote without mark}.
\stoptext

Kind regards,
Massi

Il 18/05/22 07:55, Zhichu Chen via ntg-context ha scritto:

Hi everybody,


After some attempts to put footnotes in a mixed 1&2 columns layout, I 
decide to put marks in the one-column environment and flush them when 
entering the two-column environment.



The code is ugly but the result is acceptable. Except that the invisible 
footnote marks do generate something in the main text, so there's a 
blank line for each footnote.



Here's an MWE:


=

\definenote[address]
\setupnote[address][rule=off,location=text]



\definenote[putjustmark]
\setupnote[putjustmark][location=none]
\setupnotation[putjustmark][numberconversion=set 2]


\definenote[putjustnote]%[footnote] % if footnotes need to be grouped, 
uncomment the second argument and the line after \the\titlefootnotes

\setupnote[putjustnote][textcommand=\gobbleoneargument]
\setupnotation[putjustnote][numberconversion=set 2]


\newtoks\titlefootnotes


\def\thanks#1{\putjustmark{#1}\appendtoks \putjustnote{#1} \to 
\titlefootnotes}
\def\email#1{\putjustmark{#1}\appendtoks \putjustnote{#1} \to 
\titlefootnotes}



\appendtoks
   \setcounter[footnote][0] % this looks stupid because it has no effect
   %\setupnotation[footnote][numberconversion=numerals]
\to \titlefootnotes

\definenamespace
    [addr]
    [type=module,
     name=address,
     command=yes,
     setup=list,
     parent=addr,
   ]

\define[1]\useaddress
     {\setnotetext[address][#1]{\namedaddressparameter{#1}{name}}}


\starttext



\defineaddress[fst][name={Name of Institute or Affiliation, City, Country}]
\defineaddress[snd][name={Name of Secondary Institute or Affiliation, 
City, Country}]


\processcommacommand[fst,snd]\useaddress


The Title\thanks{Work supported by somebody.}

Me\email{myemail@some.where}\high{,}\note[address][fst]\high{,}\note[address][snd] 




\placenotes[address]

\blank[medium]

\startcolumns


\the\titlefootnotes

%\setcounter[footnote][0] % why it's necessary to set the counter 
outside the token if I define [putjustnote] as [footnote]?



test\footnote{test}

\input knuth



\stopcolumns

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


___
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] ignore not closed tags in XML input

2022-05-16 Thread mf via ntg-context

See HTML-tidy,

https://www.html-tidy.org/

it could help you pre-processing your HTML files.

Massi

Il 16/05/22 17:08, Pablo Rodriguez via ntg-context ha scritto:

Dear list,

I would like to feed
https://seumasjeltzz.github.io/LinguaeGraecaePerSeIllustrata/001.html as
XML input for ConTeXt.

The problem is that (as many other XML files that I haven’t generated
myself) some  and  tags aren’t closed, such as in:

   
   https://fonts/css?greek; rel="stylesheet">
   

So, all that I get is the following message:

   invalid xml file - parsed text

Unsuccessfully I have tried the following:

   \xmlsetsetup{#1}{html/head/(meta|link)}{-}

Is there no way to make ConTeXt more tolerant, so that it is able to
ignore those tags?

Many thanks for your help,

Pablo

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

2022-05-09 Thread mf via ntg-context

I'm downloading it and I see a lot of mkii files and even some Ruby files.

It looks like some old material got into the update. Is everything right?

Massi

Il 09/05/22 17:41, Hans Hagen via ntg-context ha scritto:

Hi,

I uploaded a new version of lmtx (also because some users have to test 
some new metapost functionality). In the next upload metafun will use 
'double' mode (and scaledfun will be the traditional one). The advantage 
is less dager for overflows and in the meantime running in double mode 
is often also faster.



___
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] Wiki update: create a .vsix extension package for VisualStudio Code (or VSCodium)

2022-05-05 Thread mf via ntg-context

Hello list,

I just added some instructions to the WIKI to build an extension file 
for VSCode, starting from the code you find in the LMTX installation at


tex/texmf-context/context/data/vscode/extensions/context

You find them at

https://wiki.contextgarden.net/VSCode

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


Re: [NTG-context] modify kern between two glyphs

2022-04-05 Thread mf via ntg-context
There's a problem with oldstyle glyphs, because they have different 
codes inside a font.


I used fontforge to find the "four.oldstyle" glyph, whose code is 0xf734.
But then I discovered that the 'four.oldstyle' key works the same in the 
lua table.


This is the updated MWE, suitable for oldstyle glyphs too.

--
\mainlanguage[it]

% modified from http://www.pragma-ade.com/context/latest/cont-tst.zip
% file: doc/context/tests/mkiv/fonts/extensions-001.tex

\startluacode
fonts.handlers.otf.addfeature {
name = "ktest",
type = "kern",
data = {
[ '’' ] = {
  [ '4' ] = -100,
  [ 0xf734 ] = -150, -- four.oldstyle code
  -- [ 'four.oldstyle' ] = -150, -- this is the same as the 
previous line

},
}
}
\stopluacode
\definefontfeature[ktest][ktest=yes]
\definefontfeature[onum][onum=yes]

\starttext
Default: «Questo è successo nel ’48».

Desired: «Questo è successo nel ’\kern-.1em 48».

Solved: \feature[+][ktest]«Questo è successo nel ’48».

Onum: \feature[+][onum]«Questo è successo nel ’48».

\stoptext
--

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


Re: [NTG-context] modify kern between two glyphs

2022-04-05 Thread mf via ntg-context

Il 05/04/22 13:54, Hans Hagen via ntg-context ha scritto:

On 4/5/2022 1:45 PM, mf via ntg-context wrote:

It's defined in typo-fkr.lua, but I can't understand what parameters 
to pass and whether it's the right macro. It looks like it's not.
look at the extension examples in the test suite: you can define a kern 
pair positioning feature than you enable for just that font




Thanks Hans, here's the working MWE:

---
\mainlanguage[it]

% from http://www.pragma-ade.com/context/latest/cont-tst.zip
% file doc/context/tests/mkiv/fonts/extensions-001.tex
\startluacode
fonts.handlers.otf.addfeature {
name = "ktest",
type = "kern",
data = {
[ '’' ] = { [ '4' ] = -100 },
}
}
\stopluacode
\definefontfeature[ktest][ktest=yes]

\starttext

Default: «Questo è successo nel ’48».

Desired: «Questo è successo nel ’\kern-.1em 48».

Solved: \feature[+][ktest]«Questo è successo nel ’48».

\stoptext
--

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


Re: [NTG-context] modify kern between two glyphs

2022-04-05 Thread mf via ntg-context

Il 05/04/22 13:15, Thomas A. Schmitz via ntg-context ha scritto:




On 5. Apr 2022, at 13:02, mf via ntg-context  wrote:

Is it possible to solve it globally and only for a single font?

Thanks,
Massi


Have you looked at chapter 5.4 “Goodies” of fonts-mkiv.pdf? That should get you 
started.


Thanks Thomas,
there seems to be nothing for that in the "Goodies" chapter.

I'd already found \setextrafontkerns at "8.12 Extra font kerns" of the 
same manual.
It's defined in typo-fkr.lua, but I can't understand what parameters to 
pass and whether it's the right macro. It looks like it's not.


I'm expecting there's a lua font table with glyph pairs kerning to update.

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


[NTG-context] modify kern between two glyphs

2022-04-05 Thread mf via ntg-context

Hello list,

I need to modify the kern between two glyphs.

This is a MWE where the problem is solved manually:

--
\mainlanguage[it]
\starttext

Default: «Questo è successo nel ’48».

Desired: «Questo è successo nel ’\kern-.1em 48».

\stoptext
--

Is it possible to solve it globally and only for a single font?

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


Re: [NTG-context] embedding tex and lua code in

2022-03-24 Thread mf via ntg-context

The attached MWE shows how to:

- embed tex code in  or <script 
</tt><tt>type="text/vnd.lmtx"> HTML elements to be run by ConTeXt
</tt><pre style="margin: 0em;">

- embed lua code in <script type="text/x-lua"> elements to be run by ConTeXt

- redefine xmlsetups from the HTML document itself

Massi

Il 22/03/22 17:07, mf via ntg-context ha scritto:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
I've added a <script type="text/x-lua"> in the <head> element (BTW,
"text/x-lua" is the mimetype proposed by freedesktop.org for lua scripts.

That element is managed by this code:

--
   if mimetype and mimetype == "text/x-lua" then
     local code = xml.text(s)
     context( "\\startluacode " .. code .. " \\stopluacode" )
   end
--

s is the table representing the script element.
That works, but it has a problem with one-line comments:

--
   <script type="text/x-lua">
     -- comment
     context.setuppapersize{ "A7" }
   
--

The code above is considered a long comment as if it were written as
--
   
     -- comment   context.setuppapersize{ "A7" }
   
--

so the context.setuppapersize function call is ignored.

The workaround is:
--
   
     --[[ comment --]]
     context.setuppapersize{ "A7" }
   
--

A lua analogous of \xmlcontext (line-wise) would be great.




Hans prompted me to use xml.content() instead of xml.text(). The first 
one preserves newlines, so short comments don't extend to the next line.




*  *  *

Here's another problem related to space in  elements.
This code:

--
   <script type="text/vnd.context">
     % default setup for paragraphs
     \startxmlsetups myHtml:p
   \dontleavehmode\red\xmlflush{#1}\par
     \stopxmlsetups

     % default setup for italic inlines
     \startxmlsetups myHtml:i
   {\it\blue\xmlflush{#1}}% <-- problem here
     \stopxmlsetups
   
--

adds a space after an  element.
A solution could be this:

--
   \startxmlsetups myHtml:i
     {\it\blue\xmlflush{#1}}\stopxmlsetups
--

I prefer this one:

--
   \startxmlsetups myHtml:i
     {\it\blue\xmlflush{#1}}\relax
   \stopxmlsetups
--

You need to end the line with a macro eating up all the trailing spaces 
(newlines included).


Massi

Il 22/03/22 15:23, mf via ntg-context ha scritto:

I found the solution I was looking for. The command to run is still

context --environment=nested-xmlsetup.tex --forcexml 
nested-xmlsetup.xhtml


In the  element there's some tex code, which redefines the 
</tt><tt>xmlsetups for <p> and <i> elements, coloring the first ones in red and 
</tt><tt>the second ones in blue.
</tt><pre style="margin: 0em;">

The key command is

\xmlsetsetup{\xmldocument}{p|i}{myHtml:*}

</pre><tt>where \xmldocument instead of #1 applies the myHtml:* setups to the 
</tt><tt>whole XHTML document and not only to the <script> element identified 
</tt><tt>by #1.
</tt><pre style="margin: 0em;">

</pre><tt>I tried also this, to prevent redefining the setups of <html>, <head>, 
</tt><tt><script> elements:
</tt><pre style="margin: 0em;">

\xmlsetsetup{\xmlfirst{\xmldocument}{body}}{p|i}{myHtml:*}

</pre><tt>but it doesn't work, since \xmldocument seems to be the actual 
</tt><tt>document instead of an id pointing to its root element.
</tt><pre style="margin: 0em;">

Massi

Il 10/03/22 17:52, Hans Hagen ha scritto:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
On 3/10/2022 4:59 PM, mf via ntg-context wrote:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
Hello,
</pre><tt>I'm trying to add new templates (xmlsetups) from the XML document 
</tt><tt>itself.
</tt><pre style="margin: 0em;">

See the attached MWE.

- the XML document is a simple XHTML file

</pre><tt>- in the "head" element there's a "script" element with the "type" 
</tt><tt>attribute set to "text/vnd.context",

Re: [NTG-context] redefining xmlsetups inside a XML document

2022-03-22 Thread mf via ntg-context

I've added a  in the <head> element (BTW,
"text/x-lua" is the mimetype proposed by freedesktop.org for lua scripts.

That element is managed by this code:

--
  if mimetype and mimetype == "text/x-lua" then
local code = xml.text(s)
context( "\\startluacode " .. code .. " \\stopluacode" )
  end
--

s is the table representing the script element.
That works, but it has a problem with one-line comments:

--
  <script type="text/x-lua">
-- comment
context.setuppapersize{ "A7" }
  
--

The code above is considered a long comment as if it were written as
--
  
-- comment   context.setuppapersize{ "A7" }
  
--

so the context.setuppapersize function call is ignored.

The workaround is:
--
  
--[[ comment --]]
context.setuppapersize{ "A7" }
  
--

A lua analogous of \xmlcontext (line-wise) would be great.

*  *  *

Here's another problem related to space in  elements.
This code:

--
  <script type="text/vnd.context">
% default setup for paragraphs
\startxmlsetups myHtml:p
  \dontleavehmode\red\xmlflush{#1}\par
\stopxmlsetups

% default setup for italic inlines
\startxmlsetups myHtml:i
  {\it\blue\xmlflush{#1}}% <-- problem here
\stopxmlsetups
  
--

adds a space after an  element.
A solution could be this:

--
  \startxmlsetups myHtml:i
{\it\blue\xmlflush{#1}}\stopxmlsetups
--

I prefer this one:

--
  \startxmlsetups myHtml:i
{\it\blue\xmlflush{#1}}\relax
  \stopxmlsetups
--

You need to end the line with a macro eating up all the trailing spaces 
(newlines included).


Massi

Il 22/03/22 15:23, mf via ntg-context ha scritto:

I found the solution I was looking for. The command to run is still

context --environment=nested-xmlsetup.tex --forcexml nested-xmlsetup.xhtml

In the  element there's some tex code, which redefines the 
</tt><tt>xmlsetups for <p> and <i> elements, coloring the first ones in red and 
</tt><tt>the second ones in blue.
</tt><pre style="margin: 0em;">

The key command is

\xmlsetsetup{\xmldocument}{p|i}{myHtml:*}

</pre><tt>where \xmldocument instead of #1 applies the myHtml:* setups to the 
</tt><tt>whole XHTML document and not only to the <script> element identified by #1.
</tt><pre style="margin: 0em;">

</pre><tt>I tried also this, to prevent redefining the setups of <html>, <head>, 
</tt><tt><script> elements:
</tt><pre style="margin: 0em;">

\xmlsetsetup{\xmlfirst{\xmldocument}{body}}{p|i}{myHtml:*}

</pre><tt>but it doesn't work, since \xmldocument seems to be the actual document 
</tt><tt>instead of an id pointing to its root element.
</tt><pre style="margin: 0em;">

Massi

Il 10/03/22 17:52, Hans Hagen ha scritto:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
On 3/10/2022 4:59 PM, mf via ntg-context wrote:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
Hello,
</pre><tt>I'm trying to add new templates (xmlsetups) from the XML document 
</tt><tt>itself.
</tt><pre style="margin: 0em;">

See the attached MWE.

- the XML document is a simple XHTML file

</pre><tt>- in the "head" element there's a "script" element with the "type" 
</tt><tt>attribute set to "text/vnd.context", whose contents are then passed 
</tt><tt>to \xmlcontext
</tt><pre style="margin: 0em;">

</pre><tt>- the "body" element has a "data-xmlsetups" attribute whose value 
</tt><tt>should tell which xmlsetups is to be applied on the body contents 
</tt><tt>(it's defined in the "script" element above)
</tt><pre style="margin: 0em;">

</pre><tt>If it worked, the resulting PDF should show the body element, 
</tt><tt>followed by a "Hello world!" paragraph written in red.
</tt><tt>But it does not work, because there's something I'm missing in the 
</tt><tt>redefinition and application of xmlsetups.
</tt><pre style="margin: 0em;"

Re: [NTG-context] redefining xmlsetups inside a XML document

2022-03-22 Thread mf via ntg-context

I found the solution I was looking for. The command to run is still

context --environment=nested-xmlsetup.tex --forcexml nested-xmlsetup.xhtml

In the  element there's some tex code, which redefines the 
</tt><tt>xmlsetups for <p> and <i> elements, coloring the first ones in red and 
</tt><tt>the second ones in blue.
</tt><pre style="margin: 0em;">

The key command is

\xmlsetsetup{\xmldocument}{p|i}{myHtml:*}

</pre><tt>where \xmldocument instead of #1 applies the myHtml:* setups to the 
</tt><tt>whole XHTML document and not only to the <script> element identified by #1.
</tt><pre style="margin: 0em;">

</pre><tt>I tried also this, to prevent redefining the setups of <html>, <head>, 
</tt><tt><script> elements:
</tt><pre style="margin: 0em;">

\xmlsetsetup{\xmlfirst{\xmldocument}{body}}{p|i}{myHtml:*}

</pre><tt>but it doesn't work, since \xmldocument seems to be the actual document 
</tt><tt>instead of an id pointing to its root element.
</tt><pre style="margin: 0em;">

Massi

Il 10/03/22 17:52, Hans Hagen ha scritto:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
On 3/10/2022 4:59 PM, mf via ntg-context wrote:
</pre><blockquote style="border-left: #EE solid 0.2em; margin: 0em; padding-left: 0.85em"><pre style="margin: 0em;">
Hello,
I'm trying to add new templates (xmlsetups) from the XML document itself.

See the attached MWE.

- the XML document is a simple XHTML file

</pre><tt>- in the "head" element there's a "script" element with the "type" 
</tt><tt>attribute set to "text/vnd.context", whose contents are then passed to 
</tt><tt>\xmlcontext
</tt><pre style="margin: 0em;">

</pre><tt>- the "body" element has a "data-xmlsetups" attribute whose value 
</tt><tt>should tell which xmlsetups is to be applied on the body contents 
</tt><tt>(it's defined in the "script" element above)
</tt><pre style="margin: 0em;">

</pre><tt>If it worked, the resulting PDF should show the body element, followed 
</tt><tt>by a "Hello world!" paragraph written in red.
</tt><tt>But it does not work, because there's something I'm missing in the 
</tt><tt>redefinition and application of xmlsetups.
</tt><pre style="margin: 0em;">

To try the MWE, type:

</pre><tt>context --environment=nested-xmlsetup.tex --forcexml 
</tt><tt>nested-xmlsetup.xhtml
</tt></blockquote><pre style="margin: 0em;">
     <script type="text/vnd.context">
   \startxmlsetups myHtml
    \xmlsetsetup{#1}{p}{myHtml:p}
    % you're missing this
    \xmlsetup{#1}{xml:process}
    % which is
    %  \xmlregistereddocumentsetups{#1}{#1}
    %  \xmlmain{#1}
   \stopxmlsetups

   \startxmlsetups myHtml:p
  \dontleavehmode\red\xmlflush{#1}\par
   \stopxmlsetups
     


nested-xmlsetup.xhtml
Description: application/xhtml
\startxmlsetups html
  \xmlsetsetup{#1}{{html|head}}{html:flush}
  \xmlsetsetup{#1}{{html head script}}{html:script:context}
  \xmlsetsetup{#1}{{html body}}{html:body}
  \xmlsetsetup{#1}{p|i}{html:*}
\stopxmlsetups

\startxmlsetups html:flush
  \xmlflush{#1}
\stopxmlsetups

\startluacode
function xml.functions.parseScript(s)
  local mimetype = s and s.at and s.at.type
  if mimetype and mimetype == "text/vnd.context" then
lxml.context(s)
  end
end
\stopluacode

\startxmlsetups html:script:context
  \xmlfunction{#1}{parseScript}
\stopxmlsetups

\startxmlsetups html:body
  \starttext
\xmlflush{#1}
  \stoptext
\stopxmlsetups

% default setup for paragraphs
\startxmlsetups html:p
  \dontleavehmode\xmlflush{#1}\par
\stopxmlsetups

% default setup for italic inlines
\startxmlsetups html:i
  {\it\xmlflush{#1}}%
\stopxmlsetups

\xmlregistersetup{html}
___
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] redefining xmlsetups inside a XML document

2022-03-10 Thread mf via ntg-context

Hello,
I'm trying to add new templates (xmlsetups) from the XML document itself.

See the attached MWE.

- the XML document is a simple XHTML file

- in the "head" element there's a "script" element with the "type" 
attribute set to "text/vnd.context", whose contents are then passed to 
\xmlcontext


- the "body" element has a "data-xmlsetups" attribute whose value should 
tell which xmlsetups is to be applied on the body contents (it's defined 
in the "script" element above)


If it worked, the resulting PDF should show the body element, followed 
by a "Hello world!" paragraph written in red.
But it does not work, because there's something I'm missing in the 
redefinition and application of xmlsetups.


To try the MWE, type:

context --environment=nested-xmlsetup.tex --forcexml nested-xmlsetup.xhtml

Massi\startxmlsetups html
  \xmlsetsetup{#1}{{html|head}}{html:flush}
  \xmlsetsetup{#1}{{html head script}}{html:script:context}
  \xmlsetsetup{#1}{{html body}}{html:body}
  \xmlsetsetup{#1}{p}{html:p}
\stopxmlsetups

\startxmlsetups html:flush
  \xmlflush{#1}
\stopxmlsetups

\startluacode
function xml.functions.parseScript(s)
  local mimetype = s and s.at and s.at.type
  if mimetype and mimetype == "text/vnd.context" then
lxml.context(s)
  end
end
function xml.functions.flushBody(b)
  local xmlsetups = b and b.at and b.at["data-xmlsetups"]
  if xmlsetups then
lxml.tobuffer(b, ".", "body")
context("\\typebuffer[body]")
context.xmlprocessbuffer("body", "body", xmlsetups)
  else
lxml.flush(b)
  end
end
\stopluacode

\startxmlsetups html:script:context
  \xmlfunction{#1}{parseScript}
\stopxmlsetups

\startxmlsetups html:body
  \starttext
\xmlfunction{#1}{flushBody}
  \stoptext
\stopxmlsetups

\startxmlsetups html:p
  \dontleavehmode\xmlflush{#1}\par
\stopxmlsetups

\xmlregistersetup{html}


nested-xmlsetup.xhtml
Description: application/xhtml
___
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] definedfont vs switchtobodyfont (was "shrink inter-line space")

2021-12-20 Thread mf via ntg-context

Il 18/12/21 13:00, Wolfgang Schuster ha scritto:

\definefontfeature [tightlines] [dimensions={*,0,0}]

\starttext

\samplefile{ward}\par

\blank

\start
     \setupinterlinespace[line=5pt]
     \definedfont[Normal*default,tightlines]
     \samplefile{ward}\par
\stop

\stoptext



Thanks Wolfgang.

I tried this:

\definefontfeature [tightlines] [dimensions={*,0,0}]

\starttext

\samplefile{ward}\par

\blank

\start
\setupinterlinespace[line=5pt]
\feature[+][tightlines]
\samplefile{ward}\par
\stop

\stoptext

but it doesn't add the feature to the current font.
I understand I need a font switch.
Usually I use \switchtobodyfont. How is \definedfont different?

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


Re: [NTG-context] shrink inter-line space

2021-12-18 Thread mf via ntg-context

Il 17/12/21 20:17, Wolfgang Schuster ha scritto:> \starttext
>
> \samplefile{ward}\par
>
> \blank
>
> \start \setupinterlinespace[line=12pt]
> \samplefile{ward}\par
> \stop
>
> \stoptext
Yes, but you can't say \setupinterlinespace[line=6pt] and make lines 
overlap. At a certain point baselines don't get closer any more.


--
\starttext

\samplefile{ward}\par

\blank

\start \setupinterlinespace[line=12pt]
\samplefile{ward}\par
\stop

\blank

\start \setupinterlinespace[line=6pt]
\samplefile{ward}\par
\stop

\stoptext
--

You can do something like this:

--
\starttext

\samplefile{ward}\par

\blank

\start \setupinterlinespace[line=12pt]
\samplefile{ward}\par
\stop

\blank

The Earth, as a habitat for animal life, is in old age and has a fatal 
illness.\vadjust{\kern-6pt}
Several, in fact. It would be happening whether humans had ever evolved 
or not.\vadjust{\kern-6pt}
But our presence is like the effect of an old-age patient who smokes 
many packs\vadjust{\kern-6pt}

of cigarettes per day—and we humans are the cigarettes.

\stoptext
--

but I had to insert all those \kern-6pt manually.
How can I obtain the same result automatically?
(please don't argue about the ugliness of the result ;) )

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


[NTG-context] shrink inter-line space

2021-12-17 Thread mf via ntg-context

Hello list,
here's a MWE to shrink the distance between two lines:

\starttext
\samplefile{ward}\par
\blank
\bgroup
\baselineskip=0pt
\samplefile{ward}\par
\egroup
\stoptext

How can I get lines closer, even overlapping?

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


Re: [NTG-context] Indentation inside \framed won't go away

2021-10-21 Thread mf via ntg-context

\definepapersize[a4-portrait][A4][A4]
\setuppapersize[a4-portrait]
\setuplayout[topspace=10mm,backspace=15mm,header=50pt,footer=50pt,textwidth=165mm,height=middle,width=middle]

\starttext

\offset[x=\dimexpr11mm\relax,y=\dimexpr23mm\relax]
{\framed[frame=on,offset=none,align=flushleft]
{% percent sign here, otherwise you get a space
Chief Vitalstatistix\\
Getafix\\
Dogmatix\\
Asterix\\
Obelix\\
}
}
\stoptext

Massi

Il 21/10/21 10:32, Ramkumar KB via ntg-context ha scritto:

Hello,

I have this nagging issue of indentation (in the 1st line) showing up 
inside \framed in spite of all the commands to skip indentation (see 
attached PDF).


It appears that *\setupindenting[no]* is not playing any role here and 
some other parameter is overriding  this.


Any tips would be appreciated.

best regards,
Ramkumar

\definepapersize[a4-portrait][A4][A4]
\setuppapersize[a4-portrait]
\setuplayout[topspace=10mm,backspace=15mm,header=50pt,footer=50pt,textwidth=165mm,height=middle,width=middle]

\starttext

\offset[x=\dimexpr11mm\relax,y=\dimexpr23mm\relax]
{\framed[frame=on,offset=none,align=flushleft]
{
% \startparagraph[align=high]
\setupindenting[no]
Chief Vitalstatistix\\
Getafix\\
Dogmatix\\
Asterix\\
Obelix\\
}
}
\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
___


___
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] SVG not rendering correctly with LMTX and conversion=mp

2021-10-18 Thread mf via ntg-context

Il 18/10/21 18:30, Hans Hagen via ntg-context ha scritto:

On 10/18/2021 6:06 PM, mf via ntg-context wrote:

Il 18/10/21 17:15, Jason Ross via ntg-context ha scritto:

The following MWE fails to render the text in the attached SVG properly:


\starttext
\externalfigure[test.svg][conversion=mp]
\stoptext


The axis labels, tick labels, and title are all incorrect. This file was
generated with Matplotlib.



If you open test.svg with Inkscape, ungroup and then save, you get a 
SVG that is typeset right with LMTX.


Looking at the differences between the two SVGs, I can see that 
Inkscape changes all the transform="translate(...)scale(...)" 
attributes into transform="matrix(...)".


Now focus on the "y = sin(x)" text.
In the attachment I modified the transform attributes of that text, 
from "translate(...)scale(...)" to "matrix(...)", taking the values 
from the version obtained from Inkscape.


Use that SVG with your MWE and you'll see "y = sin(x)" appearing in 
the right place in the PDF.


I would say the "translate(...)scale(...)" specification is not 
supported in LMTX (yet).
it is supported; i'll send you a snippet to test (as it was not really a 
minimal example)




Coming soon... (see attachment)

The problem was the order in which transformations are applied when 
multiple transformations are specified in the transform attribute, like 
in "translate(...)scale(...)...".


testsvg.tex and test.svg are the MWE and the SVG file provided by Jason 
Ross in the first post of this thread.


Massi


testsvg.pdf
Description: Adobe PDF document
\starttext
\externalfigure[test.svg][conversion=mp]
\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
___


Re: [NTG-context] SVG not rendering correctly with LMTX and conversion=mp

2021-10-18 Thread mf via ntg-context

Here it's wrong. See attachment.

Massimiliano

Il 18/10/21 18:30, Hans Hagen via ntg-context ha scritto:

On 10/18/2021 6:06 PM, mf via ntg-context wrote:

Il 18/10/21 17:15, Jason Ross via ntg-context ha scritto:

The following MWE fails to render the text in the attached SVG properly:


\starttext
\externalfigure[test.svg][conversion=mp]
\stoptext


The axis labels, tick labels, and title are all incorrect. This file was
generated with Matplotlib.



If you open test.svg with Inkscape, ungroup and then save, you get a 
SVG that is typeset right with LMTX.


Looking at the differences between the two SVGs, I can see that 
Inkscape changes all the transform="translate(...)scale(...)" 
attributes into transform="matrix(...)".


Now focus on the "y = sin(x)" text.
In the attachment I modified the transform attributes of that text, 
from "translate(...)scale(...)" to "matrix(...)", taking the values 
from the version obtained from Inkscape.


Use that SVG with your MWE and you'll see "y = sin(x)" appearing in 
the right place in the PDF.


I would say the "translate(...)scale(...)" specification is not 
supported in LMTX (yet).
it is supported; i'll send you a snippet to test (as it was not really a 
minimal example)


Hans

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



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


Re: [NTG-context] SVG not rendering correctly with LMTX and conversion=mp

2021-10-18 Thread mf via ntg-context

Il 18/10/21 17:15, Jason Ross via ntg-context ha scritto:

The following MWE fails to render the text in the attached SVG properly:


\starttext
\externalfigure[test.svg][conversion=mp]
\stoptext


The axis labels, tick labels, and title are all incorrect. This file was
generated with Matplotlib.



If you open test.svg with Inkscape, ungroup and then save, you get a SVG 
that is typeset right with LMTX.


Looking at the differences between the two SVGs, I can see that Inkscape 
changes all the transform="translate(...)scale(...)" attributes into 
transform="matrix(...)".


Now focus on the "y = sin(x)" text.
In the attachment I modified the transform attributes of that text, from 
"translate(...)scale(...)" to "matrix(...)", taking the values from the 
version obtained from Inkscape.


Use that SVG with your MWE and you'll see "y = sin(x)" appearing in the 
right place in the PDF.


I would say the "translate(...)scale(...)" specification is not 
supported in LMTX (yet).


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


Re: [NTG-context] undefined command in current latest

2021-10-11 Thread mf via ntg-context
It looks like the argument of \getmarking is not expanded, since you get 
"\it knuth" instead of an italicized "knuth" in the headers of this MWE:


\definemarking[myheader]
\setupheadertexts[{\getmarking[myheader][last]}]
\starttext
  \dorecurse{10}{\samplefile{knuth}\marking[myheader]{\it knuth}\par}
\stoptext

context version: 2021.10.10 23:43

Massi


Il 11/10/21 09:06, Alexandre Christe via ntg-context ha scritto:
Indeed I can report similar issues with \getmarking after updating to 
the latest version of Context. Did something change regarding its 
definition / use recently?


context -version
mtx-context     | ConTeXt Process Management 1.04
mtx-context     |
mtx-context     | main context file: 
/Users/aleks/context-osx-64/tex/texmf-context/tex/context/base/mkiv/context.mkiv

mtx-context     | current version: 2021.10.08 20:18
mtx-context     | main context file: 
/Users/aleks/context-osx-64/tex/texmf-context/tex/context/base/mkxl/context.mkxl

mtx-context     | current version: 2021.10.08 20:18

Alex


___
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] Addition of authortitle sorttype for bibliographies

2021-10-05 Thread mf via ntg-context

probably got lost when my mail address was in transition



I sent you some mails during that period that were not answered.
I thought it was a retaliation for not presenting anything at the meeting :)

Anyway I'll prepare an article on running ConTeXt inside a container 
that could eventually end in the current issue of CJ, since Hraban wrote 
that


> New articles are also welcome, as always!

Massimiliano
___
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] new upload

2021-08-31 Thread mf via ntg-context

The problem on lowlevel-alignments.pdf is solved too.
Now the update process is OK again.
Thanks.
Massi

Il 30/08/21 20:01, Hans Hagen via ntg-context ha scritto:

On 8/30/2021 7:27 PM, Rik Kabel via ntg-context wrote:
The corrected upload (2021.08.30 16:23) still has an issue. The 
--autopdf option results in:


╰─► context --autopdf test.tex
lua error : function call: 
...TX/tex/texmf-context/scripts/context/lua/mtx-context.lua:488: 
attempt to call a nil value (global 'filenewsuffix')


Without autopdf things work as expected.

ok. new upload

(the installer for windows arm64 should now work too, as i just tested 
it on the rpi 4 with windows 11)


Hans


___
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] new upload

2021-08-30 Thread mf via ntg-context

There's a problem downloading lowlevel-alignments.pdf.
Here's a slice of the log of install.sh:

mtx-install | updating tex/texmf, 1530 files
mtx-install | updating tex/texmf-context, 4130 files
mtx-install | changed  :   0 % :27550 : 
tex/texmf-context/context/data/scite/context/lexers/data/scite-context-data-context.lua
mtx-install | changed  :   1 % :15493 : 
tex/texmf-context/context/data/scite/context/lexers/data/scite-context-data-tex.lua
mtx-install | changed  :   1 % :23670 : 
tex/texmf-context/context/data/scite/context/scite-context-data-context.properties
mtx-install | changed  :   2 % :13061 : 
tex/texmf-context/context/data/scite/context/scite-context-data-tex.properties
mtx-install | changed  :   2 % :27550 : 
tex/texmf-context/context/data/textadept/context/data/scite-context-data-context.lua
mtx-install | changed  :   3 % :15493 : 
tex/texmf-context/context/data/textadept/context/data/scite-context-data-tex.lua
mtx-install | changed  :   3 % :   150521 : 
tex/texmf-context/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json
mtx-install | added:   7 % :  199 : 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf
mtx-install | 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf, 
trying again:
mtx-install | added:   7 % :  199 : 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf
mtx-install | 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf, 
trying again:
mtx-install | added:   7 % :  199 : 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf
mtx-install | 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf, 
trying again:
mtx-install | added:   7 % :  199 : 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf
mtx-install | 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf, 
trying again:
mtx-install | added:   7 % :  199 : 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf
mtx-install | 
tex/texmf-context/doc/context/documents/general/manuals/lowlevel-alignments.pdf, 
try again later:


After 5 unsuccessful trials to download the file, the updating process 
does not complete. The script ends without errors, but it's clear the 
update has failed.


Massi


Il 30/08/21 16:30, Hans Hagen via ntg-context ha scritto:

Hi,

new in this upload are some features in tabulate (not all enabled yet), 
like


\starttabulate[|lG{.}|cG{,}|rG{=}|cG{x}|]
\NC 1.1 \NC 2,2 \NC 3=3 \NC a 0xFF   \NC \NR
\NC 11.11   \NC 22,22   \NC 33=33   \NC b 0xFFF  \NC \NR
\NC 111.111 \NC 222,222 \NC 333=333 \NC c 0x \NC \NR
\stoptabulate

\starttabulate[|lG{}|lG{}|]
\NC \showglyphs \setalignmentcharacter{.}1.1 \NC 
\setalignmentcharacter{.}1.1 \NC\NR
\NC \showglyphs \setalignmentcharacter{,}11,11   \NC 
\setalignmentcharacter{,}11,11   \NC\NR
\NC \showglyphs \setalignmentcharacter{=}111=111 \NC 
\setalignmentcharacter{=}111=111 \NC\NR

\stoptabulate

\starttabulate[|lG{.}|lG{}|]
\NC 1.1 \NC \setalignmentcharacter{.}1.1 \NC\NR
\NC 11.11   \NC \setalignmentcharacter{.}11.11   \NC\NR
\NC 111.111 \NC \setalignmentcharacter{.}111.111 \NC\NR
\stoptabulate

\starttabulate[|lG{.}|rG{.}|]
\NC foo.bar \NC foo.bar \NC \NR
\NC  oo.ba  \NC  oo.ba  \NC \NR
\NC   o.b   \NC   o.b   \NC \NR
\stoptabulate

\starttabulate[|cG{d}|]
\NC \smallcaps abcdefgh \NC \NR
\NC  xdy    \NC \NR
\NC \sl  xdy    \NC \NR
\NC \tttf    xdy    \NC \NR
\NC \tfd  d \NC \NR
\stoptabulate

The G option is like g but better so it sort of replaces it.

updated: lowlevel-expansion   (also discusses luametatex)
new    : lowlevel-alignments  (also discusses luametatex)

Hans


-
   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://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 : 

Re: [NTG-context] error in mtxrun.lua line 4548 in August 24th update

2021-08-25 Thread mf via ntg-context

Il 25/08/21 14:06, Hans Hagen ha scritto:

On 8/25/2021 1:20 PM, mf via ntg-context wrote:

Il 25/08/21 13:06, Hans Hagen ha scritto:

On 8/25/2021 11:18 AM, mf via ntg-context wrote:

Hello,
here's the error I get:

lua error : function call: 
...si/context/lmtx-latest/tex/texmf-linux-64/bin/mtxrun.lua:4548: 
bad argument #2 to 'lpegmatch' (string expected, got nil)


BTW I was trying to compile lowlevel-expansion.tex in

tex/texmf-context/doc/context/sources/general/manuals/lowlevel

after I've seen (looking at the diffs in the git repo) there were 
some updates in the manual.
It works here ... can you try with the top line removed? Otherwise we 
need to zoom in on where it fails (some path split issue).

Yes, it's the runpath directive not working.

ok, so can you track that down in mtx-context.lua? (i know you can)



The problem is that the argument "one" is nil, but the function 
file.join checks only for one=="".


Lines 4541--4548:

4541  function file.join(one,two,three,...)
4542   if not two then
4543return one=="" and one or lpegmatch(reslasher,one)
4544   end
4545   if one=="" then
4546return lpegmatch(stripper,three and concat({ two,three,... 
},"/") or two)

4547   end
4548   if lpegmatch(isnetwork,one) then

At line 4545 you check only for one being an empty string, but it 
happens to be nil, so the program fails at line 4548.


Patching line 4545 like this:

4545   if not one or one=="" then

removes the error.

I leave to you whether the "one" argument should arrive nil to that 
line, or it should be normalized to an empty string before entering 
file.join.


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


Re: [NTG-context] error in mtxrun.lua line 4548 in August 24th update

2021-08-25 Thread mf via ntg-context

Il 25/08/21 13:06, Hans Hagen ha scritto:

On 8/25/2021 11:18 AM, mf via ntg-context wrote:

Hello,
here's the error I get:

lua error : function call: 
...si/context/lmtx-latest/tex/texmf-linux-64/bin/mtxrun.lua:4548: bad 
argument #2 to 'lpegmatch' (string expected, got nil)


BTW I was trying to compile lowlevel-expansion.tex in

tex/texmf-context/doc/context/sources/general/manuals/lowlevel

after I've seen (looking at the diffs in the git repo) there were some 
updates in the manual.
It works here ... can you try with the top line removed? Otherwise we 
need to zoom in on where it fails (some path split issue).

Yes, it's the runpath directive not working.
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] error in mtxrun.lua line 4548 in August 24th update

2021-08-25 Thread mf via ntg-context

Hello,
here's the error I get:

lua error : function call: 
...si/context/lmtx-latest/tex/texmf-linux-64/bin/mtxrun.lua:4548: bad 
argument #2 to 'lpegmatch' (string expected, got nil)


BTW I was trying to compile lowlevel-expansion.tex in

tex/texmf-context/doc/context/sources/general/manuals/lowlevel

after I've seen (looking at the diffs in the git repo) there were some 
updates in the manual.


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


Re: [NTG-context] new upload

2021-05-27 Thread mf

Il 25/05/21 18:20, Hans Hagen ha scritto:


Inserts are somewhat complex (and interwoven) and are also somewhat 
fuzzy when one wants to do checking when making progress on a page.  We 
already deal with that in context in a reasonable way but I get the 
feeling that we can do better. This and the above are reasons to come up 
with a variant memory model that permits playing with additional 
features more easily. The existing storage model is stil there (after 
all it's tex) but for those willing to check the alternative, in 
page-ins.mkxl one can uncomment


    % \insertmode\plustwo

and remake the format.


I tested it with 2 volumes (632 and 936 pages). Both have 2 kinds of 
footnotes; in the first there are also footnotes inside footnotes.


diffpdf says the resulting PDFs are identical to the ones obtained with 
that line commented out.


So, regarding those two samples, the change has no effect in the output.

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


Re: [NTG-context] Stack size for arguments too small in LMTX

2021-05-25 Thread mf

Il 25/05/21 17:25, Henri Menke ha scritto:

Dear list,

For some reason pgfplots has a \pgfkeys invocation where the argument
has more than 4000 lines. This crashes LuaMetaTeX with the message

 tex error > tex error on line 4045 in file pgfplots.code.tex: TeX capacity 
exceeded, sorry [token memory size=100]

It doesn't seem to be an issue with LuaTeX, so my guess is that token
memory size is larger in LuaTeX.  Could you please increase the stack
size to make this edge case compile again?

This issue was originally reported on the pgfplots bugtracker:
https://github.com/pgf-tikz/pgfplots/issues/398



Next lmtx upload will fix the issue (a configuration file that has not 
been updated).

Hans told me to do this:

cp ./tex/texmf-context/web2c/contextcnf.lua ./tex/texmf/web2c/texmfcnf.lua
mtxrun --generate
context --make

in lmtx base dir.
It should fix the issue until next upload.

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


Re: [NTG-context] custom zig zag sidebars

2021-04-29 Thread mf

Il 28/04/21 17:53, Hans Hagen ha scritto:

On 4/28/2021 5:27 PM, mf wrote:

Hello,

I made an experiment to add alternatives to sidebars (see attachment).

I discovered the sidebar is drawn by anch_sidebars_draw in 
metapost/context/base/mpiv/mp-apos.mpiv.


I've redefined it locally to add alternatives.

To make fancy, zig zag bars I defined a macro, draw_pattern_bar, that 
draws a bar repeating a pattern which is a path connecting (0,0) and 
(1,0).


The macro has 3 parameters (actually it has more params, but the 
remainder are anch_sidebars_draw params):


- a pattern, which is a path from (0,0) to (1,0) that should have a 
vertical size = 1; it's a sort of waveform


- a pattern length, by which the pattern is xsized

- a pattern width, by which the pattern is ysized

Then the pattern is rotated along the bar direction (so -90 degrees) 
and drawn many times until it covers the bar length.


A proposal and a question:

- patternlength and patternwidth could become \setupsidebar params; 
alternative (=2,3,4...) could be used to specify the pattern (a sort 
of waveform); currently alternative=0 is a solid bar and alternative=1 
is a dashed one


- in case of long patterns (a patternlength spanning more lines of 
text) the last replica of the pattern should be clipped not to exceed 
the last line of the sidebarred text (see the last example): how can 
that be done?

how about

def draw_pattern_bar(expr a, b, pattern, patternlength, patternheight, 
linewidth, linecolor) =

    draw image (
    begingroup ;
    save p, q, stp ;
    pair p, q, stp ;
    stp := ( ( b - a ) / arclength( a -- b ) ) * patternlength ;
    path q ; q := pattern xscaled patternlength yscaled 
patternheight rotated (angle(stp)) ;

    p := a ;
    forever :
    draw
    q shifted p
    withpen pencircle scaled linewidth
    withcolor linecolor ;
    p := p + stp ;
    exitif arclength( a -- p ) > arclength( a -- b ) ;
    endfor ;
    endgroup ;
    clip currentpicture to
    (xpart llcorner currentpicture, ypart b) --
    (xpart lrcorner currentpicture, ypart b) --
    (xpart urcorner currentpicture, ypart a) --
    (xpart ulcorner currentpicture, ypart a) -- cycle ;
    ) ;
enddef ;



Thank you, Hans.

To save this example, I wikified \setupsidebar, \definesidebar and 
\startsidebar...\stopsidebar.


If you do something on alternatives, let me know.

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


[NTG-context] custom zig zag sidebars

2021-04-28 Thread mf

Hello,

I made an experiment to add alternatives to sidebars (see attachment).

I discovered the sidebar is drawn by anch_sidebars_draw in 
metapost/context/base/mpiv/mp-apos.mpiv.


I've redefined it locally to add alternatives.

To make fancy, zig zag bars I defined a macro, draw_pattern_bar, that 
draws a bar repeating a pattern which is a path connecting (0,0) and (1,0).


The macro has 3 parameters (actually it has more params, but the 
remainder are anch_sidebars_draw params):


- a pattern, which is a path from (0,0) to (1,0) that should have a 
vertical size = 1; it's a sort of waveform


- a pattern length, by which the pattern is xsized

- a pattern width, by which the pattern is ysized

Then the pattern is rotated along the bar direction (so -90 degrees) and 
drawn many times until it covers the bar length.


A proposal and a question:

- patternlength and patternwidth could become \setupsidebar params; 
alternative (=2,3,4...) could be used to specify the pattern (a sort of 
waveform); currently alternative=0 is a solid bar and alternative=1 is a 
dashed one


- in case of long patterns (a patternlength spanning more lines of text) 
the last replica of the pattern should be clipped not to exceed the last 
line of the sidebarred text (see the last example): how can that be done?


Massi


\definesidebar[zigzag1][rulecolor=black,distance=4pt,rulethickness=1pt,alternative=2]
\definesidebar[zigzag2][rulecolor=red,distance=4pt,rulethickness=1pt,alternative=3]
\definesidebar[wave1][rulecolor=blue,distance=4pt,rulethickness=1pt,alternative=4]
\definesidebar[wave2][rulecolor=cyan,distance=4pt,rulethickness=1pt,alternative=5]
\definesidebar[obliquedashes][rulecolor=darkgreen,distance=4pt,rulethickness=1pt,alternative=6]
\definesidebar[longobliquedashes][rulecolor=orange,distance=10pt,rulethickness=1pt,alternative=7]

\startMPcode
def draw_pattern_bar(expr a, b, pattern, patternlength, patternheight, linewidth, linecolor) =
begingroup ;
save p, z, step ;
pair p, z, step ;
step := ( ( b - a ) / arclength( a -- b ) ) * patternlength ;
path z ; z := pattern xscaled patternlength yscaled patternheight rotated (angle(step)) ;
p := a ;
forever :
draw
z shifted p
withpen pencircle scaled linewidth
withcolor linecolor ;
p := p + step ;
exitif arclength( a -- p ) > arclength( a -- b ) ;
endfor ;
endgroup ;
enddef ;

% from metapost/context/base/mpiv/mp-apos.mpiv
def anch_sidebars_draw (expr p_b_self, p_e_self, y_b_self, y_e_self, h_b_self, d_e_self,
x, y, w, h, alternative, distance, linewidth, linecolor, topoffset, bottomoffset) =
% beware, we anchor at (x,y)
begingroup ;
if alternative = 1 :
interim linecap := rounded ;
else :
interim linecap := butt ;
fi ;
save a, b ; pair a, b ;
if p_b_self = p_e_self :
a := (-distance,y_b_self+h_b_self-y) ;
b := (-distance,y_e_self-d_e_self-y) ;
elseif RealPageNumber = p_b_self :
a := (-distance,y_b_self+h_b_self-y) ;
b := (-distance,0) ;
elseif RealPageNumber = p_e_self :
a := (-distance,h) ;
b := (-distance,y_e_self-d_e_self-y) ;
else :
a := (-distance,h) ;
b := (-distance,0) ;
fi ;
a := (xpart a, min(ypart a + topoffset,   h)) ;
b := (xpart b, max(ypart b - bottomoffset,0)) ;
if alternative = 2 :
draw_pattern_bar( a, b, ((0,0)--(0.25,-0.5)--(0.75,0.5)--(1,0)), 2pt, 2pt, linewidth, linecolor ) ;
elseif alternative = 3 :
draw_pattern_bar( a, b, ((0,0)--(0.25,-0.5)--(0.75,0.5)--(1,0)), 4pt, 1.5pt, linewidth, linecolor ) ;
elseif alternative = 4 :
draw_pattern_bar( a, b, ( ((0,0) .. controls (0,0.5) and (0.5,0.5) .. (0.5,0)) -- ((0.5,0) .. controls (0.5,-0.5) and (1,-0.5) .. (1,0)) ), 6pt, 4pt, linewidth, linecolor ) ;
elseif alternative = 5 :
draw_pattern_bar( a, b, ( (0,0) .. controls (0,1) and (1,1) .. (1,0) ), 4pt, 2pt, linewidth, linecolor ) ;
elseif alternative = 6 :
draw_pattern_bar( a, b, ( (0,0.5) .. (1,-0.5) ), 4pt, 2pt, linewidth, linecolor ) ;
elseif alternative = 7 :
draw_pattern_bar( a, b, ( (0,-0.5) .. (1,0.5) ), 22pt, 5pt, linewidth, linecolor ) ;
else :
draw
a -- b
if alternative = 1 :
dashed (withdots scaled (linewidth/2))
fi
withpen pencircle scaled linewidth
withcolor linecolor ;
fi ;
endgroup ;
enddef ;
\stopMPcode

\starttext
\startsidebar[zigzag1]\input knuth\relax\stopsidebar\par
\blank
\startsidebar[zigzag2]\input sapolsky\relax\stopsidebar\par
\blank
\startsidebar[wave1]\input knuth\relax\stopsidebar\par
\blank
\startsidebar[wave2]\input sapolsky\relax\stopsidebar\par
\blank
\startsidebar[obliquedashes]\input knuth\relax\stopsidebar\par
\blank
\startsidebar[longobliquedashes]\input 

Re: [NTG-context] clubs and widows in columns

2021-04-26 Thread mf

Il 25/04/21 22:19, Jano Kula ha scritto:

Dear list,

is there a way to avoid clubs and widows in columns? I don't know, how 
it would be implemented, if the task is splitting typeset vertical list.


\setuppapersize[A7]
\starttext
\startcolumns[separator=rule,
               align={right,nothyphenated}]
\dorecurse{12}{→ one two three four five\par}
\stopcolumns
\stoptext

For a different task: are there some higher level commands in ctx than 
\vsplitprimitive to play with vbox splitting?




As a workaround, you could try switching to pagecolumns: since they are 
typeset as pages and then rearranged as columns on a page, I expect 
clubs' and widows' penalties to work as in a single page.

I've not tried, anyway.

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


Re: [NTG-context] nbsp in XML (S01E01)

2021-04-21 Thread mf

Try this:

%\xmltexentity{nbsp}{\nobreakspace}

\xmlsetentity{nbsp}{ } % U+00A0 NBSP between braces

%\xmlsetentity{nbsp}{ } % U+0020 normal space between braces



\startbuffer[doc]





Temperature 20 °C 20 °C 20 °C 20 °C average.

Altitude 6000m 6000m 6000m 6000m 
average.




\stopbuffer



\startluacode

--[[

function lxml.preprocessor(data)

-- data = string.gsub(data, "", "~")

-- replacement nbsp invisible in luacode

data = string.gsub(data, "", " ")

return data

end

--]]

\stopluacode





\startxmlsetups xml:name

\xmlsetsetup{\xmldocument}{*}{-}

\xmlsetsetup{\xmldocument}{document|p}{xml:name:*}

\stopxmlsetups

\xmlregistersetup{xml:name}



\startxmlsetups xml:name:document

\xmlflush{#1}\par

\stopxmlsetups



\startxmlsetups xml:name:p

\parfillskip0pt\xmlflush{#1}\par

\stopxmlsetups



\startTEXpage[offset=5mm,width=60mm]

\xmlprocessbuffer{xml:name}{doc}{}

\stopTEXpage




Massi

Il 21/04/21 20:17, Jano Kula ha scritto:

Dear list,

first episode of series on nbsp of XML in lmtx.
Unfortunately, not that catchy as Netflix.

Used XML input has two types of non-breakable space:

  * unicode character
  * html entitity (in fact an ugly output of HTML editor)

HTML is preprocessed with ctx preprocessor (great feature!) and 
substituted for unicode char nbsp or tilde.


MWE shows unichar spaces are non-breakable (see end of the first lines), 
however they are not stretchable (see second line of the paragraphs).


Does unicode nbsp have fixed with in ctx?

When tilde is the replacement in preprocessor (uncomment first 
replacement in preprocessor), xmlfush will display tilde (which is, as 
character, non-breakable and unstretchable, no surprise).


Why tilde is displayed?

Replacing or adding nbsp (tilde) with finalizers have different results, 
see next episode after this one is understood.


Thank you,
Jano

MWE (rather use attached file not to loose invisible characters):

\startbuffer[doc]


         Temperature 20 °C 20 °C 20 °C 20 °C average.
         Altitude 6000nbsp;m 6000nbsp;m 6000nbsp;m 
6000nbsp;m average.


\stopbuffer

\startluacode
function lxml.preprocessor(data)
     -- data = string.gsub(data, "nbsp;", "~")
     -- replacement nbsp invisible in luacode
     data = string.gsub(data, "nbsp;", " ")
     return data
end
\stopluacode


\startxmlsetups xml:name
     \xmlsetsetup{\xmldocument}{*}{-}
     \xmlsetsetup{\xmldocument}{document|p}{xml:name:*}
\stopxmlsetups
\xmlregistersetup{xml:name}

\startxmlsetups xml:name:document
\xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:name:p
\parfillskip0pt\xmlflush{#1}\par
\stopxmlsetups

\startTEXpage[offset=5mm,width=60mm]
\xmlprocessbuffer{xml:name}{doc}{}
\stopTEXpage


___
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] metafun / patterns

2021-03-25 Thread mf
Sorry for the noise, my fault: Thunderbird replaced some semicolon 
combinations with emojis, so they were missing when I copied and pasted 
them in a source file.


Massi

Il 25/03/21 15:14, mf ha scritto:

Il 25/03/21 14:11, Hans Hagen ha scritto:


\startMPpage[offset=1cm]
 draw (fullcircle scaled 5cm shifted (0cm,0cm))
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

 withpatternscale (1/10,1/10)
 ;

 draw (fullcircle scaled 5cm shifted (5cm,0cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkred" ;)

 withpatternscale (1/20,1/20)
 ;

 draw (fullcircle scaled 5cm shifted (10cm,0cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkgreen" ;)

 withpatternscale (1/40,1/40)
 ;

 draw (fullcircle scaled 5cm shifted (0cm,5cm))
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkcyan" ;)

 withpatternscale (1/10,1/20)
 ;

 draw (fullcircle scaled 5cm shifted (5cm,5cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkmagenta" ;)

 withpatternscale (1/20,1/40)
 ;

 draw (fullcircle scaled 5cm shifted (10cm,5cm))
 withpattern image (fill fullcircle scaled 5mm withcolor 
"darkyellow" ;)

 withpatternscale (1/40,1/80)
 ;
\stopMPpage

\startMPpage[offset=1cm]
 fill fullcircle scaled 11cm
 withcolor "darkyellow" ;

 draw fullcircle scaled 10cm
 withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

 ;

 draw fulldiamond scaled 8cm
 withpattern image (fill fulldiamond scaled 4mm withcolor 
"darkgreen" ;)

 rotated 15
 ;

 draw fulltriangle scaled 9cm
 withpattern image (fill fulltriangle scaled 3mm withcolor 
"white" ;)

 rotated 45
 ;

 draw fullcircle scaled 10cm
 withpattern image (draw textext("!") withcolor "middlegray" ;)
 rotated 45
 ;

 draw fullcircle scaled 10cm
 withpen pencircle scaled 1mm
 withcolor "darkgray" ;
\stopMPpage



Those first two pages appear 20x20mm and blank.

Page 3 and 4 show patterns instead.

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://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] metafun / patterns

2021-03-25 Thread mf

Il 25/03/21 14:11, Hans Hagen ha scritto:


\startMPpage[offset=1cm]
     draw (fullcircle scaled 5cm shifted (0cm,0cm))
     withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

     withpatternscale (1/10,1/10)
     ;

     draw (fullcircle scaled 5cm shifted (5cm,0cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkred" ;)

     withpatternscale (1/20,1/20)
     ;

     draw (fullcircle scaled 5cm shifted (10cm,0cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkgreen" ;)

     withpatternscale (1/40,1/40)
     ;

     draw (fullcircle scaled 5cm shifted (0cm,5cm))
     withpattern image (fill fullcircle scaled 1cm withcolor 
"darkcyan" ;)

     withpatternscale (1/10,1/20)
     ;

     draw (fullcircle scaled 5cm shifted (5cm,5cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkmagenta" ;)

     withpatternscale (1/20,1/40)
     ;

     draw (fullcircle scaled 5cm shifted (10cm,5cm))
     withpattern image (fill fullcircle scaled 5mm withcolor 
"darkyellow" ;)

     withpatternscale (1/40,1/80)
     ;
\stopMPpage

\startMPpage[offset=1cm]
     fill fullcircle scaled 11cm
     withcolor "darkyellow" ;

     draw fullcircle scaled 10cm
     withpattern image (fill fullcircle scaled 1cm withcolor 
"darkblue" ;)

     ;

     draw fulldiamond scaled 8cm
     withpattern image (fill fulldiamond scaled 4mm withcolor 
"darkgreen" ;)

     rotated 15
     ;

     draw fulltriangle scaled 9cm
     withpattern image (fill fulltriangle scaled 3mm withcolor 
"white" ;)

     rotated 45
     ;

     draw fullcircle scaled 10cm
     withpattern image (draw textext("!") withcolor "middlegray" ;)
     rotated 45
     ;

     draw fullcircle scaled 10cm
     withpen pencircle scaled 1mm
     withcolor "darkgray" ;
\stopMPpage



Those first two pages appear 20x20mm and blank.

Page 3 and 4 show patterns instead.

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


Re: [NTG-context] lmtx update / teaser

2021-03-02 Thread mf

Il 01/03/21 15:44, Hans Hagen ha scritto:


\starttext

\startuseMPgraphic{circle}
     lmt_parshape [
     path   = fullcircle scaled 136mm,
     offset = 2mm,
     bottomskip = - 1.5LineHeight,
     ] ;
\stopuseMPgraphic

\start
\startshapedparagraph[list=circle,mp=circle,repeat=yes,method=cycle]%


list=... refers to a previous \startparagraphshape definition, so mp=... 
tells ConTeXt that the definition is derived from MetaPost code instead.


Just mp=... could be enough, but maybe "list=xyz,mp=xyz" makes it clear 
that mp is used to get a parshape from MetaPost instead of a 
\startparagraphshape definition.



     \setupalign[verytolerant,stretch,last]\dontcomplain


What's the meaning of \dontcomplain? Why is it needed there?

BTW, \startparagraphshape, \stopparagraphshape, \startshapedparagraph, 
\stopshapedparagraph should be added to the .xml documentation files.


The "right", "left", "both", "copy", "repeat" syntax in 
\startparagraphshape is really handy.


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


[NTG-context] verify if you are already postponing notes

2021-02-15 Thread mf

Dear list,
I'm typesetting XHTML and there is a couple of cases (tables and math), 
where I use \postponenotes ... \flushnotes in both their XML setups.


The problem arises when I have math inside the cell of a table, so I get 
those commands nested:


\postponenotes %  element

\postponenotes %  element inside a cell

\flushnotes %  closing math

\flushnotes %  closing table

With CSS selectors or XML machinery I can find those corner cases, but 
something like this would be better because more general:


\doifnotpostponingnotes{\postponenotes}

\dofipostponingnotes{\flushnotes}

Is there a way to define those \doif... macros?

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


Re: [NTG-context] Centered list of authors in ToC

2021-02-09 Thread mf

Il 09/02/21 10:49, jbf ha scritto:
I wonder if someone can assist me with the final step in a complicated 
Table of Contents where all items in the ToC are centred (except page 
numbers which continue to be on the right).


Beneath each chapter title is a list of authors (Yes, there can be up to 
four authors per chapter!)


I can successfully achieve everything (see MWE below) except for getting 
the list of authors to split and be centred. Because there are four of 
them, I would need to split them so they appear as two (centred) with 
the other two below(also centred).


Here is my MWE for the essential bit (which is then called in as 
textcommand=\SectionTocEntry in \setuplist[chapter], obviously):


\define[1]\SectionTocEntry{%
#1\crlf% title
\midaligned{\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}}% 


}


try \startalignment[middle] ... \stopalignment instead of \midaligned



My problem is that at the moment, the four authors appear on a single 
line, so I end up with:


    My chapter title
Mickey Mouse, Donald Duck, Uncle Scrooge, Minnie Mouse  [p. 1, but in 
fact, Minnie Mouse runs across the page number!]


What I want instead is:

   My chapter title
     Mickey Mouse, Donald Duck
    Uncle Scrooge, Minnie Mouse    [p. number]

Back at the chapter level my code reads:

\startchapter[title={Chapter title}][author={Mickey Mouse, Donald Duck, 
Uncle Scrooge, Minnie Mouse}].


\startchapter[title={Chapter title}][author={Mickey Mouse, Donald 
Duck,\crlf Uncle Scrooge, Minnie Mouse}].


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


Re: [NTG-context] new font trickery

2020-12-23 Thread mf
When I started using ConTeXt, font management gave me headaches because 
I expected fonts to be indefinitely scalable and not to be designed in 
advance at fixed sizes.


That came from using software like Word, where fonts are scalable at any 
size. Since I had no background in typesetting, I took vector, 
indefinitely scalable fonts for granted.

With that mindset a 48pt font is just a 10pt font scaled 4.8 times.

Then I knew about optical sizes, which were the norm with lead glyphs, 
because they came in heavy physical sets. And so the notion that as the 
font body gets bigger, the stroke gets thinner (so it's not just scaling).


I like this feature because it should make playing with sizes easier for 
people while lighter for machines, even though fixed sizes to be 
designed in advance enforce discipline and consistency in documents.


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


Re: [NTG-context] Inkscape 1 without gui

2020-12-12 Thread mf

See here:

https://www.mail-archive.com/ntg-context@ntg.nl/msg94431.html

and here:

https://wiki.contextgarden.net/SVG#ConTeXt_and_Inkscape

Massi

Il 12/12/20 12:00, Martin Hasoň ha scritto:

Hi all,

Inkscape version detection doesn't work for Inkscape 1 and non-gui 
environments (eg docker). The output of the `inkscape --version` command is


 > Unable to init server: Could not connect: Connection refused
 > Inkscape 1.0 (4035a4fb49, 2020-05-01)
 >    Pango version: 1.44.7

This is standard commands behaviour without `--batch-process` and 
`--without-gui` options 
https://wiki.inkscape.org/wiki/index.php/Using_the_Command_Line 



Because the version of inkscape is on the second line, ConTeXt use 
options for 0.92 version and Inkscape 1 ends with an error message:


 > Unable to init server: Could not connect: Connection refused
Unknown option --export-pdf=/app/pages/m_k_i_v_01.svg.pdf

Best regards
Martin Hasoň


___
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] Piecewise margin line

2020-11-19 Thread mf

Il 20/11/20 02:06, Johann Birnick ha scritto:

On Thu, 2020-11-19 at 11:25 +0100, mf wrote:

Il 19/11/20 10:39, Johann Birnick ha scritto:

Hello,

I want to setup some fancy theorem style for my math notes. For this I want
to
have a colored margin line next to my theorems. It should look like this:

https://i.ibb.co/F6L59pD/idea.png

The line should stretch over the whole theorem, not just the first line.
(But the latter would be a beginning, though.)

Important to note is that the line should be *on the margin*, not in the
text.

So do you have an idea on how I could do that? I would greatly appreciate
your
answer. Thank you!


Look for \startsidebar \stopsidebar and \setupsidebar.

\setupsidebar [...,...] [..,..=..,..]
    1   2
   OPT
1 NAME
2 rulethickness  = DIMENSION
    rulecolor  = COLOR
    alternative    = NUMBER
    topoffset  = DIMENSION
    bottomoffset   = DIMENSION
    distance   = DIMENSION
    leftmargindistance = DIMENSION
    level  = NUMBER

Massi


Thank you! I have two more questions:

1. Where can I find a documentation for this command? Even Google finds nothing.


I took it from the "Commands" manual. You can find it here:

./tex/texmf-context/doc/context/documents/general/qrcs/setup-en.pdf

in your ConTeXt directory.


2. Unfortunately, adding \startsidebar and \stopsidebar into the `before` and
`after` options of my enumeration messes up whitespace at the end. Here is a
screenshot:

https://s12.directupload.net/images/201120/lfmwp5lh.png

The theorem is a normal enumeration. Like this:

\defineenumeration[Theorem][before=\startsidebar, after=stopsidebar]



\startsidebar and \stopsidebar should be called in horizontal mode, 
since you might want to mark in the margin only a part of a paragraph.
In that case the bar would extend from the start of the marked text 
until its end.
The default behavior of the bar is extending from the top of the first 
line to the bottom of the last one.
Once you ended a paragraph with \par, you're in a new line and the bar 
will extend to the bottom of it.


A solution could be something like this:

\dontleavehmode\startsidebar Theorem: ... \stopsidebar\par

Otherwise you could adjust the bottomoffset parameter to the line 
height, so that the bar ends a line height before its default.


That way you could keep

> \defineenumeration[Theorem][before=\startsidebar, after=stopsidebar]

or, better:

\definesidebar[Theorem][bottomoffset=...]
\defineenumeration[Theorem][before={\startsidebar[Theorem]},after=\stopsidebar]

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


Re: [NTG-context] new upload

2020-11-19 Thread mf

Il 19/11/20 12:00, mf ha scritto:

Tested. It works.

- download the binaries from 
http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip


- unzip it in your context directory



- make install.sh and bin/mtxrun executable

- run install.sh

and you can see the upgrade progression 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] new upload

2020-11-19 Thread mf

Tested. It works.

- download the binaries from 
http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip


- make install.sh and bin/mtxrun executable

- run install.sh

and you can see the upgrade progression again.

Thanks Hans,
Massi

Il 19/11/20 11:35, Hans Hagen ha scritto:

Hi,

A new upload. Hopefully with the linux install fixed.


___
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] Piecewise margin line

2020-11-19 Thread mf

Il 19/11/20 10:39, Johann Birnick ha scritto:

Hello,

I want to setup some fancy theorem style for my math notes. For this I want to
have a colored margin line next to my theorems. It should look like this:

https://i.ibb.co/F6L59pD/idea.png

The line should stretch over the whole theorem, not just the first line.
(But the latter would be a beginning, though.)

Important to note is that the line should be *on the margin*, not in the text.

So do you have an idea on how I could do that? I would greatly appreciate your
answer. Thank you!


Look for \startsidebar \stopsidebar and \setupsidebar.

\setupsidebar [...,...] [..,..=..,..]
  1   2
 OPT
1 NAME
2 rulethickness  = DIMENSION
  rulecolor  = COLOR
  alternative= NUMBER
  topoffset  = DIMENSION
  bottomoffset   = DIMENSION
  distance   = DIMENSION
  leftmargindistance = DIMENSION
  level  = NUMBER

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


Re: [NTG-context] Indentation after \placefigure

2020-11-10 Thread mf

Il 10/11/20 09:42, Sylvain Hubert ha scritto:

Dear List,

Does anyone know how to indent the paragraph beneath \placefigure in the 
following example?


     \indenting[2em]
     \setupindenting[yes]

     \starttext

     \dorecurse{50}{a b c }

     \placefigure[here,none][indentnext=yes]{}{
     \startMPcode
     draw fullcircle scaled 1cm;
     \stopMPcode
     }

     \dorecurse{50}{d e f } % not indented

     \dorecurse{50}{g h i }
     \stoptext



The second bracket group of \placefigure is for references.
Instead of

\placefigure[here,none][indentnext=yes]{}{...

write

\setupfloat[figure][indentnext=yes]
\placefigure[here,none]{}{...

That way you enable indentation after every figure.

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


Re: [NTG-context] new upload

2020-11-06 Thread mf

Il 06/11/20 22:03, Pablo Rodriguez ha scritto:

I’m afraid that I cannot update unless I remove tex/texmf*.tma.

I’m on Linux-64bit and I wonder whether I’m the only user affected by
this issue.


I can confirm that on my Debian 10 64bit: no update until I removed

texmf-context.tma
texmf-linux-64.tma
texmf.tma

in the tex subdir.

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


Re: [NTG-context] \blank[] doesn't work when nothing precedes it

2020-11-05 Thread mf

Il 05/11/20 13:26, Sylvain Hubert ha scritto:

Dear List,

I'm trying to put the document title at around .25\paperheight by 
inserting a \blank:


     \setuplayout[topspace=0cm, header=0cm, height=\paperheight]
     \starttext \blank[.25\paperheight] foo \stoptext



\blank[.25\paperheight,force]

A blank at the top of a page is ignored, because usually you use a blank 
as a separator, that is useless at the top of a page, because the page 
break is enough to separate two texts.


Sometimes you need a blank on top anyway, i.e. at the start of a chapter.
In that case use "force".

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


Re: [NTG-context] content of xml node (element) in lua

2020-10-16 Thread mf

(sorry, I sent it before refining it)

Il 16/10/20 20:57, Jano Kula ha scritto:

Hello!

Processing XML I want to manipulate content of XML elements inside Lua.

I can define the Lua function xml.functions.name 
(t), where processing happens, and use the 
command \xmlfunction{#1}{name} to pass the current node #1from ctx to 
lua as described in the xml-mkiv.pdf manual. To access the element 
content xml.text(t,"/element") Lua function is used.


However, using the same function xml.text("#1",/element) directly inside 
Lua doesn't work for me. Node #1 is available, but not the content of 
/element.


In your lua fragment, node #1 is available as "xml:name::4" or 
"xml:name::6", but not as a lua table.


When node #1 is passed to a \xmlfunction, the function gets a lua table 
as argument.


To write direct lua code instead of a xmlfunction you'd need a function 
to transform those "xml:name::..." into the lua tables representing the 
xml elements in the xml tree.


Which is what \xmlfunction does, so I wouldn't expect any performance gain.

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


Re: [NTG-context] force index entries without page number

2020-09-04 Thread mf

Il 04/09/20 11:01, Henning Hraban Ramm ha scritto:




Am 03.09.2020 um 13:32 schrieb mf :

Use check=yes


But I need check=no, because my author has several entries like


Miller, Carolyne, born Princess of Sayn-Wittgenstein   123–125

Sayn-Wittgenstein, Carolyne of  see Miller, Carolyne


i.e. the reference target often has a different wording from the entry,
and thus \seeindex{Something}{} always inserts a "see".

Now I understand.
Since I'm working with XML, I'm using registers in an even stricter way: 
the text I'm indexing is actually the ID of a person in a database.

Something like this:

Carolyne

in the main text results in a \index[miller_carolyne]{v18in231}

In another place of the XML there's a record like this:

Miller, Carolyne ... 



The deeptextcommand parameter of \setupregister is set to a macro that 
takes the ID and gives back the text of the person.


Maybe in the database there's also another record like this:

sort-key="sayn_wittgenstein_carolyne">Sayn-Wittgenstein, Carolyne 
Miller, Carolyne


that results in a 
\seeindex[sayn_wittgenstein_carolyne]{Sayn-Wittgenstein, 
Carolyne}{Miller, Carolyne}




I don’t know how common these "passim" entries are in scientific works; maybe I 
could use

Mainperson  firstpage–lastpage

instead to avoid the major hassle of tricking the index mechanisms.

in that case \startindex...\stopindex or \startregister...\stopregister 
could be your friends.


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


Re: [NTG-context] force index entries without page number

2020-09-03 Thread mf

Il 03/09/20 11:38, Henning Hraban Ramm ha scritto:

Hi Massi, thank you!


Am 03.09.2020 um 11:09 schrieb mf :

This should be exactly what you asked for:

\defineprocessor[passim][right=\quad{\it passim}]


I didn’t think to use processors.


You need them to get the "passim"; if you include it in the name, then 
you should adapt also the \seeindex like this:


\seeindex{Ramm, Hraban\quad{\it passim}}{}
\seeindex{Hraban}{Ramm, Hraban\quad{\it passim}}

(i did not test it, i don't know if it works, and anyway i don't like it 
because it's not clean)





\seeindex{passim->Ramm, Hraban}{}


No, this results in
"Ramm, Hraban passim see passim"



Only with check=yes, otherwise it works right.


And
\index{passim->Ramm, Hraban}
results in
"Ramm, Hraban passim 1"



No, see attachment page 2.


I.e. I’m still looking for an index entry without "see" or page number.



\placeindex[check=no]


This is essential for references to not (exactly) existing entries, I forgot 
the option existed.



Use check=yes

Massi


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


Re: [NTG-context] force index entries without page number

2020-09-03 Thread mf

Useful references I consulted to find a solution:

https://www.mail-archive.com/ntg-context@ntg.nl/msg88118.html
https://wiki.contextgarden.net/Registers#Processors

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


Re: [NTG-context] force index entries without page number

2020-09-03 Thread mf

This should be exactly what you asked for:

\defineprocessor[passim][right=\quad{\it passim}]
\starttext
\samplefile{ward}\index{Ward, Peter}

\samplefile{sapolsky}\index{Sapolsky, Robert}

\seeindex{passim->Ramm, Hraban}{}
\seeindex{Hraban}{Ramm, Hraban}

\page

\placeindex[check=yes]

\page

\placeindex[check=no]

\stoptext

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


Re: [NTG-context] force index entries without page number

2020-09-03 Thread mf

Il 03/09/20 10:17, Henning Hraban Ramm ha scritto:

Hi,

I’d like to have an (person) index entry like

Ramm, Hraban   passim

i.e. without actual page number.
How can I force that?

I also need to be able to refer to it like
\seeindex{Hraban}{Ramm, Hraban)




\starttext
\samplefile{ward}\index{Ward, Peter}

\samplefile{sapolsky}\index{Sapolsky, Robert}

\seeindex{Ramm, Hraban}{}
\seeindex{Hraban}{Ramm, Hraban}

\page

\placeindex[check=yes]

\page

\placeindex[check=no]

\stoptext


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


Re: [NTG-context] strange behavior with \groupedcommand in recent versions of LMTX

2020-09-02 Thread mf

Thanks Hans,
this solves the problem I had with the new implementation of \wordright.
It's not exactly a problem of \wordright, but the combination with 
\groupedcommand.


Is \nextbox a new entry of latest versions?

I've seen also \nextboxwd, \nextboxht, etc.
So you can measure the next box to come in advance. Is it like that?

Is it a vbox when you're in vertical mode and a hbox when you are in 
horizontal mode?


Is this interpretation of \dowithnextbox in \dowhatever right?

\dowithnextbox {.1.} \.2. {.3.}
1 COMMAND = {\ifdim\wd\nextbox<\hsize...}
2 CSNAME  = \hbox
3 CONTENT = {#1}

Massi

Il 01/09/20 19:22, Hans Hagen ha scritto:
>
> fortunately there is a solution that takes less code:
>
> \unexpanded\def\whatever
>{\dosingleempty\dowhatever}
>
> \def\dowhatever[#1]%
>{\dowithnextbox
>   {\ifdim\wd\nextbox<\hsize
>  \wordright{\box\nextbox}%
>  \par
>\else
>  \par
>  \penalty1
>  \startalignment[flushright]\unhbox\nextbox\stopalignment
>\fi}\hbox}
>
> \starttext
>
>\input ward \whatever{same line, right}
>
>\blank
>
>\input ward \whatever{\input tufte }
>
> \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] strange behavior with \groupedcommand in recent versions of LMTX

2020-09-01 Thread mf

Hello list,
this is a MWE that worked right in MkIV and in LMTX versions (at least) 
until April 22nd, 2020.


There's a macro, \wordorparagraphright, that takes one argument, makes a 
hbox with it and measures its width


- if its width is less than \hsize, then it calls \wordright

- if its width is more than \hsize, then it ends the current paragraph 
and starts a right-aligned paragraph with the argument


There are two implementations in the MWE: one is through 
\groupedcommand, and that's the one that worked once and doesn't now.



\unexpanded\def\groupedwordorparagraphright{\dosingleempty\dogroupedwordorparagraphright}
\def\dogroupedwordorparagraphright[#1]{\groupedcommand{\setbox\scratchbox\hbox\bgroup}
{\egroup\ifdim\wd\scratchbox < \hsize
\wordright{\unhbox\scratchbox}
  \else
\par\penalty1
\startalignment[flushright]\unhbox\scratchbox\stopalignment
  \fi}}

\unexpanded\def\wordorparagraphright#1{%
  \setbox\scratchbox\hbox{#1}
  \ifdim\wd\scratchbox < \hsize
\wordright{#1}
  \else
\par\penalty1
\startalignment[flushright]\unhbox\scratchbox\stopalignment
  \fi}

\starttext
  \type{\wordorparagraphright} should use \type{\wordright} if its argument
  is narrower than \type{\hsize}, or make a right-aligned paragraph with it
  when it's wider.

  Below, \type{\wordorparagraphright} is tested with a short text, that
  has enough room on the same line.
  \blank

  Reference:

  \input ward\wordright{same line, right}

  \blank

  Implementation as a grouped command (it doesn't work):

  \input ward\groupedwordorparagraphright{same line, right}

  \blank

  Normal implementation, not as a grouped command (it works):

  \input ward\wordorparagraphright{same line, right}
\stoptext


Unfortunately the grouped version is the one I need, because it's used 
in a register, and it would give an error if not defined through 
\groupedcommand:


\setupregister[myregister]
  [pageleft=\wordorparagraphright\bgroup,pageright=\egroup]

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


[NTG-context] pagecolumns: get the current column

2020-06-26 Thread mf

Hello list,
I'm using a 2-columns layout and I'd like to put some information in the 
margin.
I should put that information in the left margin when I'm in the left 
column, and in the right margin when I'm in the right column, to prevent 
the extra information overlapping the main text in the other column.


I found a useful counter in page-pcl.mkiv: \c_page_col_current.

Here's a MWE:

\unprotect
\def\curCol{\c_page_col_current}
\protect

\def\InfoInMargin#1{\doifelse{\the\curCol}{1}{\inmargin{#1}}{\inothermargin{#1}}}
\def\TestText{\InfoInMargin{\bf \the\curCol}\input ward 
\InfoInMargin{\bf \the\curCol} \input ward}

\starttext
  \startpagecolumns[n=2,distance=25mm]
  \dorecurse{5}{\TestText\par}
  \stoppagecolumns
\stoptext

\c_page_col_current works most of the time, but unfortunately it tells 
you the current column before the lines of a paragraph get distributed 
over columns.


So sometimes it fails. You can see that in the MWE: the bold "1" between 
columns in the upper part of the page. It should be a bold "2" in the 
right margin.


Is there a better way to read the current column?

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


Re: [NTG-context] \startplacefigure and \startframedtext in lmtx

2020-06-10 Thread mf

Il 10/06/20 17:30, Hans Hagen ha scritto:

On 6/9/2020 11:04 AM, Otared Kavian wrote:

Hi all,

I just noticed that in lmtx, the commands \startplacefigure and 
\startframedtext, when used together, do not behave in the same way as 
they do in mkiv.

I wonder whether this is a permanent change or rather a buglet.

I found a fix around the issue, but since in my document I have a 
certain number of cases where such combinations are used, I woul dlike 
to be sure to not make a mistake by changing all the instances… Here 
is an example:


%% begin figure-framedtext.tex
\useMPlibrary[dum]
\defineexternalfigure[dummy]

\starttext
\startplacefigure[location=left,number=no,title={}]
\externalfigure[dummy][width=.45\textwidth]
\stopplacefigure
\dontleavehmode % if this is commented out then the text and the 
figure are placed on top of each other

\startframedtext[frame=off]
\input ward.tex
\stopframedtext
\stoptext
%% end figure-framedtext.tex

In the above example the fix is to add \dontleavehmode between the 
figue and the framedtext. If one comments out that line then the issue 
can be seen.


Thanks in advance for any help: Otared K.

can others confirm this

This is LuaMetaTeX, Version 2.06.07

system  > ConTeXt  ver: 2020.06.10



Seems OK to me.

I get the same result with LuaTeX+MkIV 2020-05-08 and LMTX 2020-06-10, 
even commenting out \dontleavehmode.


The only difference is the figure color: blue for LMTX, yellow for MkIV.

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


Re: [NTG-context] accessing xml element attributes in lua, how, if you do not want to use the .at scheme?

2020-06-09 Thread mf

Il 09/06/20 15:31, Gerben Wierda ha scritto:
I’ve been trying to find out how I can access XML node 
properties/attributes in lua other than via the .at syntactic scheme but 
using the property/attribute name as a string.


E.g., currently I do:

someVar = someNode.at.someProperty

but I would like to do something /like/

someVar = someNode[“someProperty”] or someNode.attribute(“someProperty”) 
or something where I can use the string version of the 
properties/attribute name.


It’s probably possible (after all these are all dynamic structures that 
come from data), but how exactly?




local prop = "someProperty"
someVar = someNode.at[ prop ]

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


Re: [NTG-context] Inkscape command line arguments have changed

2020-05-19 Thread mf

Il 19/05/20 20:50, Thangalin ha scritto:

Minor correction:

\startluacode
figures.programs.inkscape={
   command="inkscape",
   pdfargument=[[
 "%oldname%"
 --export-dpi=600
 --export-type=pdf
 --export-filename="%newname%"
   ]],
   pngargument=[[
 "%oldname%"
 --export-dpi=600
 --export-type=png
 --export-filename="%newname%"
   ]],
}
\stopluacode

Still doesn't work, though. ConTeXt persists with using --export-pdf=...
Cheers!



The latest version of ConTeXt should detect Inkscape's version and adapt 
the command line options accordingly (I tested it successfully on Debian 
64 Buster + Inkscape 0.92 and Debian 64 Sid + Inkscape 1.0rc).


Next year's versions will no longer detect Inkscape's version and will 
use the newer syntax.


See https://wiki.contextgarden.net/SVG

This topic has already been discussed in this thread:
https://www.mail-archive.com/ntg-context@ntg.nl/msg94153.html

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


Re: [NTG-context] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread mf

Il 30/04/20 17:21, Hans Hagen ha scritto:

On 4/30/2020 3:15 PM, mf wrote:

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in 
previous versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong 
one would be ignored, without success; you get only a warning, not an 
error, but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right 
option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.
As I don't wan to waste code for testing the version, when do we change 
this? Now? I downloaded version 1 so it is available for all platforms.




1.0 is a release candidate. Romain is using the unstable version of 
Debian (sid), so he's using Inkscape 1.00rc.


Anyway Inkscape 0.92 will be around for some time, so a better solution 
would be defaulting to the export option of the current version of 
Inkscape unless the user sets an environment variable (INKSCAPE_VERSION?).


So a test of an environment variable instead of spawning a process to 
run "inkscape --version".


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


Re: [NTG-context] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread mf

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in previous 
versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong one 
would be ignored, without success; you get only a warning, not an error, 
but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.

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


Re: [NTG-context] offset for background overlay

2020-04-13 Thread mf

Or maybe a method in MP to set the bounding box of the resulting overlay?


setbounds in combination with leftenlarged, topenlarged etc.


Thanks Wolfgang, this is the kind of solution I was looking for:

\startuseMPgraphic{cell:triangle}
  path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth 
yscaled 2.5 OverlayHeight ;

  draw p withcolor red ;
  setbounds currentpicture to p topenlarged 6mm ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
  \bTR
\bTD[nx=2,align=middle,background=triangle] \dontleavehmode a\crlf 
text \eTD

  \eTR
  \bTR[toffset=1mm]
\bTD left \eTD
\bTD right \eTD
  \eTR
  \bTR
\bTD another \eTD
\bTD row \eTD
  \eTR
\eTABLE
\stoptext

Thanks also for the explanation of backgroundoffset: it's an offset 
relative only to the background, and it moves in the opposite direction 
of the content offset of \framed.


Looks like \framed[...,offset=VALUE,backgroundoffset=frame,...] is 
equivalent to \framed[...,offset=VALUE,backgroundoffset=-VALUE,...].


I tried to add something to the WIKI to show how it works, but the 
previews I got were not consistent with what I'm obtaining on my PC 
(with LMTX and "context --luatex"), so I gave up.


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


Re: [NTG-context] offset for background overlay

2020-04-11 Thread mf

Thanks Hans and Wolfgang.

@Wolfgang: your solution is clearer, but unfortunately it works only for 
this MWE. In the real case the triangle extends over 2 rows, but the 
table has more than 2 rows.
I tried grouping the first two rows in a 
\bTABLEbody[background=triangle], but it doesn't work.


@both: \setupoverlay[hoffset=...,voffset=...]?
\setupframed[backgroundhoffset=...,backgroundvoffset=...] (\bTD inherits 
from \framed)?

Or maybe a method in MP to set the bounding box of the resulting overlay?

\setupframed has already a backgroundoffset option, whose value can be:

- a DIMENSION (an offset that is both horizontal and vertical)

- a "frame": what does it mean? (I looked into pack-rul.mkiv, with no 
results)


Massi

Il 11/04/20 20:11, Wolfgang Schuster ha scritto:

Hans Hagen schrieb am 11.04.2020 um 19:41:

On 4/11/2020 4:15 PM, mf wrote:

Hello list,
this MWE is a simplified version of a real case:

\startuseMPgraphic{cell:triangle}
   path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth 
yscaled 2.5 OverlayHeight ;

   draw p withcolor red ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
   \bTR
 \bTD[nx=2,background=triangle,align=middle] \dontleavehmode 
a\crlf text \eTD

   \eTR
   \bTR[toffset=1mm]
 \bTD left \eTD
 \bTD right \eTD
   \eTR
\eTABLE
\stoptext

here's a very ugly solution

\startuseMPgraphic{cell:triangle}
 fill llcorner OverlayBox
 -- lrcorner OverlayBox
 -- (center bottomboundary OverlayBox shifted 
(0,\MPy{foo:2}-\MPh{foo:2}+\MPd{foo:2}-\MPy{foo:1}))

 -- cycle
 withcolor red ;
 setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]

\starttext

\bTABLE[frame=off]
   \bTR
\bTD[nx=2,align=middle,height=0pt,background=triangle]\xypos{foo:1}\eTD
   \eTR
   \bTR
 \bTD[nx=2,align=middle] \dontleavehmode a\crlf text \eTD
   \eTR
   \bTR[toffset=1mm]
 \bTD \hpos{foo:2}{\strut} left \eTD
 \bTD right \eTD
   \eTR
\eTABLE

\stoptext

it is probably possible to get some info otherwise (more efficient) if 
really needed (if we add some helpers)


Simpler, put the table in a frame.

\startuseMPgraphic{cell:triangle}
   draw llcorner OverlayBox
     -- lrcorner OverlayBox
     -- center topboundary OverlayBox
     -- cycle
    withcolor red ;
\stopuseMPgraphic

\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]

\starttext

\startframed[frame=off,offset=1ex,loffset=2ex,roffset=2ex,toffset=2ex,background=triangle] 


     \bTABLE[frame=off]
     \bTR
     \bTD[nx=2,align=middle] a\crlf text \eTD
     \eTR
     \bTR[toffset=1mm]
     \bTD left \eTD
     \bTD right \eTD
     \eTR
     \eTABLE
\stopframed

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


[NTG-context] offset for background overlay

2020-04-11 Thread mf

Hello list,
this MWE is a simplified version of a real case:

\startuseMPgraphic{cell:triangle}
  path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth 
yscaled 2.5 OverlayHeight ;

  draw p withcolor red ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
  \bTR
\bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf 
text \eTD

  \eTR
  \bTR[toffset=1mm]
\bTD left \eTD
\bTD right \eTD
  \eTR
\eTABLE
\stoptext

The triangle is used as background of the 2-column wide cell of the 
first row.


I want the triangle to go around the second row too, as if it were a 
frame for all the 3 cells. It means that it should be shifted down a bit.


So I tried this:

\startuseMPgraphic{cell:triangle}
  path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth 
yscaled 2.5 OverlayHeight ;

  draw p shifted (0,-3mm) withcolor red ;
\stopuseMPgraphic
...

but it does not work, because the content of the background is centered 
on the cell, so "shifted (0,-3mm)" has no effect.


The only solution I found is drawing something above the triangle with a 
neutral color, so that the whole background is centered in the cell and 
the red triangle goes down:


\startuseMPgraphic{cell:triangle}
  path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth 
yscaled 2.5 OverlayHeight ;

  fill p shifted (0,6mm) withcolor white ; % only to move the next one down
  draw p withcolor red ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
  \bTR
\bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf 
text \eTD

  \eTR
  \bTR[toffset=1mm]
\bTD left \eTD
\bTD right \eTD
  \eTR
\eTABLE
\stoptext

It's a dirty trick. I'm sure there's a cleaner way.
Does anybody know it?

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


Re: [NTG-context] Using Lua files in project structure

2020-04-05 Thread mf

Il 05/04/20 15:00, Jairo A. del Rio ha scritto:
I'm writing a project in ConTeXt MKIV and I want to load some (pure) Lua 
libraries and bindings (defining \ctxlua and the like). For instance, I 
have the file foo.lua with some macros and I want to use them in my 
project. Something like this:


\startproject project
%\component foo.lua %This does not work
%\environment foo.lua %This does not work
%\input foo.lua %This does not work
%\directlua{dofile("foo.lua")} %This does not work even when the project 


\directlua{require("foo")}

or

\startluacode
  require("foo")
\stopluacode


file and foo.lua are in the same folder.
\stopproject

What should I do? Thank you in advance.


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


Re: [NTG-context] Bug (Lua) ?

2020-03-19 Thread mf

Il 19/03/20 11:20, Fabrice Couvreur ha scritto:

Hi,
this file did not pose any problems but today yes.
Thank you.
Fabrice

\starttext
\startluacode
local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
local letters_2 = { "1", "Année", "1998", "1999", "2000", "2001", "2002",
"2003", "2004", "2005","2006" }
context.startxtable({"align={middle,lohi},
width=1.2cm,offset=0.8ex,bodyfont=9pt"})



context.startxtable( { align = "middle,lohi", width = "1.2cm", offset = 
"0.8ex", bodyfont = "9pt" } )


The argument is a lua table. Values are usually strings.


context.startxrow({"background=color,backgroundcolor=green"})


context.startxrow( { background = "color", backgroundcolor = "green" } )

... and so on.

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


Re: [NTG-context] Issue with rendering arrows in lmtx

2020-03-17 Thread mf

Il 17/03/20 15:51, Jan-Erik Hägglöf ha scritto:

Hi All!

When I invoke this command

\startMPcode
picture p ; p := lmt_svg [ filename ="pil.svg" ];
draw p;
\stopMPcode

I get weird results, the arrowhead points in wrong direction and is very 
tiny compared to the size it was meant to have.




Keep in mind this:

- SVG rendering in metapost started as an experiment and it is still 
under development, even if you can already do some very interesting 
things with it


- inkscape SVG is different from standard SVG, so the first thing you 
can try is saving as plain SVG


- markers are borderline elements, even Inkscape did not support them 
well for a long time; i.e. i noticed a strange behavior in rectangles 
with slightly rounded corners


- in general, try using the simplest elements: i.e. transform 
rectangles, ellipses, markers?, etc. into paths


- you could experience problems also with text, especially with less 
common or uninstalled fonts


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


Re: [NTG-context] Need help processing XML in luacode

2020-03-10 Thread mf

In your tex file, try this:

\startluacode
settings = {}
docstruktur = {}
doclistfile = "doclist.xml"

local striplines = utilities.strings.striplines
local xmltext= xml.text

cropstring = function(s)
  -- return striplines(s, "prune and collapse")
  return striplines(s)
end

doc = xml.load(doclistfile, settings)

for v in xml.collected(doc,"/doclist/psdoc/") do
--  print (v)
--  print (xml.text(v,"/docnr"))
  local docnr = cropstring(xml.text(v,"/docnr"))
  print (docnr)
  local docname = cropstring(xmltext(v,"/docname"))
  -- es kann mehrere DOCAN geben!
  local docan = (cropstring(xmltext(v,"/docan")))
  local docverantwortlich = (cropstring(xmltext(v,"/docverantwortlich")))
  docstruktur[docnr]={
docname = docname,
docan = docan,
docverantwortlich = docverantwortlich
  }
--  docstruktur[docnr]["docname"] = docname
--  docstruktur[docnr]["docan"] = docan
--  docstruktur[docnr]["docverantwortlich"] = docverantwortlich
end
\stopluacode

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


Re: [NTG-context] Up-to-date documentation / tutorials. Where?

2020-02-29 Thread mf


Is there not a simple place to get all the up-to-date documentation?



If you install ConTeXt from

http://www.pragma-ade.nl/install.htm

in the installation tree you'll find docs under

tex/texmf-context/doc/context/documents/

There you'll always find the docs at their last revision.

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


Re: [NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread mf

Il 18/02/20 19:07, Jan U. Hasecke ha scritto:

Am 18.02.20 um 14:53 schrieb Hans Hagen:


\setupcolors[rgb=no]
\startMPcode
     draw lmt_svg [ filename = "sample.svg" ] ;
\stopMPcode

I get this error.

! Not implemented: (unknown numeric)=(string).

]
<*> ... ; p := lmt_svg [ filename = "sample.svg" ]

That's because it's LMTX only (the "lmt" prefix of "lmt_svg" should 
stand for "luametatex").


You find documentation about that in LMTX docs, luametafun.pdf, chapter 
"SVG".


Best wishes,

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


[NTG-context] metapost: remapping colors of an SVG picture

2020-02-18 Thread mf

Hello list,
I tried this:

\starttext
\startMPcode
picture p ; p := lmt_svg [ filename = "sample.svg" ] ;
draw p ;
color black_rgb ; black_rgb := ( 0, 0, 0 ) ;
color red_rgb   ; red_rgb   := ( 1, 0, 0 ) ;
remapcolor( black_rgb, red_rgb ) ;
recolor p ;
draw p shifted ( bbwidth(p) + 5mm, 0) ;
\stopMPcode
\stoptext

but recolor gives an error:
metapost log> >> picture
metapost log> ! Wrong picture color model: redpart of grey object.
metapost log>  _f_:=(redpart(EXPR0),
metapost log> 
greenpart(EXPR0),bluepart(EXPR0));if.bou...

metapost log>
metapost log> repathed->...fi;fi;else:addto._p_.also.i;fi;endfor
metapost log> 
;setbounds._p_.to._b_;_p_

metapost log> 
metapost log>;
metapost log> <*> ...apcolor( black_rgb, red_rgb ) ; recolor p ;
metapost log> 
draw grayed p shifted ( b...

metapost log>

My goal is to remap colors of an SVG image, like this:

\starttext
\startMPcode
picture p ; p := lmt_svg [ filename = "sample.svg" ] ;
draw p ;
color black_rgb  ; black_rgb  := ( 0, 0, 0 ) ;
cmykcolor black_cmyk ; black_cmyk := ( 0, 0, 0, 1 ) ;
remapcolor( black_rgb, black_cmyk ) ;
recolor p ;
draw p shifted ( bbwidth(p) + 5mm, 0) ;
\stopMPcode
\stoptext

It relates to a recent thread in the mailing list about color management.
It's an attempt to use inkscape-made SVG graphics inside a CMYK 
workflow, without using color management.


Naturally it would work under some constraints, but there's a lot of 
graphics you can do with Inkscape that falls inside these:
- the number of colors in the input SVG should be limited, so that every 
color gets converted

- no embedded bitmaps, only vector graphics
- perhaps some other constraints on gradients, transparency, etc.

A good alternative would be a remapper based on a custom lua function 
like this:


function rgb2cmyk( r, g, b )
  ...
  return c, m, y, k
end

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


Re: [NTG-context] upload

2020-02-17 Thread mf
if you fetch from the web site you need to use /latest as we no longer 
have lpha, beta current ... maybe somthing got messed up in the git 
sync, i don't know



The git mirror is in sync again.
Thanks to anybody working on it.

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


Re: [NTG-context] upload

2020-02-13 Thread mf

Il 11/02/20 17:00, Hans Hagen ha scritto:

Hi,

I uploaded a fresh lmtx. There is some new stuff in there:



I'm a little bit confused about versions.

1) GIT MIRROR

The last commit in the branch "beta" is 2020-01-26 18:37:00.

I've seen no update since your "upload" message (the one i'm replying to).

(Hans, I know it's not you updating it)

2) CONTEXT MKIV

I've just updated the "latest" ConTeXt MkIV, i mean the one you update 
with first-setup.sh ...


Once updated, this is the output of "context --version":

mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: 
/home/massi/context/latest/tex/texmf-context/tex/context/base/mkiv/context.mkiv

mtx-context | current version: 2020.01.30 14:13
mtx-context | main context file: 
/home/massi/context/latest/tex/texmf-context/tex/context/base/mkiv/context.mkxl

mtx-context | current version: 2020.01.30 14:13

3) LMTX

After ./install.sh and setting the PATH, "context --version" gives:

mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: 
/home/massi/context/lmtx/tex/texmf-context/tex/context/base/mkiv/context.mkiv

mtx-context | current version: 2019.07.24 11:31
mtx-context | main context file: 
/home/massi/context/lmtx/tex/texmf-context/tex/context/base/mkiv/context.mkxl

mtx-context | current version: 2020.02.11 16:41

"2020.02.11 16:41" for MKXL looks right to me, since it's the version 
you are talking of in your message.


But what about "2019.07.24 11:31" for MKIV? It's even older than the one 
you get with first-setup.sh.


Maybe it's the version when MKXL and MKIV split, and "2020.01.30 14:13" 
is the latest version of MKIV with the backporting of some of the 
enhancements that took place in MKXL. Is it like that?


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


Re: [NTG-context] Adjust kern for one character

2019-12-22 Thread mf

Il 22/12/19 22:19, Rik Kabel ha scritto:

List,

Is there a way in ConTeXt to adjust the left-side kern for one 
character? The cap J in the font I am using is being set too close to 
the preceding characters and I would rather not insert a thinspace 
before each. (Inserting a thinspace is sufficient, but finer control is 
welcome.)



\definecharacterspacing[distantJ]
\setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A 
is the unicode hex index of letter J

\starttext
  normal: AJB\par
  \setcharacterspacing[distantJ] more space on the left: AJB\par
  \resetcharacterspacing normal again: AJB\par
\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
___


Re: [NTG-context] blank[\lineheight] works with LMTX, fails with MkIV

2019-12-21 Thread mf

Il 20/12/19 20:04, Rik Kabel ha scritto:


MkIV fails with

tex error   > tex error on line 3 in file 
c://Users/micro/Desktop/fail.tex: ! Missing \endcsname inserted

given the following mwe:

\starttext
a
\blank[\lineheight]
z
\stoptext

Not critical as there are lots of ways to do this, but it seems 
strange that it should work in one and not the other.




\starttext
a
\blank[\the\lineheight]
z
\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
___


Re: [NTG-context] setting the color of cropmarks

2019-12-20 Thread mf
This is a dirty hack to change the color of the crop marks and the page 
number at the corner of a page when \setuplayout[marking=on].


Edit the file:

tex/texmf-context/metapost/context/base/mpiv/mp-crop.mpiv

in the distribution, changing two lines:

- (here i'm reproducing only the last part of the file) --

def page_marks_add_lines(expr width, height, length, offset, nx, ny, 
boxtoo) = % todo: namespace


pickup pencircle scaled 1/2 ; interim linecap := squared ; interim 
linejoin := butt ;


path page ; page := fullsquare xscaled width yscaled height ;
path more ; more := page enlarged (offset+length/2,offset+length/2) ;

%draw crop_marks_lines(page,length,offset,nx,ny,boxtoo) ;
draw crop_marks_lines(page,length,offset,nx,ny,boxtoo) withcolor 
(0,0,0,1) ;


setbounds currentpicture to page ;

enddef ;

def page_marks_add_number(expr width, height, length, offset, n) = % 
todo: namespace


pickup pencircle scaled 1/2 ; interim linecap := squared ; interim 
linejoin := butt ;


path page ; page := fullsquare xscaled width yscaled height ;
path more ; more := page enlarged (offset+length/2,offset+length/2) ;

for s=llcorner more, lrcorner more, ulcorner more, urcorner more :
%draw textext(decimal n) shifted s ;
draw textext(decimal n) shifted s withcolor (0,0,0,1) ;
endfor ;

setbounds currentpicture to page ;

enddef ;

---

You must add "withcolor (0,0,0,1)" before the final semicolon to two 
lines: the ones that i commented out with a leading "%".


In case you wanted crop marks in all the CMYK channels, add "withcolor 
(1,1,1,1)".


Once you modify the file, remake the format with

context --make

A parametric solution would let you define a "registration" color in 
ConTeXt, then map it to the corresponding "withcolor" instruction in 
mp-crop.mkiv. I'm sure there are already functions to do that mapping.
It's the difficult part (at least for me) when Hans talks about adding 
"some control over these cropmark colors by using symbolic names".


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


Re: [NTG-context] setting the color of cropmarks

2019-12-19 Thread mf


There is no option to change the color for the rules and the only option 
you have is to use color conversion.


\setupcolors[cmyk=yes,rgb=no]

I do have this setup, but it produces grayscale crop marks.

I was told by two different printshops that grayscale raises problems 
with recent versions of PDF software (verification? imposition? I've not 
asked), that complains about that, because it treats grayscale as RGB, 
splitting it on C, M and Y channels, instead of mapping it only to the K 
channel.




If you need more control you can create your own marks and add them as 
background for the page.


I've seen there's something about that in the mailing list history. I'll 
look into that.


BTW, the MP file producing the marks is

metapost/context/base/mpiv/mp-crop.mpiv

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


Re: [NTG-context] setting the color of cropmarks

2019-12-19 Thread mf



Il 19/12/19 18:07, Henning Hraban Ramm ha scritto:

Am 2019-12-19 um 16:41 schrieb mf :


Hello list,

\setuplayout[marking=on] typesets crop marks that are in grayscale black.

Can I change their color, in particular into a CMYK black (0,0,0,1.0)?


There’s no parameter, and I don’t understand how the markings are set in 
https://source.contextgarden.net/tex/context/base/mkiv/strc-mar.mkiv


No, that's about markings, a different thing.
I think the right file is page-mrk.mkiv.
The crop marks are made with MP.
I'm looking into it...



Maybe you see more… There’s an example for custom marks at the bottom.

It would also make sense to use CMYK register color (1,1,1,1).


I do agree.

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


[NTG-context] setting the color of cropmarks

2019-12-19 Thread mf

Hello list,

\setuplayout[marking=on] typesets crop marks that are in grayscale black.

Can I change their color, in particular into a CMYK black (0,0,0,1.0)?

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


Re: [NTG-context] changing alignment inside a paragraph

2019-12-12 Thread mf

Il 11/12/19 21:25, Wolfgang Schuster ha scritto:

\starttext

\startbuffer
This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line\par
\startalignment[flushright]
\ifdim\dimexpr\hsize-\lastlinewidth\relax>2\emwidth
     \blank[overlay]
%   simple solution but doesn't indent the numbers on the following lines
%   \hskip\dimexpr\lastlinewidth+\emwidth\relax
     \parshape 2
     \dimexpr\lastlinewidth+\emwidth\relax 
\dimexpr\hsize-\lastlinewidth-\emwidth\relax

     \emwidth \dimexpr\hsize-\emwidth\relax
\else
     \parshape 1 \emwidth \dimexpr\hsize-\emwidth\relax
\fi
34, 57, 101-104, 276, 345, 401, 403, 512.
\stopalignment
\stopbuffer

\dorecurse
   {10}
   {\hsize\dimexpr.75\textwidth-#1\emwidth\relax
    \getbuffer
    \page}

\stoptext



Thanks Wolfgang.

I wrote a better version. I still have a couple of questions.
In the lines:

\iffirstargument
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,#1]
\else
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,]
\fi

i would avoid writing the default values twice; i tried something like:

\getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,\iffirstargument#1\fi]

but it doesn't work.

For the second question, see the first item of page 3: i think the 
\lastlinewidth fails because there's a page break. From supp-box.lua:


implement {
name= "lastlinewidth",
actions = function()
local head = tex.lists.page_head
-- list dimensions returns 3 value but we take the first
context(head and 
getdimensions(getlist(find_tail(tonut(tex.lists.page_head or 0)

end
}

I think that's because page_head is reset in the page break.
Is there a way to prevent that?

Massi

--
\unprotect
\def\PlaceIndexTerm{\dosingleempty\doPlaceIndexTerm}
\def\doPlaceIndexTerm[#1]#2#3{%
\iffirstargument
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,#1]
\else
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,]
\fi
#2\par
\startalignment[flushright,stretch]
\ifdim\dimexpr\hsize-\lastlinewidth\relax > 
\dimexpr\PIT!distance+\PIT!minwidth\relax

  \blank[overlay]
  \parshape 2
  \dimexpr\lastlinewidth+\PIT!distance\relax 
\dimexpr\hsize-\lastlinewidth-\PIT!distance\relax

  \PIT!margin \dimexpr\hsize-\PIT!margin\relax \doif{\PIT!test}{on}{\red}
\else
  \page[no]
  \parshape 1 \PIT!margin \dimexpr\hsize-\PIT!margin\relax 
\doif{\PIT!test}{on}{\darkgreen}

\fi
#3\par
\stopalignment}
\protect

\setupalign[stretch]

\starttext

\def\Text{This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line}

\def\Pages{34, 57, 101-104, 276, 345, 401, 403, 512.}

\type{\PlaceIndexTerm[margin=1em,distance=1em,minwidth=1em]{text}{pages}}
\startitemize
\item margin:
  the left margin of the lines made only of page numbers
\item distance:
  the distance of the first page number from the last word of the text
\item minwidth:
  the shortest acceptable space at the end of the text to try to 
start page numbers there

\stopitemize

\page

\dorecurse
  {23}
  {\hsize=\dimexpr5cm+#1\emwidth\relax
   #1: \the\hsize\par
   \PlaceIndexTerm[test=on]{\Text}{\Pages}}

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


Re: [NTG-context] changing alignment inside a paragraph

2019-12-11 Thread mf

This is a good-enough solution to my problem:

\setupalign[stretch]

\starttext

\def\Text{This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line}

\def\Pages{34, 57, 101-104, 276, 345, 401, 403, 512.}

\type{\PlaceIndexTerm} has 6 parameters:
\startitemize[n]
\item the main text
\item the pages' numbers
\item the text width
\item the left margin of the lines made only of page numbers
\item the width of the separator (an hbox) before the first page number, 
when there's room

  in the last line of the text
\item the minimum accepted space left at the end of the last line of 
text, to put a page number

\stopitemize

\def\PlaceIndexTerm#1#2#3#4#5#6{%
\newdimen\TextWidth \TextWidth=#3
\newdimen\SBPN \SBPN=#5 % space before page numbers
\newdimen\PagesIndentation \PagesIndentation=#4
\newdimen\MSLLL \MSLLL=#6 % minimum space left on last line
\parshape 1 0pt \TextWidth #1\par
\newdimen\LLW \LLW=\lastlinewidth
\page[no]
\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL 
\blank[-\the\lineheight,fixed]\fi

\startalignment[flushright,stretch]
\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL
\parshape 2
\LLW \dimexpr \TextWidth - \LLW
\PagesIndentation \dimexpr \TextWidth - \PagesIndentation \red
\else
\parshape 1 \PagesIndentation \dimexpr \TextWidth - \PagesIndentation 
\darkgreen

\fi
\noindent\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL\hbox to 
\SBPN{}\fi #2\par

\stopalignment}

\def\PlaceIndexTermDescribed#1#2#3#4#5#6{%
\newdimen\TW\TW=#3
\noindent{\tfx width={\bf \PtToCm{\the\TW}},
pages' left margin (2nd line)={\bf #4},
hbox before pages={\bf #5},\\%
min space left on last line of text={\bf #6}}\par
\blank[halfline]
\PlaceIndexTerm{#1}{#2}{#3}{#4}{#5}{#6}
\blank}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{3cm}{12pt}{1em}{12pt}
In this case there's no space left on the last line of text,
so the page numbers are flushed to the right, starting from
a new line.

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{3.5cm}{12pt}{1em}{12pt}
Now the last line of text is short and there's room to start the page
numbers on the same line. The remainder of page numbers is flushed right,
with a (min) left margin of 12pt.\par
Actually, the page numbers are started in a new paragraph with a 
\type{\parshape}

that depends on the last line of the text; then the new paragraph is moved
upwards with a \type{\blank[-\the\lineheight,fixed]}.
A \type{\page[no]} before the \type{\blank} guarantees that
no page break occurs between text and numbers.

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{4cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{4.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{5.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{6cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{6.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{7cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{7.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{8cm}{12pt}{1em}{12pt}
That \type{512} left on the last line is ugly, and we can trim the 
separator hbox
from \type{1em} to \type{.1em} to let all the page numbers fit in the 
last line:\par

\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{8cm}{12pt}{.1em}{12pt}
or we could increase the left margin of the lines made only of page numbers
(to \type{3cm} in this case), to distribute the numbers better across 
the two lines:\par

\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{8cm}{3cm}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{8.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{9cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{9.5cm}{12pt}{1em}{12pt}
Increasing the left margin of the lines of page numbers gives a better 
result:\par

\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{9.5cm}{4cm}{1em}{12pt}

\page
Full text width (third parameter set to \type{\textwidth}):\par
\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{\textwidth}{12pt}{1em}{12pt}

\stoptext

(Thanks again to Wolfgang for answering my question)

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


[NTG-context] changing alignment inside a paragraph

2019-12-10 Thread mf

Hello list, is there a way to achieve this?

\def\FlushRightFromNextLine{\relax}
\setupnarrower[left=0cm,right=11cm]
\setupalign[stretch]
\starttext
This is what I'd like to type in my source:\par
\blank
\type{This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line \FlushRightFromNextLine 34, 57, 101-104, 276, 345, 
401-403.}\par

\blank
This is the normal result:\par
\blank
\startnarrower[right]
This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line \FlushRightFromNextLine 34, 57, 101-104, 276, 345, 
401-403.

\stopnarrower
\blank
This is the expected result:\par
\blank
\startnarrower[right]
\parfillskip=0pt This is the text of an index term, that is normally 
justified,

but I'd like the page numbers to be flushed to the right from
their second line 34, 57,\par
\penalty1 % no page break in the middle of page numbers
\startalignment[flushright]
101-104, 276, 345, 401-403.\par
\stopalignment
\stopnarrower
\stoptext

The expected result is to be intended visually, because there might be 
no need to break the text into two paragraphs.


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


Re: [NTG-context] ConTeXt as a service

2019-11-23 Thread mf

Il 22/11/19 08:43, Jan U. Hasecke ha scritto:

Am 20.11.19 um 18:10 schrieb Henning Hraban Ramm:

Hi!

I’m running ConTeXt on my web server e.g. to generate shipping forms for a 
customer.

As Hans said, it makes sense to use an asynchronous setup; in my case it’s 
celery/RabbitMQ behind Django.

You probably need to set a few environment variables: I find HOME, PATH, 
TEXROOT and TEXMFOS in my setup. I don’t know if you really need all of them, 
it’s already running for several years…
Also your web server process might only run binaries that belong to some 
user/group like wwwrun.

It won’t work in shared hosting, because you can’t install your own programs.


Generally this is correct. But there are providers such as the
Hostsharing cooperative where it is possible to install programs in a
shared hosting environment. We do it for years. ;-)


Otherwise: What kind of documentation do you need? Installing ConTeXt on a 
(web) server is not different from any other Linux system. Calling ConTeXt from 
a web application is not different from calling any other external program. The 
rest depends on your setup and web frameworks.


I am very interested in running ConTeXt as a service, too. I am still
nurturing the idea of a publishing cooperative for self publishers with
a Markdown --> Pandoc --> ConTeXt workflow with a nice web frontend. I
hope to make it to the next ConTeXt meeting to discuss it.



I'm using ConTeXt inside a Docker container.
The same container runs a Node+Express.js interface to accept documents 
and provide resulting PDFs, as well as job information while ConTeXt is 
typesetting a document.


That way i get:

- container isolation: i can have different ConTeXt versions between the 
container and the host (the same goes for other software)


- thanks to the Node+Express, a client-server workflow over a network

The problems arise when you need to move data to and from the container.
Docker lets you share a local filesystem path with the container, but 
that's not possible on a network (with the same performance of a local 
filesystem, i mean).


Maybe your sources are not too heavy, but your ConTeXt environments, 
graphics, fonts are probably heavier. So are PDFs produced by ConTeXt.


That's why i'm using a docker container image that preloads all the 
configuration files (.tex and .lua), graphics, fonts during image building.


It's not a generic, all-purpose ConTeXt container, it's tailored on a 
very specific kind of documents. That way the only things i'm moving 
around are XHTML sources and typeset PDFs.


Things get really complex if you want to use containers to scale up, 
having a whole battery of identical ConTeXt servers distributed in a cloud.
It's not my case, i have only one container in one physical server, 
reachable from many network clients.


Stateless containers are indistinguishable, but ConTeXt containers hold 
state: your documents and all the data that is needed to typeset them.


When you ask for a resulting PDF, only one specific container can answer 
you, unless that PDF has been put on a shared storage. But that could 
mean moving it over a network, adding latency and burden on the network.


Suppose you slightly modify your document and want to typeset it again.
Reusing the .tuc file of the previous version could save you some runs, 
but only the previous container knows about the .tuc file.
So pick one: run ConTeXt on the same container or move the .tuc file 
over the network to another one.


It's the general problem of managing state with containers.

Another question: previewing the result of typesetting.
When the PDF is in your directory, you can see it as soon as ConTeXt 
finishes a run.

I keep evince open on a file while i'm running ConTeXt locally.

When ConTeXt is working on a server, in the simplest setup you must wait 
until it finishes all the runs before you can download the PDF. That's 
the way i started.


Now i take a local copy of the PDF inside the container, every time a 
single run ends; that way you can download the PDF just after the first 
run. But it also means downloading your PDF n times, where n is the 
number of runs.


That's why i'm leveraging the Node+Express interface to provide a 
single-page preview: a rendering of a page at screen resolution, 
produced inside the container with pdftocairo; the image is also cached, 
so that it's updated only when a new PDF - from a new run - is ready.


Instead of downloading the PDF n times, i get a light and early preview 
of single pages. And the interface lets you download the whole PDF once 
it's done.


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

Re: [NTG-context] ConTeXt as a service

2019-11-23 Thread mf

Il 23/11/19 13:02, Henning Hraban Ramm ha scritto:



Am 2019-11-23 um 08:12 schrieb Mojca Miklavec
:


Then you can use one of the online JS editors like CKeditor.\


Only if you spend an enormous amount of effort making sure that
the code is properly cleaned up rather than containing a gazillion
random html style tags which you can never reconstruct back into
some structured form.

(And yes, my impression is that Massi spent a huge amount of effort
in configuring the editor and cleaning up the mess. My company
didn't and ended up with sometimes literally every word in a
sentence using a different font size or style. They gave up on html
+ cke pretty soon, but couldn't be convinced that this was a bad
idea upfront.)


Indeed, an ongoing effort.
Markup should be mostly semantic, leaving the most of styling to ConTeXt
or CSS or whatever.
But then you must consider the features and limitations of the tools you
use.

CKEditor lets you define rules to specify what can enter your sources;
it's great, but it's essentially a HTML editor, not a semantic editor.
In CKE, the HTML is *the* document, not a representation of it inside a 
browser.


Prosemirror is the best editor i know, if you care about complete
control of what goes into your sources.
It's document agnostic, HTML is used only to represent the document in a 
browser. Your document could be JSON or markdown or whatever.


Prosemirror is actually an editor kit, not an editor:

- Tiptap editor combines Prosemirror with Vue.js

- wax-prosemirror instead combines Prosemirror with React.js

I'm developing on top of wax-prosemirror, which should be the next
version of the editor inside Editoria by Coko Foundation (Luigi posted a
couple of links in another reply of this thread).

Jure Triglav of Coko Foundation wrote a good post on open source 
collaborative editors:

https://juretriglav.si/open-source-collaborative-text-editors/


Don’t exaggerate. Or maybe your company didn’t think about which tags
are really necessary. A proper configuration that doesn’t allow
nonsense, even if users paste text from Word documents, is not such a
big effort.


Even though we started with a semantic tagging mindset, we always find
alien tags or wrong combinations of allowed tags in our sources.
It's not only pasting from Word or a web page, sometimes it's browsers'
plugins or different behaviors among different browsers. And bugs of my
code, of course.

I feel it's hard to exaggerate in paying attention to that, there's 
always something unwanted sneaking in.



I can’t remember which JS editor I used >10 years ago for the
editorial system of a city magazine, but I remember I only allowed a
few tags (authors weren’t allowed to use font and color settings) and
also run a HTML cleaner before saving. It was an effort until it
worked, but not that much.



We have filters to clean up a source before editing, rules inside a
CKE-based editor and filters to do other cleanups while saving.
We have quite a good control over sources, yet it's not complete.

A lot depends on the complexity of your documents: you start
simple and do some assumptions; later you want to increase complexity,
add new features that must combine with the legacy of every assumption
you did in the past.
More complex documents, more room for unwanted markup to enter them.

I admire Pandoc's document model: it's simple enough, well specified,
with generic tags (Div for blocks and Span for inlines) that carry
information with classes and key-value data, RawInlines and RawBlocks to 
inject low level tagging for specific formats.
Generics and Raw objects let you represent and convert many elements 
that are not built in.


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


Re: [NTG-context] ConTeXt as a service

2019-11-23 Thread mf


Il 23/11/19 14:18, Henning Hraban Ramm ha scritto:



Am 2019-11-23 um 13:18 schrieb luigi scarso :
another link:
https://coko.foundation/
https://coko.foundation/product-suite/


or merely https://pubsweet.coko.foundation

Thank you for the hint, sounds interesting and like the thing I always wanted 
to build…
I didn’t read everything, but I didn’t find any hints how (if?) they produce 
PDFs or other output formats.


They use a javascript library, paged.js, it's HTML + standard CSS to PDF.

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


[NTG-context] interlaced overbrace and underbrace

2019-10-25 Thread mf

Hello list,
is there a better way to interlace overbraces and underbraces like this?

\starttext
These are the expressions to combine:

$$\overbrace{a+b+c}+d \quad a+\underbrace{b+c+d}$$

This is the desired result:

$$\overbrace{a+b+c}+d \kern-16mm\underbrace{\hbox to 15mm{ }}$$

\blank
{\tfx(the underbrace should move down a little more)}
\stoptext

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


[NTG-context] place single entry of a register, or filtering the terms of a register

2019-10-25 Thread mf

Hello list,
is there a way to place only one single entry of a register, or a 
selection of entries?


I looked into strc-reg.mkiv and strc-reg.lua and i would answer "no, 
it's not possible".
I could hack strc-reg.lua and define a command to do that, but maybe a 
better solution is already there.


Here's a very simple MWE to work on, in case it's possible:

\starttext
Cat\index{cat}, mouse\index{mouse}.
\page
Cat\index{cat}, dog\index{dog}.
\page
\placeindex
\page
Here I'd like to place only the "cat" entry:\par
\placeindex[criterium=???]
\stoptext

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


Re: [NTG-context] changing an XML node and reprocess it (or xmlflushing a string)

2019-10-08 Thread mf

Solved with a dirty hack:

\startbuffer[text]
A paragraph with a fraction made of text with styles:
a fraction made of text/with 
nested styles inside.

\stopbuffer

\startluacode
local gsub = string.gsub
local sfind = string.find
local xmlflush = lxml.flush

local startTextFraction = "$\\frac{\\text{"
local stopTextFraction  = "}}$"

function xml.functions.textfraction( t )
  local dt = t.dt
  inspect( dt )
  local wrapper
  local slashfound = false
  context( startTextFraction )
  local index, child
  for index, child in ipairs( dt ) do
if type( child ) == "string" then
  if not slashfound and sfind( child, "/" ) then
context( gsub( child, "/", "}}{\\text{" ) )
slashfound = true
  else
context( child )
  end
elseif type( child ) == "table" then
  wrapper = {
__parent__ = child.__parent__,
at = {},
dt = child
  }
  child.__parent__ = wrapper
  xmlflush( wrapper )
end
  end
  context( stopTextFraction )
end
\stopluacode

\startxmlsetups xml:textsetups
  \xmlsetsetup{#1}{*}{+}
  \xmlsetsetup{#1}{p|i|b|red}{xml:*}
  \xmlsetsetup{#1}{{span.fraction}}{xml:fraction}
\stopxmlsetups

\xmlregistersetup{xml:textsetups}

\startxmlsetups xml:p
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:i
  {\it \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:red
  {\red \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:b
  {\bf \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:fraction
  \xmlfunction{#1}{textfraction}
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{text}{}
\stoptext


Il 07/10/19 18:26, mf ha scritto:

Hello,
i'm using XML and i find useful specifying a fraction made of text this 
way:


text for numerator/text for denominator

With some lua, i can transform it into

\frac{\text{text for numerator}}{\text{text for denominator}}

which typesets something like this:

  text for numerator

text for denominator

Suppose you want to add some styling to the texts, like this:

text for numerator/text for 
denominator


You should split the span node into two elements and the xmlflush them.
This is my M(not)WE:

\startbuffer[text]
A paragraph with a fraction made of text with styles:
a fraction made of text/with 
styles inside.

\stopbuffer

\startluacode
local sub = string.sub
local sfind = string.find
local xmltext = xml.text
local xmlconvert = xml.convert

local function numeratorDenominator( text )
   local before, after = sfind( text, "[^<]/[^>]" )
   local num, den
   if before and after then
     num = sub( text, 1, before )
     den = sub( text, after )
   end
   return num, den
end


function xml.functions.textfraction( t )
   local text = xmltext( t, '' )
   local num, den = numeratorDenominator( text )
   if num and den then
     local fontstyle = tokens.getters.macro( "fontstyle" )
     local xml_num = xmlconvert( num )
     local xml_den = xmlconvert( den )
--    context( "$\\frac{\\text{\\" ..fontstyle .. " " .. num .. 
"}}{\\text{\\" ..fontstyle .. " " .. den .. "}}$" )

     context( "$\\frac{\\text{\\" ..fontstyle .. " " )
     context( num ) -- context.xmlprocessstring( xml_num )
     context( "}}{\\text{\\" ..fontstyle .. " " )
     context( den ) -- context.xmlprocessstring( xml_den )
     context( "}}$" )
   else
     context.xmlflush( t )
   end
end
\stopluacode

\startxmlsetups xml:textsetups
   \xmlsetsetup{#1}{*}{+}
   \xmlsetsetup{#1}{p|i|red}{xml:*}
   \xmlsetsetup{#1}{{span.fraction}}{xml:fraction}
\stopxmlsetups

\xmlregistersetup{xml:textsetups}

\startxmlsetups xml:p
   \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:i
   {\it \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:red
   {\red \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:fraction
   \xmlfunction{#1}{textfraction}
\stopxmlsetups

\starttext
   \xmlprocessbuffer{main}{text}{}
\stoptext

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


[NTG-context] changing an XML node and reprocess it (or xmlflushing a string)

2019-10-07 Thread mf

Hello,
i'm using XML and i find useful specifying a fraction made of text this way:

text for numerator/text for denominator

With some lua, i can transform it into

\frac{\text{text for numerator}}{\text{text for denominator}}

which typesets something like this:

 text for numerator

text for denominator

Suppose you want to add some styling to the texts, like this:

text for numerator/text for 
denominator


You should split the span node into two elements and the xmlflush them.
This is my M(not)WE:

\startbuffer[text]
A paragraph with a fraction made of text with styles:
a fraction made of text/with 
styles inside.

\stopbuffer

\startluacode
local sub = string.sub
local sfind = string.find
local xmltext = xml.text
local xmlconvert = xml.convert

local function numeratorDenominator( text )
  local before, after = sfind( text, "[^<]/[^>]" )
  local num, den
  if before and after then
num = sub( text, 1, before )
den = sub( text, after )
  end
  return num, den
end


function xml.functions.textfraction( t )
  local text = xmltext( t, '' )
  local num, den = numeratorDenominator( text )
  if num and den then
local fontstyle = tokens.getters.macro( "fontstyle" )
local xml_num = xmlconvert( num )
local xml_den = xmlconvert( den )
--context( "$\\frac{\\text{\\" ..fontstyle .. " " .. num .. 
"}}{\\text{\\" ..fontstyle .. " " .. den .. "}}$" )

context( "$\\frac{\\text{\\" ..fontstyle .. " " )
context( num ) -- context.xmlprocessstring( xml_num )
context( "}}{\\text{\\" ..fontstyle .. " " )
context( den ) -- context.xmlprocessstring( xml_den )
context( "}}$" )
  else
context.xmlflush( t )
  end
end
\stopluacode

\startxmlsetups xml:textsetups
  \xmlsetsetup{#1}{*}{+}
  \xmlsetsetup{#1}{p|i|red}{xml:*}
  \xmlsetsetup{#1}{{span.fraction}}{xml:fraction}
\stopxmlsetups

\xmlregistersetup{xml:textsetups}

\startxmlsetups xml:p
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:i
  {\it \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:red
  {\red \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:fraction
  \xmlfunction{#1}{textfraction}
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{text}{}
\stoptext

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


Re: [NTG-context] Access current element in xmlsetsetup via xml.expressions

2019-10-02 Thread mf

The answer is in lxml-lpt.lua, where built-in expressions are defined.
You need a good knowledge of LPEG that i miss.

Some built-in expressions get the current element as first argument, 
like count() or child() (lines 1300-1307 of lxml-lpt.lua):


expressions.child = function(e,pattern)
return applylpath(e,pattern) -- todo: cache
end

expressions.count = function(e,pattern) -- what if pattern == empty or nil
local collected = applylpath(e,pattern) -- todo: cache
return pattern and (collected and #collected) or 0
end

Some other expressions use a template that passes the "list", "ll", "l" 
and "order" arguments you find cited in the XML manual §4.1 "Path 
expressions - Expressions and filters".

These are the lines 738-743 in lxml-lpt.lua:

local template_e = [[
local expr = xml.expressions
return function(list,ll,l,order)
return %s
end
]]

That template is used by the function that registers a new expression 
(lines 807-812 in lxml-lpt.lua):


local function register_expression(expression)
local converted = lpegmatch(converter,expression)
local runner = load(format(template_e,converted))
runner = (runner and runner()) or function() 
errorrunner_e(expression,converted) end
return { kind = "expression", expression = expression, converted = 
converted, evaluator = runner }

end

Anyway i could not find a way to define an expression with a function 
like this:


xml.expressions.myexpr( ... )

that gets access to those arguments.

The only arguments it gets are the ones you specify in your LPATH 
expressions; AFAIK they are attributes values -- with the @attr syntax 
-- and strings.


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


Re: [NTG-context] passing variables/data between context and lua

2019-09-27 Thread mf

\starttext

\define\question{44}

\startluacode
-- see "ConTeXt Lua Documents" manual, §7.4 Looking inside
local question = tokens.getters.macro("question")
-- it's up to you to verify that \question contains a number
-- better using the userdata table for your data
userdata.points = tonumber( question ) * 92

-- do some calculations with points and return to to context
userdata.answer=42
\stopluacode

% lots of Text in between
The answer is \ctxlua{ context(userdata.answer) }. Points are \ctxlua{ 
context(userdata.points) }.


\stoptext

Best wishes,
Massi

Il 27/09/19 06:59, Martin Althoff ha scritto:

Hi, I am trying to pass variables/data between context and lua. Lua would be 
used for
calculations on data coming from context.

Unfortunately I can't figure out what to do. The code below doesn't work, but 
is there to
illustrate my idea.

Any help would be much appreciated. Thanks, Martin


\define\question{44}

\starttext

\startluacode
local points = \question * 92
-- do some calculations with points and return to to context
answer=42
\stopluacode

% lots of Text in between
The answer is \answer

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


___
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] standardmakeup and pages

2019-08-29 Thread mf

\setuppagenumbering[
alternative=doublesided,
]

% use pagestate=start on both makeups only if you want the title page
% to be the page 1 of the book
\definemakeup[title-page][align=middle,doublesided=no]
\definemakeup[imprint][align=top,page=no]

\starttext

\startmakeup[title-page]
bastard title
\stopmakeup

\startmakeup[imprint]
\vfill
imprint
\stopmakeup

This is the beginning of the book...

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


Re: [NTG-context] standardmakeup and pages

2019-08-29 Thread mf

Il 29/08/19 16:33, Henning Hraban Ramm ha scritto:

\setuppagenumbering[
 alternative=doublesided,
]

\starttext

\startstandardmakeup[align=center]
bastard title
\stopstandardmakeup

\startstandardmakeup[page=left]
\vfill
imprint
\stopstandardmakeup

\stoptext


\setuppagenumbering[
alternative=doublesided,
]

\definemakeup[title-page][align=middle,doublesided=no,pagestate=start]
\definemakeup[imprint][align=top,page=no,pagestate=start]

\starttext

\startmakeup[title-page]
bastard title
\stopmakeup

\startmakeup[imprint]
\vfill
imprint
\stopmakeup

\stoptext

Best wishes,
Massimiliano
___
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] an object representation of the node list of a paragraph: a lua table or a JSON

2019-07-10 Thread mf

Hello list,
i'd like having an object representation of a typeset paragraph or even 
a page, preferably as a JSON object, but a Lua table is equally good.


My reference is section "4.4 Node lists" of the CLD manual.

Before writing an iterator over the list of nodes of a paragraph, 
figuring out all the possible nodes and their fields, i'm wondering if 
there's some hidden tool in the ConTeXt coffer to simplify the task.


Best wishes,
Massimiliano
___
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] interfaces.definecommand fails with brackets inside string arguments

2019-07-08 Thread mf

Hello list,
i've played a bit with interfaces.definecommand, that lets you define 
TeX macros from lua (see the "ConTeXt Lua Documents", 7.3 User interfacing).


I found that the commands defined by interfaces.definecommand fail when 
you pass string arguments that contain brackets.


I think cldf-int.lua needs a patch to support those kind of arguments.

In the meantime it's possible to bypass the problem passing arguments 
with brackets inside double braces, as in the MWE attached.


Best wishes,
Massimiliano
\startluacode
  require("int_defcmd")
\stopluacode

\starttext
  \myCommand{Simple text}.\par

  \myCommand{\blank}

  % no problems with braces inside
  \myCommand{Text with {\it braces} inside}.\par

  % this fails, because there are brackets inside
  \myCommand{\blank[10pt]}

  % this does not fail, because of the double braces
  \myCommand{{\blank[10pt]}}

\stoptext
function userdata.myCommand( content )
  context( content )
end

interfaces.definecommand {
  name = "myCommand",
  arguments = {
{ "content", "string" }
  },
  macro = userdata.myCommand
}
___
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] context standalone installation broken

2019-05-14 Thread mf

Now it works again. Thanks!
Massimiliano

Il 14/05/19 12:29, Mojca Miklavec ha scritto:

Something broke with svn updates of TeX Live.

I'm looking into it.

Mojca
___
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] context standalone installation broken

2019-05-14 Thread mf

find tex -name plain.tex

finds nothing; there's no "plain" dir under ./tex/texmf/tex/

Massimiliano

Il 14/05/19 11:39, Henning Hraban Ramm ha scritto:

Am 2019-05-14 um 11:34 schrieb mf :


./first-setup.sh --engine=luatex --modules=all

downloads ok, but then

.../tex/setuptex gives this error:

"/home/massi/context/latest/tex" is not a valid TEXROOT path.
(There is no file 
"/home/massi/context/latest/tex/texmf/tex/plain/base/plain.tex")
provide a proper tex root (like '. setuptex /something/tex')


You must call setuptex with a path (or . if you’re in the right directory)-


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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] context standalone installation broken

2019-05-14 Thread mf

./first-setup.sh --engine=luatex --modules=all

downloads ok, but then

.../tex/setuptex gives this error:

"/home/massi/context/latest/tex" is not a valid TEXROOT path.
(There is no file 
"/home/massi/context/latest/tex/texmf/tex/plain/base/plain.tex")

provide a proper tex root (like '. setuptex /something/tex')

Massimiliano
___
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] vertical justification of mixedcolumns

2019-04-30 Thread mf

Hello list,
in this MWE the columns are not aligned at the bottom, and they are not 
at the bottom of the page:


\definevspacingamount[myBlank][5pt plus 5pt minus 2pt][5pt plus 5pt 
minus 2pt]

\starttext
\showgrid
\startmixedcolumns[n=2,balance=yes]
\dorecurse{2}{\input knuth \blank[myBlank]}
Another paragraph to make columns uneven.\par\blank[myBlank]
\dorecurse{3}{\input knuth \blank[myBlank]}
\stopmixedcolumns
\stoptext

Is there a way to configure mixedcolumns so that \blank[myBlank] is 
stretched or shrinked to get the two columns end aligned at the bottom 
of the page?


Thanks in advance,
Massimiliano
___
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] registers: setting pageleft parameter by index term

2019-04-29 Thread mf

Hello list, please consider this MWE:

\definenumber[p]
\setnumber[p][1]
\def\PageLeft{ p.~}
\def\TextCommand#1{\getnumber[p] 
#1\doif{\rawcountervalue[p]}{2}{\def\PageLeft{ P.~}}\incrementnumber[p]}

\setupindex[n=1,pageleft=\PageLeft,pageright=,textcommand=\TextCommand]
\starttext
Foo\index{foo}.
\page
Bar\index{bar}.
\page
Baz\index{baz}.
\page
\placeindex
\stoptext

The pageleft parameter of \setupindex (\setupregister) is normally set 
to " p.~", but it gets redefined to " P.~" for the second term in the 
index ("baz").


Here i'm using a counter and i check when it is 2, but i'd like to check 
if the term is "baz" (and i don't know how to do that test).


If you use deeptextcommand instead of textcommand, the pageleft 
parameter can't be redefined.


The following variation compiles, but it does not work, because pageleft 
is always " p.~":


\definenumber[p]
\setnumber[p][1]
\def\PageLeft{ p.~}
\def\TextCommand#1{\getnumber[p] 
#1\doif{\rawcountervalue[p]}{2}{\def\PageLeft{ P.~}}\incrementnumber[p]}

\setupindex[n=1,pageleft=\PageLeft,pageright=,deeptextcommand=\TextCommand]
\starttext
Foo\index{foo}.
\page
Bar\index{bar}.
\page
Baz\index{baz}.
\page
\placeindex
\stoptext

In my setup i must use deeptextcommand, and i want to set the pageleft 
and pageright parameters to a different value for some particular terms 
of the index.


Since the argument passed to deeptextcommand is not the text of the term 
(it's actually an id used to retrieve a much longer text), i can 
discriminate the terms by their id, but i can't setup pageleft and 
pageright accordingly from the command specified by deeptextcommand.


On the other hand, textcommand would let me set pageleft and pageright, 
but its argument is not pure text, and i don't know how to get the id 
from it.


How can i solve this problem?

Thanks,

Massimiliano

___
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] externalfigure broken with 20190222 beta

2019-02-23 Thread mf

BTW \startsidebar ... \stopsidebar stopped working too.

Massimiliano

Il 23/02/19 21:58, Hans Hagen ha scritto:

On 2/23/2019 5:10 PM, Rik Kabel wrote:

With the following example, I get:

...eXt/tex/texmf-context/tex/context/base/mkiv/grph-inc.lua:238: 
attempt to call upvalue 'imgwrap' (a nil value)


with the current (20190222) beta.

    \setupexternalfigures[location=default]
    \starttext
    \externalfigure[cow.pdf]
    \stoptext

Down for just me, or for everyone?

i'll fix it (low level cleanup going on)


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


  1   2   >