Re: [NTG-context] Minimum METAPOST code produces problematic PDF

2020-07-08 Thread Gerben Wierda
I found out this in the PDF spec:

The minimum page size should be 3 by 3 units in default user space; the maximum 
should be 14,400 by 14,400 units.

Apparently, Adobe InDesign demands that in a hard way.

G

> On 8 Jul 2020, at 01:08, Jairo A. del Rio  wrote:
> 
> Evince and Okular (Linux) open the PDF output without warnings nor issues.
> 
> Jairo :)
> 
> El mar., 7 de jul. de 2020 a la(s) 17:50, Gerben Wierda (gerben.wie...@rna.nl 
> ) escribió:
> The following code:
> 
> \startMPpage[instance=doublefun]
>   draw (0,0)--(100,0) dashed withdots;
> \stopMPpage
> 
> When run through LuaMetaTeX produces a PDF about which Acrobat complains:
> 
>   The dimensions of this page are out-of-range. Page content might be 
> truncated.
> 
> and Adobe InDesign cannot handle it at all (displays empty). 
> 
> The error message stays with
> 
> \startMPpage[instance=doublefun]
>   draw (0,0)--(100,0)—(100,2) dashed withdots;
> \stopMPpage
> 
> but disappears with
> 
> \startMPpage[instance=doublefun]
>   draw (0,0)--(100,0)—(100,3) dashed withdots;
> \stopMPpage
> 
> 
> Additionally, on the Adobe forums I have been told:
> 
>   Also, the color space is device gray (not RGB or CMYK)
> 
> which might be a more generic problem with LMTX output, I don’t know. It 
> might also be an Adobe problem. Previw.app on macOS handles the result 
> without problems.
> 
> ConTeXt standalone:
> 
> This is LuaMetaTeX, Version 2.06.02 
> open source > level 1, order 1, name 'cont-yes.mkiv'
> system  > 
> system  > ConTeXt  ver: 2020.05.12 16:21 MKIV beta  fmt: 2020.5.16  
> int: english/english
> 
> 
> G
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl  / 
> http://www.ntg.nl/mailman/listinfo/ntg-context 
> 
> webpage  : http://www.pragma-ade.nl  / 
> http://context.aanhet.net 
> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
> 
> wiki : http://contextgarden.net 
> ___
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] About xstring and ConTeXt

2020-07-08 Thread Hans Hagen

On 7/8/2020 12:00 AM, Jairo A. del Rio wrote:
Yep, now it finally works. Certainly it requires a few more lines. I was 
going to rewrite some TikZ code which was too dependent on LaTeX and 
xstring was the last stone on the shoe. Thank you a lot, Phelype and 
Wolfgang (I didn't know about push/popmacro either and now it's in my 
to-do readings).
Just wondering ... are there specific low level hel;pers (wrt strings) 
that you need in context?


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
___


Re: [NTG-context] lpath to select last item

2020-07-08 Thread Pablo Rodriguez
On 7/8/20 11:59 AM, Hans Hagen wrote:
> On 7/7/2020 10:46 PM, Pablo Rodriguez wrote:
>> [...]
>> Which would be the right lpath to select the last item in each list?
> This should work but we're one off so i need to fix that.
>
> \startbuffer[demo]
> 
>
>  first
>  any
>  last
>
> 
> \stopbuffer
>
> \startxmlsetups xml:demo:base
>\xmlsetsetup{#1}{document|ul|li}{xml:*}
>\xmlsetsetup{#1}{ul/li[1]}{xml:item:first}
>\xmlsetsetup{#1}{ul/li[-1]}{xml:item:last}
> \stopxmlsetups

Many thanks for your help, Hans.

This is like magic to me. But I’m afraid that my description was inaccurate.

I need to mark the last item from nested lists, but considering each
 (such as in my sample), not the whole document.

Just in case it isn’t clear, this is the XML source with desired items
marked:


Heading
  
list***this one***
  
Heading
  
list

   list ***this one***

  
Heading
  
list

  list
  
list   ***this one***
  

  


I hope it is clear now that it is the last item in a nested list, but
for each  element.

Many thanks for your help again,

Pablo
--
http://www.ousia.tk
___
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] \placetable vs. \placefloat and option "none"

2020-07-08 Thread Wolfgang Schuster

Lukas/ConTeXt schrieb am 08.07.2020 um 12:08:

Hello,

(– resending now without resulting .pdf to avoid attachment size limit –)

option "none" has different effect with \placetable and \placefloat.

No problem with this, but as I thought both commands raise from the same code 
(or more precisely: I thought that \placetable is special case (specialization) 
of \placefloat), I'm a bit surprised that \placefloat[none] keeps caption 
whilst \placetable[none] supresses it. See the sample:


\setupexternalfigures[location=default]

\starttext
   \placetable[force,none]{}{\externalfigure[cow]} % [1]
   \placefloat[force,none]{}{\externalfigure[cow]}
\stoptext


(I'm aware that I'm placing \externalfigure into \placetable in [1] - does it 
matter?)

- Also relates here: https://wiki.contextgarden.net/Command/placefloat .


The \placefloat command expects the name of the float instance as first 
argument, e.g. \placefloat[table].


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] \placetable vs. \placefloat and option "none"

2020-07-08 Thread Lukas/ConTeXt
Hello,

(– resending now without resulting .pdf to avoid attachment size limit –)

option "none" has different effect with \placetable and \placefloat.

No problem with this, but as I thought both commands raise from the same code 
(or more precisely: I thought that \placetable is special case (specialization) 
of \placefloat), I'm a bit surprised that \placefloat[none] keeps caption 
whilst \placetable[none] supresses it. See the sample:


\setupexternalfigures[location=default]

\starttext
  \placetable[force,none]{}{\externalfigure[cow]} % [1]
  \placefloat[force,none]{}{\externalfigure[cow]}
\stoptext


(I'm aware that I'm placing \externalfigure into \placetable in [1] - does it 
matter?)

- Also relates here: https://wiki.contextgarden.net/Command/placefloat .

Best regards,

Lukas\setupexternalfigures[location=default]

\starttext
  \placetable[force,none]{}{\externalfigure[cow]}
  \placefloat[force,none]{}{\externalfigure[cow]}
\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] About xstring and ConTeXt

2020-07-08 Thread Hans Hagen

On 7/8/2020 12:00 AM, Jairo A. del Rio wrote:
Yep, now it finally works. Certainly it requires a few more lines. I was 
going to rewrite some TikZ code which was too dependent on LaTeX and 
xstring was the last stone on the shoe. Thank you a lot, Phelype and 
Wolfgang (I didn't know about push/popmacro either and now it's in my 
to-do readings).


We can have a module that takes care of some things, like

\usemodule[system-aliasing]

\registeralias\unexpanded\normalunexpanded  % preset
\registeralias\expanded  \normalexpanded% preset

\registeraliasfile{rubish.tex}% any file with that name
\registeraliasfile{generic/*.tex} % a bit more explicit

after which

\input rubish.tex
\input generic/foo.tex

(or whatever way it's loaded) will (hopefully) work ok. But as a module, 
not in the core, because we don't want additional overhead for third 
party stuff, but ok on user demand. Of course one cannot expect the 
context dev to keep a list of files that need such a treatment.


Hans


Jairo :D

El mar., 7 de jul. de 2020 a la(s) 16:31, Phelype Oleinik 
(phe.h...@gmail.com ) escribió:


On Tue, Jul 7, 2020 at 6:21 PM Jairo A. del Rio
mailto:jairoadelr...@gmail.com>> wrote:
 >
 > Thank, Wolfgang! Both methods work, but both fail with the
following example:
 >
 > \pushmacro\unexpanded
 > \let\unexpanded\normalunexpanded
 > \input xstring
 > \popmacro\unexpanded
 > \starttext
 > \StrGobbleLeft{bcdef}{4}
 > \stoptext
 >
 > The log says:
 >
 > tex error > tex error on line 6 in file ./tests.tex: ! This can't
happen (prefixed command)
 >
 >
 >  \unexpanded {
 >
 > f}
 >
 > \xs_execfirst #1#2->#1
 >
 > However, some others work.

As I said, the internals of `xstring` still use \unexpanded which, after
you do \popmacro\unexpanded, will mean e-TeX's \protected, rather than
\unexpanded, which are quite different.  To be on the safe side, you'd
need to wrap every `xstring` command in
     \pushmacro\unexpanded
     \let\unexpanded\normalunexpanded
     
     \popmacro\unexpanded
to make sure that \unexpanded means what `xstring` expects.

The *proper* way to make `xstring` work in ConTeXt would be something
like Circuitikz does:
     \ifcsname normalunexpanded\endcsname
       \let\pgfcircutil@unexpanded\normalunexpanded
     \else
       \let\pgfcircutil@unexpanded\unexpanded
     \fi
then use \pgfcircutil@unexpanded in the code, which will always have the
same meaning.  That, of course, requires an update to `xstring`.

Phelype

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




--

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


Re: [NTG-context] lpath to select last item

2020-07-08 Thread Hans Hagen

On 7/7/2020 10:46 PM, Pablo Rodriguez wrote:

Dear list,

I have the following sample:

   \startbuffer[demo]
 
 Heading
   
 list
   
 Heading
   
 list
 
list
 
   
 Heading
   
 list
 
   list
   
 list
   
 
   
 
   \stopbuffer

   \startxmlsetups xml:demo:base
   \xmlsetsetup{#1}{document|h2|ul|li}{xml:*}
   %~ \xmlsetsetup{#1}{ul/li/!ul}{xml:last:item} % nothing changes
   %~ \xmlsetsetup{#1}{ul/li/!li}{xml:last:item} % blank item inserted
   %~ \xmlsetsetup{#1}{h2/**/ul/li}{xml:last:item} % nothing changes
   \xmlsetsetup{#1}{h2/***/ul/li/!ul}{xml:last:item} % shouldn’t be
this one?
   \stopxmlsetups

   \xmlregistersetup{xml:demo:base}

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

   \startxmlsetups xml:h2
   \section{\xmlflush{#1}}
   \stopxmlsetups

   \startxmlsetups xml:ul
   \startitemize\xmlflush{#1}\stopitemize
   \stopxmlsetups

   \startxmlsetups xml:li
   \startitem\xmlflush{#1}\stopitem
   \stopxmlsetups

   \startxmlsetups xml:last:item
   \startitem\red\xmlflush{#1}\stopitem
   \stopxmlsetups

   \starttext
   \xmlprocessbuffer{main}{demo}{}
   \stoptext

I need to be able to select the last  (the one with no  child)
in the  element.

I thought that the lpath for that would be "h2/***/ul/li/!ul", but I
don’t know what I’m missing, since it doesn’t work at all.

Which would be the right lpath to select the last item in each list?

This should work but we're one off so i need to fix that.

\startbuffer[demo]

  
first
any
last
  

\stopbuffer

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{document|ul|li}{xml:*}
  \xmlsetsetup{#1}{ul/li[1]}{xml:item:first}
  \xmlsetsetup{#1}{ul/li[-1]}{xml:item:last}
\stopxmlsetups

\xmlregistersetup{xml:demo:base}

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

\startxmlsetups xml:ul
 \startitemize
   \xmlflush{#1}
 \stopitemize
\stopxmlsetups

\startxmlsetups xml:li
  \startitem
\xmlflush{#1}
  \stopitem
\stopxmlsetups

\startxmlsetups xml:item:first
  \startitem
\color[blue]{\xmlflush{#1}}
  \stopitem
\stopxmlsetups

\startxmlsetups xml:item:last
  \startitem
\color[red]{\xmlflush{#1}}
  \stopitem
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{demo}{}
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] \placetable vs. \placefloat and option "none"

2020-07-08 Thread Lukas/ConTeXt
Hello,

option "none" has different effect with \placetable and \placefloat.
No problem with this, but as I thought both commands raise from the same code 
(or more precisely: I thought that \placetable is special case (specialization) 
of \placefloat), I'm a bit surprised that \placefloat[none] keeps caption 
whilst \placetable[none] supresses it. See the sample:


\setupexternalfigures[location=default]

\starttext
  \placetable[force,none]{}{\externalfigure[cow]} % [1]
  \placefloat[force,none]{}{\externalfigure[cow]}
\stoptext


(I'm aware that I'm placing \externalfigure into \placetable in [1] - does it 
matter?)

- Also relates here: https://wiki.contextgarden.net/Command/placefloat .

Best regards,

Lukas\setupexternalfigures[location=default]

\starttext
  \placetable[force,none]{}{\externalfigure[cow]}
  \placefloat[force,none]{}{\externalfigure[cow]}
\stoptext


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