[NTG-context] streams reversed?

2023-09-12 Thread jbf
I am making some progress with a bilingual text using the streams 
mechanism suggested by Wolfgang: https://wiki.contextgarden.net/Columns, 
but see below.


The aim has been to have en and vi on facing pages (en left, vi right).

It works correctly for the Foreword in two languages (en, vi) in 
frontmatter.


When I come to bodymatter and Chapter 1, again it works, except that the 
positions of the languages are reversed, so I end up with vi on the left 
and en on the right. By Chapter 2 we are back to the correct position 
once more (en left and vi right).


I want to know why this is happening, and if I can prevent it happening.

I am using the code you can see below, except that instead of 
\startoutputstream[one] and \startoutputstream[two] etc.  I am using 
[en-front][vi-front], and then in bodymatter [en-chap1][vi-chap1] etc. 
etc. with the relevant repetitions of these identifiers where needed. I 
assume that to get a degree of synchronization I need to use this 
approach for each set of chapters. But I cannot understand why the 
languages alternate their starting page positions each chapter.


There are other issues I have to solve, but first of all I wish to 
resolve this one.


Julian


The original (Wolfgang) code is as follows:

\starttext

\startoutputstream[one]
   \startcolor[red]
   \dorecurse{10}{\input  knuth\par}
   \stopcolor
\stopoutputstream

\startoutputstream[two]
   \startcolor[green]
   \dorecurse{10}{\input  zapf\par}
   \stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
 {\ifvoid\scratchboxone
\exitloop
  \else
\setbox\scratchboxfour\vsplit\scratchboxone  to\textheight
\vbox  to\vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo  to\textheight
\vbox  to\vsize{\box\scratchboxfive\vss}%
  \fi}

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread Andres Conrado Montoya
You can find some examples in the wiki to do something similar:
https://wiki.contextgarden.net/Generate_Authorlist_from_Head_Content

Also you can use setups instead of macro definitions, and create spaces
with \space, \par, etc: https://wiki.contextgarden.net/Setups

-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Von: Wolfgang Schuster 
Gesendet: Dienstag, 12. September 2023 23:16
An: Maier, Denis Christian (UB) 
Cc: ntg-context@ntg.nl
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch schrieb am 12.09.2023 um 
21:38:

Von: Wolfgang Schuster 

Gesendet: Dienstag, 12. September 2023 21:30
An: Maier, Denis Christian (UB) 

Cc: ntg-context@ntg.nl
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch schrieb am 12.09.2023 um 
21:24:



Von: Wolfgang Schuster 

Gesendet: Dienstag, 12. September 2023 20:41
An: mailing list for ConTeXt users 
; Maier, Denis Christian (UB) 

Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch schrieb am 12.09.2023 um 
17:47:



Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

There are ways but not in a general way because you try to access the values
before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

I'm just trying to output the author's name above a chapter heading. Do you 
need more information?

You can create a custom header for the chapter page and show the value of the 
author key
which works without problems because the header is added after to the finished 
page
after the value is available.

Another option when the name should appear in the same space as the chapter 
title
is a custom layout for the title.
Yes, I've tried that in the original MWE:

...

Here, I'm getting  just before <3 Third>. So I guess this goes in 
the right direction, but \define doesn't allow for blanks etc. 
\starttexdefinition and \def on the other hand gave me erros.

You need a box to get the author on a separate line.

% \define[2]\ChapterCommand
%   {\vbox
%  {\structureuservariable{author}
%  \blank
%  #1\space#2}}

\starttexdefinition protected ChapterCommand #1#2
  \vbox\bgroup
\structureuservariable{author}
\blank
#1\space#2
  \egroup
\stoptexdefinition


Thank you so much, Wolfgang!

Why do you need protected here? I've realized that \protected\def also helps a 
bit, but, of course, paragraph breaks are ignored there as well...
If just found the following in the lowlevel-macros manual:

So, \long is gone, but why is that? Is there a new mechanism that serves the 
same purpose? Other than using a vbox, I mean...

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread Wolfgang Schuster

denis.ma...@unibe.ch schrieb am 12.09.2023 um 21:38:


*Von:*Wolfgang Schuster 
*Gesendet:* Dienstag, 12. September 2023 21:30
*An:* Maier, Denis Christian (UB) 
*Cc:* ntg-context@ntg.nl
*Betreff:* Re: [NTG-context] Using structureuservariables before the 
heading


denis.ma...@unibe.ch  schrieb am 
12.09.2023 um 21:24:


*Von:*Wolfgang Schuster 

*Gesendet:* Dienstag, 12. September 2023 20:41
*An:* mailing list for ConTeXt users 
; Maier, Denis Christian (UB)
 
*Betreff:* Re: [NTG-context] Using structureuservariables before
the heading

denis.ma...@unibe.ch  schrieb am
12.09.2023 um 17:47:


Hi,

is it possible to access a structureuservariable before the
heading’s title ?

Using the «before» key does not seem to work.


There are ways but not in a general way because you try to access
the values
before they are known to ConTeXt. To provide a proper solution you
have
to tell what you're trying to achieve.

I’m just trying to output the author’s name above a chapter
heading. Do you need more information?


You can create a custom header for the chapter page and show the value 
of the author key
which works without problems because the header is added after to the 
finished page

after the value is available.

Another option when the name should appear in the same space as the 
chapter title

is a custom layout for the title.

Yes, I’ve tried that in the original MWE:

%%

\setuphead[chapter][

    before={Before: \structureuservariable{author}\blank},

    beforesection={Beforesection: \structureuservariable{author}\blank},

    insidesection={Insidesection: \structureuservariable{author}\blank},

    after={After: \structureuservariable{author}\blank},

    ]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}

\define[2]\myChapterCommand{\structureuservariable{author}\blank 
#1\space#2}


%\def\myChapterCommand#1#2{\structureuservariable{author}\blank 
#1\space#2} % does not work


% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, 
but at least blanks should work


%   \structureuservariable{author}

%   Test

%   \blank

%   #1\space#2

% \stoptexdefinition

\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]

\input knuth

\stopchapter

\startchapter[title=Second][author=Second Author]

\input knuth

\stopchapter

\setuphead[chapter]

    [

    before=,after=,beforesection=,insidesection=,

    command=\myChapterCommand,

]

\startchapter[title=Third][author={Third Author}]

\input knuth

\stopchapter

\stoptext

%%

Here, I’m getting «Third author» just before «3 Third». So I guess 
this goes in the right direction, but \define doesn’t allow for blanks 
etc. \starttexdefinition and \def on the other hand gave me erros.




You need a box to get the author on a separate line.

% \define[2]\ChapterCommand
%   {\vbox
%  {\structureuservariable{author}
%  \blank
%  #1\space#2}}

\starttexdefinition protected ChapterCommand #1#2
  \vbox\bgroup
    \structureuservariable{author}
    \blank
    #1\space#2
  \egroup
\stoptexdefinition

\setuphead
  [chapter]
  [command=\ChapterCommand]

\starttext

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter

\stoptext

Wolfgang

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Von: Wolfgang Schuster 
Gesendet: Dienstag, 12. September 2023 21:30
An: Maier, Denis Christian (UB) 
Cc: ntg-context@ntg.nl
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch schrieb am 12.09.2023 um 
21:24:


Von: Wolfgang Schuster 

Gesendet: Dienstag, 12. September 2023 20:41
An: mailing list for ConTeXt users 
; Maier, Denis Christian (UB) 

Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch schrieb am 12.09.2023 um 
17:47:


Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

There are ways but not in a general way because you try to access the values
before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

I'm just trying to output the author's name above a chapter heading. Do you 
need more information?

You can create a custom header for the chapter page and show the value of the 
author key
which works without problems because the header is added after to the finished 
page
after the value is available.

Another option when the name should appear in the same space as the chapter 
title
is a custom layout for the title.
Yes, I've tried that in the original MWE:

%%
\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, but at 
least blanks should work
%   \structureuservariable{author}
%   Test
%   \blank
%   #1\space#2
% \stoptexdefinition

\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter

\stoptext
%%

Here, I'm getting  just before <3 Third>. So I guess this goes in 
the right direction, but \define doesn't allow for blanks etc. 
\starttexdefinition and \def on the other hand gave me erros.

Denis

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread Wolfgang Schuster

denis.ma...@unibe.ch schrieb am 12.09.2023 um 21:24:


*Von:*Wolfgang Schuster 
*Gesendet:* Dienstag, 12. September 2023 20:41
*An:* mailing list for ConTeXt users ; Maier, 
Denis Christian (UB) 
*Betreff:* Re: [NTG-context] Using structureuservariables before the 
heading


denis.ma...@unibe.ch  schrieb am 
12.09.2023 um 17:47:


Hi,

is it possible to access a structureuservariable before the
heading’s title ?

Using the «before» key does not seem to work.


There are ways but not in a general way because you try to access the 
values

before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

I’m just trying to output the author’s name above a chapter heading. 
Do you need more information?




You can create a custom header for the chapter page and show the value 
of the author key
which works without problems because the header is added after to the 
finished page

after the value is available.

Another option when the name should appear in the same space as the 
chapter title

is a custom layout for the title.

Wolfgang

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread denis.maier

Von: Wolfgang Schuster 
Gesendet: Dienstag, 12. September 2023 20:41
An: mailing list for ConTeXt users ; Maier, Denis Christian 
(UB) 
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch schrieb am 12.09.2023 um 
17:47:

Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

There are ways but not in a general way because you try to access the values
before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

I'm just trying to output the author's name above a chapter heading. Do you 
need more information?

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread Wolfgang Schuster

denis.ma...@unibe.ch schrieb am 12.09.2023 um 17:47:


Hi,

is it possible to access a structureuservariable before the heading’s 
title ?


Using the «before» key does not seem to work.



There are ways but not in a general way because you try to access the values
before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

Wolfgang

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

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

[NTG-context] Re: Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Ok, \starttexdefinition allows blanks, apparently just like setups.
But, it still fails exactly like the version with \def


\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, but at 
least blanks should work
%   \structureuservariable{author}
%   Test
%   \blank
%   #1\space#2
% \stoptexdefinition


\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter


\stoptext

Von: denis.ma...@unibe.ch 
Gesendet: Dienstag, 12. September 2023 17:48
An: ntg-context@ntg.nl
Betreff: [NTG-context] Using structureuservariables before the heading

Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

As an aside, I've tried to use the < command > key to provide my own command, 
but while \define works here (but ignores \blank), \def gives me an error.
Why is that?
How would you add blanks to a user-defined command?

Best,
Denis



\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

\starttext
\macro{1}{2}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author=Third Author]
\input knuth
\stopchapter


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

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

[NTG-context] Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

As an aside, I've tried to use the < command > key to provide my own command, 
but while \define works here (but ignores \blank), \def gives me an error.
Why is that?
How would you add blanks to a user-defined command?

Best,
Denis



\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

\starttext
\macro{1}{2}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author=Third Author]
\input knuth
\stopchapter


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

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

[NTG-context] Re: tiffs: autoconversion via graphicsmagick produces invalid pdfs

2023-09-12 Thread denis.maier
Sorry, that was too quick...

Hi,

currently, ConTeXt can't use tiffs directly, but it uses Graphicsmagick to 
convert tiffs to pdf on the fly. However, as it seems, graphicsmagick is 
producing invalid pdfs.

For every included tiff I have something like this in the log:
luatex warning  > pdfe: invalid 11 0 R object at offset 573751
luatex warning  > pdfe: invalid 11 0 R object at offset 629127

The offsets are different, but it's always this .

This bug has been known for quite some time, but it apparently hasn't been 
fixed yet: https://sourceforge.net/p/graphicsmagick/bugs/513/

Converting the tiffs to jpeg circumvents the problem. Would it be an option to 
convert tiffs to jpegs instead of to pdf? (Is that already possible?)

Best,
Denis



Von: denis.ma...@unibe.ch 
Gesendet: Dienstag, 12. September 2023 17:03
An: ntg-context@ntg.nl
Betreff: [NTG-context] tiffs: autoconversion via graphicsmagick produces 
invalid pdfs

Hi,

currently, ConTeXt can't use tiffs directly, but it uses
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] tiffs: autoconversion via graphicsmagick produces invalid pdfs

2023-09-12 Thread denis.maier
Hi,

currently, ConTeXt can't use tiffs directly, but it uses
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Reduce space between lines in Natural Tables

2023-09-12 Thread Jeroen
It does not seem to have an effect to the table. The distance between the
rows remains the same
Thanks, Jeroen

Op ma 11 sep 2023 om 09:08 schreef :

> \bTABLE[spaceinbetween=0cm]
>
>   ...
>
> \eTABLE
>
>
>
>
>
>
>
> *Von:* Jeroen 
> *Gesendet:* Sonntag, 10. September 2023 22:05
> *An:* mailing list for ConTeXt users 
> *Betreff:* [NTG-context] Reduce space between lines in Natural Tables
>
>
>
> Is there an easy way to reduce the line space between rows in a natural
> table so the table takes less vertical space.
>
> Thanks, Jeroen
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: \dontleavethemode

2023-09-12 Thread Wolfgang Schuster

Ursula Hermann schrieb am 12.09.2023 um 11:19:


Dear List,

I have done an little example with a \blackrule:

\setuppapersize[A8,landscape]

\setuplayout[leftmargin=2.5cm,

leftmargindistance=0.2cm,

backspace=2.9cm,

width=4cm]

\starttext

\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm]


\startformula

a^n + b^n = c^n.

\stopformula

\stoptext

My Question is , where to put margintext, with \dontleavethemode, with 
blackrule, because if I put it after \starttext:


\margintext{\blackrule\\{Me}}\dontleavehmode\blackrule

Before :

\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm] there 
is no pdf after compiling.


[...]



\margintext{\blackrule\\{Me}}\dontleavethemode

\blackrule

[...]

The control sequence at the end of the top line of your error message 
was never


\def'ed. You can just continue as I'll forget about whatever was 
undefined.


mtx-context | fatal error: return code: 1



You get a error message because you have a spelling error in the name of 
the \dontleavehmode command.


You wrote "dontleave*the*mode" but the correct name "dontleave*h*mode".

Wolfgang

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

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

[NTG-context] \dontleavethemode

2023-09-12 Thread Ursula Hermann
Dear List,

I have done an little example with a \blackrule:

\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\starttext
\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm]
\startformula
a^n + b^n = c^n.
\stopformula
\stoptext

My Question is , where to put margintext, with \dontleavethemode, with 
blackrule, because if I put it after \starttext:
\margintext{\blackrule\\{Me}}\dontleavehmode\blackrule
Before :
\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm] there is no 
pdf after compiling.

I get:
Command Line:   context.exe --synctex=-1 "pablo.tex"
Startup Folder: 
C:\Users\Hermann\Downloads\context-mswin\tex\texmf-context\tex\context\test\mkiv


resolvers   | formats | executing runner 'run luametatex format': 
luametatex --jobname="./pablo.tex" --socket --shell-escape 
--fmt=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./pablo.tex" --c:input="./pablo.tex" 
--c:kindofrun=1 --c:maxnofruns=9 --c:synctex="-1" 
--c:texmfbinpath="C:/Users/Hermann/Downloads/context-mswin/tex/texmf-mswin/bin"
system  >
system  > ConTeXt  ver: 2023.09.03 19:03 LMTX  fmt: 2023.9.4  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './pablo', input './pablo.tex', result 
'./pablo'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
open source > level 1, order 2, name './pablo.tex'
modules > using user prefixed file 's-layout-show'
modules > 's-layout-show' is loaded
open source > level 2, order 3, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/modules/mkxl/s-layout-show.mkxl'
loading > ConTeXt Page Macros / Runtime Macros
resolvers   > lua > loading file 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkiv/page-run.lua'
 succeeded
close source> level 2, order 3, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/modules/mkxl/s-layout-show.mkxl'
fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
pack quality> underfull hbox at line 7 in file './pablo.tex':  (badness 
1490)
pack quality> underfull hbox at line 7 in file './pablo.tex': Me (badness 
1448)
tex error   > tex error on line 7 in file ./pablo.tex: Undefined control 
sequence


\margintext{\blackrule\\{Me}}\dontleavethemode
\blackrule

1 \setuppapersize[A8,landscape]
2 \setuplayout[leftmargin=2.5cm,
3  leftmargindistance=0.5cm,
4  backspace=2.9cm,
5  width=4cm]
6 \showframe
7 >>  \margintext{\blackrule\\{Me}}\dontleavethemode\blackrule
8 margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm]
9 \starttext
10 \startformula
11 a^n + b^n = c^n.
12 \stopformula
13 \stoptext
The control sequence at the end of the top line of your error message was never
\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 1


_

ConTeXt Compilation Report (Pages: 0)

Errors: 0   Warnings: 0   Bad Boxes: 0

Thanks
Uschi




blackrule1.pdf
Description: blackrule1.pdf
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: XML: flush to lua function

2023-09-12 Thread Taco Hoekwater
Hi,

xml.text(t) is safer than directly accessing t.dt[1].

Note: you may need to strip some XML tags from that content. 

If the element is not straight-up data but has nested elements, then this will 
return the full xml representation instead:

 A short title=> ‘A short title'
 => ‘'
  => ''


Best wishes,
Taco

> On 12 Sep 2023, at 08:56,   wrote:
> 
> Ok, I’ve found a way, see below.
> But maybe someone has some nice lua (or other) tricks to share… (I’m not sure 
> accessing t.dt[1] is particularly safe when operating on nested structures.)
>  Best,
> Denis
>  \startbuffer[test]
> 
> 
> 
> A short title
> asdf asdf asdf jklö jklö jklö
>   
>   
> A longer title bla bla bla bla bla bla bla bla
> 
> asdf asdf asdf jklö jklö jklö
> 
>   
> 
> \stopbuffer
>  \startxmlsetups xml:test
> \xmlsetsetup{#1}{*}{-}
> \xmlsetsetup{#1}{doc|chapter|p}{xml:*}
> \stopxmlsetups
>  \xmlregisterdocumentsetup{test}{xml:test}
>  \startxmlsetups xml:doc
>\xmlflush{#1}
> \stopxmlsetups
>  \setuphead[chapter][expansion=yes] % make sure the stuff gets expanded on 
> time
> \startxmlsetups xml:chapter
> \startchapter
>[
>
> title={\xmlfilter{#1}{/title/command(xml:chapter:title)}},
>
> marking={\xmlfilter{#1}{/title/command(xml:chapter:title:marking)}},
>]
>\xmlflush{#1}
> \stopchapter
> \stopxmlsetups
>  \startxmlsetups xml:p
> \xmlflush{#1}\par
> \stopxmlsetups
>  \startluacode
> function xml.functions.getMarking(t)
> _,n = t.dt[1]:gsub("%S+","")
> if n > 10 then   local words = {} 
>   for word in t.dt[1]:gmatch("%S+") do table.insert(words, word) end
>   local resWords = {}
>   resWords =  { unpack( words, 1, 7 ) }
>   res = table.concat(resWords, " ") .. " …"
> else   res = t.dt[1]
> end
> context(res)
> end
> \stopluacode
>  \startxmlsetups xml:chapter:title:marking
> \xmlfunction{#1}{getMarking}
> \stopxmlsetups
>  \startxmlsetups xml:chapter:title
> \xmlflush{#1}
> \stopxmlsetups
>   \setupheadertexts[chapter]
>  \starttext
>  \xmlprocessbuffer{test}{test}{}
>  \stoptext
>   Von: denis.ma...@unibe.ch  
> Gesendet: Montag, 11. September 2023 16:47
> An: ntg-context@ntg.nl
> Betreff: [NTG-context] XML: flush to lua function
>  Hi,
> I have the following xml setup with a lua function:
>  \startluacode
> function markingLength(s)
> _,n = s:gsub("%S+","")
> if n > 3 then context("yes" .. " …") else 
> context("no") end
> end
> \stopluacode
>  \startxmlsetups xml:ink:ink-title:marking
> %\ctxlua{markingLength(\xmlflush{#1})}  % does not work
> \ctxlua{markingLength{"1 2 3 4"}}
> \stopxmlsetups
>  While the function works, I cannot use xmlflush here. How can I properly 
> pass the xml content to the lua function?
>  Best,
> Denis
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___


— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


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

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