[NTG-context] Re: weird \inlinetypebuffer interaction

2024-05-09 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 08.05.2024 um 18:05:

On 5/7/24 22:37, Wolfgang Schuster wrote:

[...]
\typebuffer disables automatic \endash and \emdash with the
\nohyphencollapsing command
but the command isn't used for \typeinlinebuffer.

Many thanks for your explanation, Wolfgang.

Since \type doesn’t collapse hyphens, wouldn’t it be possible to add
\nohyphencollapsing to \typeinlinebuffer just for the sake of output
consistency?


You can make \typeinlinebuffer behave like \type by adding a second 
initializer which besides other things prevents hyphen collapsing.



buff-ver.mkxl:

\protected\def\buff_verbatim_type_buffer_indeed_inline#1#2%
  {\cdef\currenttype{#1}%
   \buff_verbatim_initialize_type_one
+  \buff_verbatim_initialize_type_two
   \dostarttaggedchained\t!verbatim\currenttype\??type
   \clf_typebuffer
 name   {#2}%
 strip  {\v!yes}%
 regime {\currentregime}%
 method {\p_buff_option}%
 nature {inline}% is default anyway
   \relax
   \dostoptagged}

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: weird \inlinetypebuffer interaction

2024-05-08 Thread Pablo Rodriguez via ntg-context
On 5/7/24 22:37, Wolfgang Schuster wrote:
> [...]
> \typebuffer disables automatic \endash and \emdash with the
> \nohyphencollapsing command
> but the command isn't used for \typeinlinebuffer.
Many thanks for your explanation, Wolfgang.

Since \type doesn’t collapse hyphens, wouldn’t it be possible to add
\nohyphencollapsing to \typeinlinebuffer just for the sake of output
consistency?

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: weird \inlinetypebuffer interaction

2024-05-07 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 07.05.2024 um 19:40:

On 5/6/24 22:45, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 06.05.2024 um 20:06:

Dear list,

I have the following sample:

\definefontfamily[mainface][tt][TeX Gyre Termes]

Apply the none feature when you set the monospace font, i.e.

\definefontfamily[...][tt][...][features=none]

Many thanks for your reply, Wolfgang.

This solves the issue, but I have two questions.

Why is this only required for \inlinetypebuffer and not for \typebuffer?

Which is the exact font feature that does the hyphen ligatures?

I’m interested in not disabling hz and hanging.


\typebuffer disables automatic \endash and \emdash with the 
\nohyphencollapsing command

but the command isn't used for \typeinlinebuffer.

\starttext

\type{--} = --

\nohyphencollapsing

\type{--} = --

\dohyphencollapsing

\type{--} = --

\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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: weird \inlinetypebuffer interaction

2024-05-07 Thread Pablo Rodriguez via ntg-context
On 5/6/24 22:45, Wolfgang Schuster wrote:
> Pablo Rodriguez via ntg-context schrieb am 06.05.2024 um 20:06:
>> Dear list,
>>
>> I have the following sample:
>>
>>\definefontfamily[mainface][tt][TeX Gyre Termes]
>
> Apply the none feature when you set the monospace font, i.e.
>
> \definefontfamily[...][tt][...][features=none]

Many thanks for your reply, Wolfgang.

This solves the issue, but I have two questions.

Why is this only required for \inlinetypebuffer and not for \typebuffer?

Which is the exact font feature that does the hyphen ligatures?

I’m interested in not disabling hz and hanging.

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] weird \inlinetypebuffer interaction

2024-05-06 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample:

  \definefontfamily[mainface][tt][TeX Gyre Termes]
  \setupbodyfont[mainface]
  \starttext
  \startbuffer
  context --purgeall
  \stopbuffer
  inline \typeinlinebuffer

  block:
  \typebuffer
  \stoptext

As long as there is no defined font family for mono, \typeinlinebuffer
doesn’t convert -- into an en-dash (the same way as \typebuffer behaves).

But as in the sample above, when a font is defined for mono (at least
with \definefontfamily), \typeinlinebuffer converts -- into en-dashes
(different from \typebuffer).

Sorry, but how could I fix this \typeinlinebuffer?

This is important for me, since two hyphens is one of the most common
ways to marks options when invoking programs (which I try to explain to
others).

BTW, \sciteinlinebuffer seems have the same problem (in the scite module).

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Wiki - question about Command/ pages which start with a space character

2024-04-14 Thread garulfo
Hi all,

Is it on purpose that 128 pages "https://wiki.contextgarden.net/Command/ 
" start with a space character ?
I didn't find an explanation in https://wiki.contextgarden.net/Command

For example, these two pages exist :
- https://wiki.contextgarden.net/Command/startbuffer
- https://wiki.contextgarden.net/Command/_startbuffer

If it is on purpose: 
- What is the purpose, and which page should contain which documentation?

If it is not: 
- Is there a way to automatically merge the content of the couple of pages, and 
to remove the "wrong" pages, or should it be done manually ?

Thanks for your help.

List :
Command/ attachment
Command/ background
Command/ bar
Command/ beginblock
Command/ button
Command/ characterkerning
Command/ comment
Command/ completecombinedlist
Command/ completelistoffloats
Command/ completelistofsorts
Command/ completelistofsynonyms
Command/ completeregister
Command/ copylabeltext
Command/ ctxfunction
Command/ ctxfunctiondefinition
Command/ currentlabel
Command/ delimitedtext
Command/ description
Command/ enumeration
Command/ fence
Command/ fraction
Command/ framed
Command/ framedtext
Command/ getbuffer
Command/ hbox
Command/ help
Command/ high
Command/ highlight
Command/ label
Command/ labellanguage
Command/ labeltext
Command/ labeltexts
Command/ language
Command/ leftlabeltext
Command/ linenote
Command/ low
Command/ lowhigh
Command/ lowmidhigh
Command/ margindata
Command/ mathcommand
Command/ mathdoubleextensible
Command/ mathextensible
Command/ mathframed
Command/ mathmatrix
Command/ mathornament
Command/ mathoverextensible
Command/ mathovertextextensible
Command/ mathradical
Command/ mathtriplet
Command/ mathunderextensible
Command/ mathundertextextensible
Command/ mathunstacked
Command/ nextparagraphs
Command/ note
Command/ ornament
Command/ paragraphs
Command/ placecombinedlist
Command/ placefloat
Command/ placelistoffloats
Command/ placelistofsorts
Command/ placelistofsynonyms
Command/ placement
Command/ placepairedbox
Command/ placeregister
Command/ presetlabeltext
Command/ referenceformat
Command/ register
Command/ rightlabeltext
Command/ script
Command/ section
Command/ seeregister
Command/ setupcombinedlist
Command/ setupitemgroup
Command/ setuplabeltext
Command/ setuppairedbox
Command/ setupregister
Command/ shift
Command/ sorting
Command/ startattachment
Command/ startbackground
Command/ startbuffer
Command/ startcolumnset
Command/ startcomment
Command/ startdelimitedtext
Command/ startdescription
Command/ starteffect
Command/ startenumeration
Command/ startfittingpage
Command/ startfloattext
Command/ startformula
Command/ startframedtext
Command/ starthelp
Command/ startindentedtext
Command/ startitemgroup
Command/ startlabeltext
Command/ startlinenote
Command/ startlines
Command/ startmakeup
Command/ startmathalignment
Command/ startmathcases
Command/ startmathmatrix
Command/ startmixedcolumns
Command/ startnarrower
Command/ startnote
Command/ startpagecolumns
Command/ startparagraphs
Command/ startparallel
Command/ startplacefloat
Command/ startplacepairedbox
Command/ startsection
Command/ startsectionblock
Command/ startstartstop
Command/ startstop
Command/ startstyle
Command/ starttabulate
Command/ starttextbackground
Command/ starttyping
Command/ startviewerlayer
Command/ startxtable
Command/ stoplinenote
Command/ style
Command/ synonym
Command/ textbackground
Command/ textnote
Command/ tooltip
Command/ type
Command/ typebuffer
Command/ unit
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] upload

2024-04-01 Thread Hans Hagen

Hi,

There is a new lmtx upload.

-- The svg inclusion via metapost has been upgraded and cleanup a bit, 
using some more recent metapost features. There are some new (not yet 
all documented metapost) features.


-- In the process, support for LCH colors has been added, which is 
documented in the (eg luametafun manual).


-- The math manual is not yet there because we were distracted by 
improving support for envelopes (penbased outlines) in metafun. This is 
still work in progress, some is present and discussed in the manual, and 
we'll come back to that sometime next month. Given the next item, we 
also might need to change some in the manual (different focus).


-- Because we have users who have to conform to the European 
Accessibility Act we have been wondering how to deal with that and at 
Mikaels place there are two demands: distinctive colors and tagging and 
especially math (somehow validators love to check that). Colors never 
were an issue as they can be controlled, and tagging math neither, 
especially because nothing was/is done with it anyway, but ... we are 
happy that we found a reasonable (more modern and future proof) way out.


As explained / shown in the attached document we're basically forced to 
choose a different approach with math (a pity as we worked hard to get 
the rendering right but the attached file works fine in the viewers that 
we tested).


-- We like to hear from users what other demands wrt accessibility there 
are. We're not interested in the (commercial) big money aspects (of pdf 
and tagging) nor in the politics behind it (changes over time). What are 
the demands, so that we can see how to make it work or just work around 
it (as it's kind of boring to cook uyp complex features	, esp compared 
to playing with metapost).


-- Furthermore .. the usual bits and pieces as discussed on the list and 
otherwise.


-- If you have troubles (crash) you need to wipe the cache due to a 
change in lua bytecode storage (no easy way to catch it).


Hans & Mikael

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

math-riddance.pdf
Description: Adobe PDF document
% language=us

% todo: no comma

\usemodule[scite]
\usemodule[article-basic]
\usemodule[abbreviations-logos]
\usemodule[math-goodriddance]

\setuplayout[tight]

\starttext

\subject{Good riddance}

We're done with math. After years of active development, Mikael and Hans have
decided to quit working on math, and concentrate on \METAPOST\ and handing over
to the next generation instead. We lost our user to the way more popular
alternative (frozen in stone standards). Also, we had it with suboptimal math
fonts, Unicode math not getting improved, MathML constantly being changed,
browsers dealing with math differently every few years, math archives getting
polluted with tons of useless tagged math.

There are other motivations, like the European union imposing strict rules with
respect to accessibility in educational content management systems, and Dutch
schools trying to get rid of math in favor of simple calculus, if at all. This 
is
why the next iteration of the engine will no longer have a math engine:
MathLessTeX. Of course, in the beginning \MLTX\ will be compatible with \LMTX,
because we owe that to the users and we need to prototype the new engine anyway.

In order to get an idea of how we will get rid of the disturbing formulas, you
can load the module:

\starttyping
\usemodule[math-goodriddance]
\stoptyping

Until becoming the default setting, the command \typ {\goodriddancemath} will
bring you into \MLTX\ mode while \typ {\badriddancemath} will bring you back to
the obsolete \LMTX\ mode. Like:

\startbuffer
\usemodule[math-goodriddance] \goodriddancemath

Who wants to solve the equation \m {x + 1 = 4} or deal with the function \m {x 
\mapsto
\root [3] {x}}, when we have AI around the corner to help us out with simple 
and silly
things like the Pythagorean theorem: \m {a^2 + b^2 = c^2}, or even with more 
advanced
math like geometric series: \m {\sum_{k = 0}^{+\infty} x^k = 1/(1 - x)}?

We will not support complicated nonsense stuff like:

\startplaceformula
\startformula
F__{1}{2}(a,b;b;z) = (1 - z)^{-a}
\stopformula
\stopplaceformula

When developing this Hans' Swedish improved a lot. {\language[sv] Den lilla del 
av
befolkningen som handlar på IKEA och tittar på fåniga krimserier förstår kanske 
detta:
\im {\sqrt {x + 1} = \sin(4 + y)}!}
\stopbuffer

\typebuffer[option=TEX]

Which gives us the beautifully typeset:

\startcolor[darkblue] \getbuffer \stopcolor

We hope that the highly respected Swedish Academy will consider our prose in
their upcoming evaluations. Our first submission to the leading \TEX\ journal 
was
how

[NTG-context] Re: issue with typing in footnotes

2024-03-17 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 17.03.2024 um 17:38:

Dear list,

I have the following sample (which was on the way of showing another issue):

   \starttext
   a
   \starttyping
   b
   \stoptyping
   c
   \startfootnote
   a
   \starttyping
   b
   \stoptyping
   c
   \stopfootnote
   \stoptext

Current latest (from 2024.03.11 09:34) breaks compilation with both LMTX
and LuaTeX.

As far as I know, this sample should be compiled without any issue.

Could you be so kind to confirm the issue or explain me what am I missing?


The footnote environment is just a fancy way for a command with a 
argument and buffers don't like being part of arguments.


You can put the code in buffer outside of the footnote and type the 
content of the buffer in the footnote.


 begin example
\starttext

\def\startfoo#1\stopfoo{#1}

% \startfoo
% xxx
% \starttyping
% yyy
% \stoptyping
% zzz
% \stopfoo

\startbuffer
yyy
\stopbuffer

\startfoo
xxx
\typebuffer
zzz
\stopfoo

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: How to input first n lines from file?

2023-12-16 Thread Henning Hraban Ramm

Am 16.12.23 um 22:30 schrieb Joel via ntg-context:
With the command `\input file`, I can input the entire contents of 
`file.tex`. Is there a way to limit it to the first n lines, for 
instance, something like `\input[10]` file would only input the first 10 
lines from `file.tex` and ignore the rest of the lines.


With \typebuffer you can define a "range", see 
https://wiki.contextgarden.net/Command/typebuffer


But I guess you should write a Lua function that suits your use case.

Hraban

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Toggling the symbol for the zero-width joiner and related Unicode control characters

2023-09-22 Thread Hamid,Idris


-- Original Message --
From "Hans Hagen via ntg-context" 
mailto:ntg-context@ntg.nl>>
To "ntg-context@ntg.nl<mailto:ntg-context@ntg.nl>" 
mailto:ntg-context@ntg.nl>>
Cc "Hans Hagen" mailto:j.ha...@freedom.nl>>
Date 9/22/2023 3:53:03 AM
Subject [NTG-context] Re: Toggling the symbol for the zero-width joiner and 
related Unicode control characters
1. Can this approach be generalized to get what we want, viz., a way to toggle 
the symbols?

given the inconsistency in what is or is not in a font the only way out
is to have our own visualization (consistent across fonts) and even then
it would add some mess because we're talking of a mix of characters that
can have gone (as part of rendering) or are not characters at all but
spacing

so, in that case only 'verbatim' is a candidate for visualization, not
so much typeset text

Hm, ok. Since almfixed is based on Knuth's mono, perhaps its visuals of the 
control characters can be extracted and used as fallback symbols.

Yes: For typeset text/printing visualization is generally unnecessary (the 
point of this thread).

2. \enabletrackers[typesetters.nbsp] gives a colored box, which is at least 
something.. But how can we get the NBSP symbol that's alerady in the font?

it's gone by that time ... the line break mmechanism uses glue, not
characters

Ok

3. Ideally:
a. we want all Unicode control symbols to show up in verbatim or in \typebuffer 
(as in a text editor);

only there (with some non interfering rendering i guess) and even then
it's probably an additonal pass over the node list

Ok, that would be good.

b. we want all Unicode control symbols to be suppressed in final pdf output 
(for, e.g., printing).

they basically are unless some font features keeps them around which is
out of our control

If the symbols are in the font, then they are not suppressed. See below.

But some fonts meant for printing have symbols for Unicode control chars -- 
that poses a challenge.

so an inconsistent mess not worth wasting time on (as this is hobbyism
only fun can be a motivational factir)

But there is a certain consistency -- see below.

And some fonts meant for verbatim/editing do not have symbols for the control 
chars -- that also poses a challenge. AlmFixed, of course, has them.

Most minimally decent Arabic fonts have symbols for the Unicode control chars 
as default, including Scheherazade, Amiri, Uthmanic, and Noto Naskh Arabic -- 
all free fonts.

Industry workhorses like Linotype Lotus (Arabic) also have them.

i'm not interested in those .. can't afford them for playing around
purposes .. we only look into commercial fonts if we get a dozen
unresticted copies for context developers

Except for Linotype Lotus, each of the Arabic-script fonts mentioned above is 
free, not commercial -)

(There is also a free version of Lotus -- it also has the symbolic rendering of 
the contol chars.)

Uniscribe applications like Notepad/Word allow for toggling in a WYSIWYG 
context -- can't speak for HarfBuzz -- so there is no harm in having explicit 
symbols in the font.

sure, as long as there is no rendering ... they show the input

But therein lies the problem: ConTeXt shows the rendering by default, and we 
need to turn it off. Since most non-Latin typography targets Uniscribe 
applications which allows for toggling, the font developers (commercial or 
free) don't have to concern themselves with this issue.

Yet another curse of the WYSIWYG paradigm, which mixes form and content -)

The upshot is that, for non-Latin scripts, some toggling capability in ConTeXt 
is important to have -- even inescapable for Arabic-script piblishing.

a bit subjectiev arguing -)

Not really -) This brings us to the point of consistency: For Arabic-script 
fonts, hard symbolic rendering of the Unicode control characters is the rule, 
not the exception. So not "an inconsistent mess" -- at least not as far as 
Arabic-script typography is concerned.

(Yes, for the upcoming Husayni I can add a font feature that does the trick, 
but that will be an exception to the rule.)

Perhaps others who use Arabic-script or Indic, etc., can chime in.. Am hopeful 
that we can figure something out!
sore, but not with 'instant priority' (unless it is some project)

My immediate project (no Husayni) is a book that features English translation 
of an Arabic text (hence the interest in the recent streams thread). Using some 
Unicode control characters will be unavoidable to get the rendering effects 
correct, but the symbols will need to be suppressed.

Am thinking/hoping that a ConTeXt-specific font feature can do the trick. Since 
there appears to be consistency across Arabic fonts in this matter it should 
not be messy at all, simply a fallback that sends the symbols to some no-man's 
land.

(A thought: Some of the code you kindly provided for transliteration might be 
reusable as well.. But a general solution for all ConTeXt users woul

[NTG-context] Re: Toggling the symbol for the zero-width joiner and related Unicode control characters

2023-09-22 Thread Hans Hagen via ntg-context

On 9/22/2023 6:16 AM, Hamid,Idris wrote:



-- Original Message --
 From "Hans Hagen" mailto:j.ha...@xs4all.nl>>
To "Hamid,Idris" mailto:idris.ha...@colostate.edu>>; "mailing list 
for ConTeXt users" mailto:ntg-context@ntg.nl>>
Date 9/21/2023 3:29:22 PM
Subject Re: [NTG-context] Re: Toggling the symbol for the zero-width joiner and 
related Unicode control characters
   Many thanks, Hans. The method appears to work only for nbsp, not zwj etc. 
Here is the updated MWE:

===
\startTEXpage[offset=1em]
\disabletrackers[typesetters.directions]
\disabletrackers[typesetters.zwj]
\disabletrackers[typesetters.zwnj]
\disabletrackers[typesetters.nbsp]
\definedfont[almfixed at 14pt]
ZWJ: ‌
ZWNJ: ‍
NBSP:
\stopTEXpage
===

See attached, please advise.
joiners are part of replacement etc and can come and go ... they are
characters (we could visualize them but one never knows for sure if one
sees them)

nbsp are spaces and become glue that we can trace reliable in the node list

Many thanks. Ok, here is another MWE featuring a workaround using fallbacks:

==
\definefontfallback[nosymbols] [file:lmmono10-regular] [200C,200D] [force=yes]
\starttypescript [serif] [alm] [name]
 \definefontsynonym [Serif] [ArabicLatinSerif]
\stoptypescript
\starttypescript [mono] [alm] [name]
 \definefontsynonym [Mono]  [ArabicLatinMono]
\stoptypescript
\starttypescript [serif] [alm]
 \definefontsynonym [ArabicLatinSerif] [file:almfixed] % 
[fallbacks=nosymbols]
\stoptypescript
\starttypescript [mono] [alm]
 \definefontsynonym [ArabicLatinMono] [file:almfixed] [fallbacks=nosymbols]
\stoptypescript
\starttypescript [almfixed-nosymbols]
\definetypeface [\typescriptone] [rm] [serif] [alm] [default]
\definetypeface [\typescriptone] [tt] [mono] [alm] [default]
\stoptypescript
\usetypescript[almfixed-nosymbols]
\setupbodyfont[almfixed-nosymbols,12pt]
\startTEXpage[offset=1em]
\rm
ZWJ: ‌
ZWNJ: ‍
NBSP:
\tt
ZWJ: ‌
ZWNJ: ‍
NBSP:
\stopTEXpage
==

Under \rm we get the symbols, and under \tt they are suppressed. Of course it 
doesn't matter what fallback font one uses, as long as it has no 
control-character symbols.

1. Can this approach be generalized to get what we want, viz., a way to toggle 
the symbols?


given the inconsistency in what is or is not in a font the only way out 
is to have our own visualization (consistent across fonts) and even then 
it would add some mess because we're talking of a mix of characters that 
can have gone (as part of rendering) or are not characters at all but 
spacing


so, in that case only 'verbatim' is a candidate for visualization, not 
so much typeset text



2. \enabletrackers[typesetters.nbsp] gives a colored box, which is at least 
something.. But how can we get the NBSP symbol that's alerady in the font?


it's gone by that time ... the line break mmechanism uses glue, not 
characters



3. Ideally:
a. we want all Unicode control symbols to show up in verbatim or in \typebuffer 
(as in a text editor);


only there (with some non interfering rendering i guess) and even then 
it's probably an additonal pass over the node list



b. we want all Unicode control symbols to be suppressed in final pdf output 
(for, e.g., printing).


they basically are unless some font features keeps them around which is 
out of our control



But some fonts meant for printing have symbols for Unicode control chars -- 
that poses a challenge.


so an inconsistent mess not worth wasting time on (as this is hobbyism 
only fun can be a motivational factir)



And some fonts meant for verbatim/editing do not have symbols for the control 
chars -- that also poses a challenge.  AlmFixed, of course, has them.

Most minimally decent Arabic fonts have symbols for the Unicode control chars 
as default, including Scheherazade, Amiri, Uthmanic, and Noto Naskh Arabic -- 
all free fonts.

Industry workhorses like Linotype Lotus (Arabic) also have them.


i'm not interested in those .. can't afford them for playing around
purposes .. we only look into commercial fonts if we get a dozen 
unresticted copies for context developers



Uniscribe applications like Notepad/Word allow for toggling in a WYSIWYG 
context -- can't speak for HarfBuzz -- so there is no harm in having explicit 
symbols in the font.


sure, as long as there is no rendering ... they show the input


The upshot is that, for non-Latin scripts, some toggling capability in ConTeXt 
is important to have -- even inescapable for Arabic-script piblishing.


a bit subjectiev arguing -)


Perhaps others who use Arabic-script or Indic, etc., can chime in.. Am hopeful 
that we can figure something out!

sore, but not with 'instant priority' (unless it is some project)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 4

[NTG-context] Re: Toggling the symbol for the zero-width joiner and related Unicode control characters

2023-09-21 Thread Hamid,Idris


-- Original Message --
From "Hans Hagen" mailto:j.ha...@xs4all.nl>>
To "Hamid,Idris" mailto:idris.ha...@colostate.edu>>; 
"mailing list for ConTeXt users" mailto:ntg-context@ntg.nl>>
Date 9/21/2023 3:29:22 PM
Subject Re: [NTG-context] Re: Toggling the symbol for the zero-width joiner and 
related Unicode control characters
  Many thanks, Hans. The method appears to work only for nbsp, not zwj etc. 
Here is the updated MWE:

===
\startTEXpage[offset=1em]
\disabletrackers[typesetters.directions]
\disabletrackers[typesetters.zwj]
\disabletrackers[typesetters.zwnj]
\disabletrackers[typesetters.nbsp]
\definedfont[almfixed at 14pt]
ZWJ: ‌
ZWNJ: ‍
NBSP:
\stopTEXpage
===

See attached, please advise.
joiners are part of replacement etc and can come and go ... they are
characters (we could visualize them but one never knows for sure if one
sees them)

nbsp are spaces and become glue that we can trace reliable in the node list

Many thanks. Ok, here is another MWE featuring a workaround using fallbacks:

==
\definefontfallback[nosymbols] [file:lmmono10-regular] [200C,200D] [force=yes]
\starttypescript [serif] [alm] [name]
\definefontsynonym [Serif] [ArabicLatinSerif]
\stoptypescript
\starttypescript [mono] [alm] [name]
\definefontsynonym [Mono]  [ArabicLatinMono]
\stoptypescript
\starttypescript [serif] [alm]
\definefontsynonym [ArabicLatinSerif] [file:almfixed] % 
[fallbacks=nosymbols]
\stoptypescript
\starttypescript [mono] [alm]
\definefontsynonym [ArabicLatinMono] [file:almfixed] [fallbacks=nosymbols]
\stoptypescript
\starttypescript [almfixed-nosymbols]
\definetypeface [\typescriptone] [rm] [serif] [alm] [default]
\definetypeface [\typescriptone] [tt] [mono] [alm] [default]
\stoptypescript
\usetypescript[almfixed-nosymbols]
\setupbodyfont[almfixed-nosymbols,12pt]
\startTEXpage[offset=1em]
\rm
ZWJ: ‌
ZWNJ: ‍
NBSP:
\tt
ZWJ: ‌
ZWNJ: ‍
NBSP:
\stopTEXpage
==

Under \rm we get the symbols, and under \tt they are suppressed. Of course it 
doesn't matter what fallback font one uses, as long as it has no 
control-character symbols.

1. Can this approach be generalized to get what we want, viz., a way to toggle 
the symbols?

2. \enabletrackers[typesetters.nbsp] gives a colored box, which is at least 
something.. But how can we get the NBSP symbol that's alerady in the font?

3. Ideally:
a. we want all Unicode control symbols to show up in verbatim or in \typebuffer 
(as in a text editor);
b. we want all Unicode control symbols to be suppressed in final pdf output 
(for, e.g., printing).

But some fonts meant for printing have symbols for Unicode control chars -- 
that poses a challenge.

And some fonts meant for verbatim/editing do not have symbols for the control 
chars -- that also poses a challenge.  AlmFixed, of course, has them.

Most minimally decent Arabic fonts have symbols for the Unicode control chars 
as default, including Scheherazade, Amiri, Uthmanic, and Noto Naskh Arabic -- 
all free fonts.

Industry workhorses like Linotype Lotus (Arabic) also have them.

Uniscribe applications like Notepad/Word allow for toggling in a WYSIWYG 
context -- can't speak for HarfBuzz -- so there is no harm in having explicit 
symbols in the font.

The upshot is that, for non-Latin scripts, some toggling capability in ConTeXt 
is important to have -- even inescapable for Arabic-script piblishing.

Perhaps others who use Arabic-script or Indic, etc., can chime in.. Am hopeful 
that we can figure something out!

Best wishes
Idris
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
___
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: empty line before typebuffer

2023-07-31 Thread Henning Hraban Ramm

Am 31.07.23 um 17:25 schrieb Pablo Rodriguez:

On 7/30/23 21:50, Henning Hraban Ramm wrote:

Am 30.07.23 um 21:22 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 30.07.2023 um 21:14:

Yet another issue:

\typebuffer always starts with a blank line.
Is this a bug, or how can I disable it?


Sorry for being too late, Hraban.

\typeinlinebuffer is probably the best option here.


Thank you, but no. I needed it for code examples in a frame.

strut=no did the trick.

Hraban
___
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: empty line before typebuffer

2023-07-31 Thread Pablo Rodriguez
On 7/30/23 21:50, Henning Hraban Ramm wrote:
> Am 30.07.23 um 21:22 schrieb Wolfgang Schuster:
>> Henning Hraban Ramm schrieb am 30.07.2023 um 21:14:
>>> Yet another issue:
>>>
>>> \typebuffer always starts with a blank line.
>>> Is this a bug, or how can I disable it?

Sorry for being too late, Hraban.

\typeinlinebuffer is probably the best option here.

Pablo

___
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: empty line before typebuffer

2023-07-30 Thread Henning Hraban Ramm

Am 30.07.23 um 21:22 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 30.07.2023 um 21:14:

Yet another issue:

\typebuffer always starts with a blank line.
Is this a bug, or how can I disable it?

Hraban

MWE:
"""
\starttext

\startbuffer
\samplefile{tufte}
\stopbuffer

\framedtext{\typebuffer[option=tex]}

\stoptext
"""


\framedtext[strut=no]{\typebuffer[option=tex]}

or

\startframedtext
\typebuffer[option=tex]
\stopframedtext


Thank you (also Jacob)!
Seems like I didn’t look in the right place.

Hraban


___
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: empty line before typebuffer

2023-07-30 Thread Jacob Kauffmann via ntg-context
It comes from framedtext:

\starttext

\startbuffer
\samplefile{tufte}
\stopbuffer

\framedtext[strut=no]{\typebuffer[option=tex]}

\stoptext

Best,
Jacob

> Am 30.07.2023 um 21:14 schrieb Henning Hraban Ramm :
> 
> Yet another issue:
> 
> \typebuffer always starts with a blank line.
> Is this a bug, or how can I disable it?
> 
> Hraban
> 
> MWE:
> """
> \starttext
> 
> \startbuffer
> \samplefile{tufte}
> \stopbuffer
> 
> \framedtext{\typebuffer[option=tex]}
> 
> \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
> ___



signature.asc
Description: Message signed with OpenPGP
___
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: empty line before typebuffer

2023-07-30 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 30.07.2023 um 21:14:

Yet another issue:

\typebuffer always starts with a blank line.
Is this a bug, or how can I disable it?

Hraban

MWE:
"""
\starttext

\startbuffer
\samplefile{tufte}
\stopbuffer

\framedtext{\typebuffer[option=tex]}

\stoptext
"""


\framedtext[strut=no]{\typebuffer[option=tex]}

or

\startframedtext
\typebuffer[option=tex]
\stopframedtext

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] empty line before typebuffer

2023-07-30 Thread Henning Hraban Ramm

Yet another issue:

\typebuffer always starts with a blank line.
Is this a bug, or how can I disable it?

Hraban

MWE:
"""
\starttext

\startbuffer
\samplefile{tufte}
\stopbuffer

\framedtext{\typebuffer[option=tex]}

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


Re: [NTG-context] How to extend an existing macro to take optional parameters?

2023-03-14 Thread Bruce Horrocks via ntg-context


> On 13 Mar 2023, at 21:39, Hans Hagen via ntg-context  
> wrote:
> 
> On 3/12/2023 2:24 PM, Bruce Horrocks via ntg-context wrote:
>> I have an existing macro that I'd like to extend.
>> The current definition is \define[3]\mycommand{...} which I'd like to extend 
>> to take an optional 4th parameter plus an optional setup parameter.
>> Thus I currently invoke it as:
>>   \mycommand{aa}{bb}{cc}
>> and I'd like to be able to extend it so that any of the following can be 
>> used:
>>   \mycommand{aa}{bb}{cc}
>>   \mycommand{aa}{bb}{cc}{dd}
>>   \mycommand{aa}{bb}{cc}{dd}[ee]
>> or
>>   \mycommand[ee]{aa}{bb}{cc}{dd}  % if this is more the ConTeXt way
>> where {dd} is the optional extra parameter and, if it is present, then [ee] 
>> can also be optionally added (because it controls how {dd} is printed).
>> If it helps, the actual body of the macro can easily be a call to Lua so 
>> it's fine if the function takes 5 params where 4 and 5 can be nil or empty 
>> strings.
>> I've trawled through syst-aux.mkiv but it only covers optional numbers of [ 
>> ] or { } but not combinations of both (which given the vast numbers of 
>> combinations is perhaps not surprising!). Have I missed something obvious 
>> that would help me?
> So, four optional with mandate {} plus a fallback to an optional []
> 
> \starttext
> 
> \tolerant\def\mycommand#=#=#=#=#:[#5]%
>  {\ifparameter#1\or(1:#1)\fi
>   \ifparameter#2\or(2:#2)\fi
>   \ifparameter#3\or(3:#3)\fi
>   \ifparameter#4\or(4:#4)\fi
>   \ifparameter#5\or[5:#5]\fi}
> 
> \startbuffer
> \mycommand{aa}{bb}{cc}
>  \mycommand{aa}{bb}{cc}{dd}
>  \mycommand{aa}{bb}{cc}{dd}[ee]
> \mycommand{aa}{bb}{cc}
>  \mycommand{aa}{bb}{cc}{dd}
>  \mycommand{aa}{bb}{cc}{dd}[ee]
> \stopbuffer
> 
> \typebuffer
> 
> \startlines \getbuffer \stoplines
> 
> \stoptext
> 
> I'm not saying that it's the best solution, you can add \protected in front 
> of the \def if needed.
> 
> Hans

Thanks Hans,

This works well. I'll try and add something to the Wiki but I don't understand 
how #: does what it does.

Regards,
—
Bruce Horrocks
Hampshire, UK

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


Re: [NTG-context] How to extend an existing macro to take optional parameters?

2023-03-13 Thread Hans Hagen via ntg-context

On 3/12/2023 2:24 PM, Bruce Horrocks via ntg-context wrote:

I have an existing macro that I'd like to extend.

The current definition is \define[3]\mycommand{...} which I'd like to extend to 
take an optional 4th parameter plus an optional setup parameter.

Thus I currently invoke it as:

   \mycommand{aa}{bb}{cc}

and I'd like to be able to extend it so that any of the following can be used:

   \mycommand{aa}{bb}{cc}
   \mycommand{aa}{bb}{cc}{dd}
   \mycommand{aa}{bb}{cc}{dd}[ee]

or

   \mycommand[ee]{aa}{bb}{cc}{dd}  % if this is more the ConTeXt way

where {dd} is the optional extra parameter and, if it is present, then [ee] can 
also be optionally added (because it controls how {dd} is printed).

If it helps, the actual body of the macro can easily be a call to Lua so it's 
fine if the function takes 5 params where 4 and 5 can be nil or empty strings.

I've trawled through syst-aux.mkiv but it only covers optional numbers of [ ] 
or { } but not combinations of both (which given the vast numbers of 
combinations is perhaps not surprising!). Have I missed something obvious that 
would help me?

So, four optional with mandate {} plus a fallback to an optional []

\starttext

\tolerant\def\mycommand#=#=#=#=#:[#5]%
  {\ifparameter#1\or(1:#1)\fi
   \ifparameter#2\or(2:#2)\fi
   \ifparameter#3\or(3:#3)\fi
   \ifparameter#4\or(4:#4)\fi
   \ifparameter#5\or[5:#5]\fi}

\startbuffer
\mycommand{aa}{bb}{cc}
  \mycommand{aa}{bb}{cc}{dd}
  \mycommand{aa}{bb}{cc}{dd}[ee]
\mycommand{aa}{bb}{cc}
  \mycommand{aa}{bb}{cc}{dd}
  \mycommand{aa}{bb}{cc}{dd}[ee]
\stopbuffer

\typebuffer

\startlines \getbuffer \stoplines

\stoptext

I'm not saying that it's the best solution, you can add \protected in 
front of the \def if needed.


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


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Kalouguine Andre via ntg-context
Hi Pablo,

> \showframe
> \setupinteraction[state=start]
> \starttext
> \startbuffer[abc]
> def foo(x):
> if x == 0:
> bar()
> else:
> baz(x)
> foo(x - 1)
> \stopbuffer
> \comment[location=leftmargin,
> space=yes,
> buffer=abc,
> title={Python code}]
> {}\typebuffer[abc]
> \stoptext
> 
> This might solve what you need. At least, this is the approach that I
> use to provide text that can be directly copied.
> 
> I'm on Linux and last time I tested on Windows there were extra lines in
> the comments.

That's actually something I had never thought of, using PDF comments,
thanks!. 
It's a really nice approach, though weirdly it doesn't work on Okular
(Linux+KDE) 
for me, even though attachments worked fine. I'll try and see why that
is. 

What I had in mind was rather the following: 

\starttext 
\starttyping[space=on] 
def foo(x):
y = bar(x) 
if y: 
return x 
return y 
foo(1) 
\stoptyping 
\stoptext

but with ordinary char32 spaces rather than \textcontrolspace
characters. 

Best regards,___
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
___


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-28 Thread Pablo Rodriguez via ntg-context
On 1/28/23 03:01, Kalouguine Andre via ntg-context wrote:
> Good day to everyone,
> 
> I'm trying to make a verbatim block of text with copiable leading spaces
> so that students can just copy my Python code snippets into their IDE.

Hi André,

I wonder whether I’m getting your point with the following sample:

  \showframe
  \setupinteraction[state=start]
  \starttext
  \startbuffer[abc]
  def foo(x):
  if x == 0:
  bar()
  else:
  baz(x)
  foo(x - 1)
  \stopbuffer
  \comment[location=leftmargin,
space=yes,
buffer=abc,
title={Python code}]
{}\typebuffer[abc]
  \stoptext

This might solve what you need. At least, this is the approach that I
use to provide text that can be directly copied.

I’m on Linux and last time I tested on Windows there were extra lines in
the comments.

Just in case it might help,

Pablo
___
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] Spacing issue with \digits in math mode

2022-10-04 Thread Gavin via ntg-context
Hi list,

I have been trying to understand the workings of the \unit command, which is 
producing strange spacing in math mode. In an effort to be more systematic, I 
began by investigating the related \digit command. \digit works well in text, 
but in math mode the comma separators produce unwanted space.

\digits {12,345.67} vs.\ $\digits {12,345.67}$

Below is a one page test document, derived from the code in phys-dim.mkxl.

I think a simple fix would be to treat the comma as “ord” inside a number, but 
I don’t know if that is easy or not. I’d also like the space removed from 
around the “x" in scientific notation, which might be accomplished the same way.

Thanks for all the work on spacing in math!

Gavin


\setuppapersize[A4]

\showmakeup[mathglue] %\mathspacingmode=1

\starttext

Digits in math mode have problems with comma separators.

\startbuffer
10 \setdigitmode {1} \setdigitorder{0} $\digits {12,345.67e89}$
20 \setdigitmode {2} \setdigitorder{0} $\digits {12,345.67e89}$
30 \setdigitmode {3} \setdigitorder{0} $\digits {12,345.67e89}$
40 \setdigitmode {4} \setdigitorder{0} $\digits {12,345.67e89}$
50 \setdigitmode {5} \setdigitorder{0} $\digits {12,345.67e89}$
60 \setdigitmode {6} \setdigitorder{0} $\digits {12,345.67e89}$
11 \setdigitmode {1} \setdigitorder{1} $\digits {12,345.67e89}$
21 \setdigitmode {2} \setdigitorder{1} $\digits {12,345.67e89}$
31 \setdigitmode {3} \setdigitorder{1} $\digits {12,345.67e89}$
41 \setdigitmode {4} \setdigitorder{1} $\digits {12,345.67e89}$
51 \setdigitmode {5} \setdigitorder{1} $\digits {12,345.67e89}$
61 \setdigitmode {6} \setdigitorder{1} $\digits {12,345.67e89}$
\stopbuffer

\typebuffer

This is typeset as:

\startlines \getbuffer \stoplines

In text, the \type{\digits} command works fine:
\setdigitmode {2}\setdigitorder{0}\digits{12,345.67e89}.
\blank

Suggestion: Within \type{\digits} (and probably \type{\units}) the comma could 
be an \quotation{ord} rather than a \quotation{pun}. This appears to be how the 
period is handled.
\blank

I personally think the space around the \quotation{$\times$} is excessive, 
especially when the number is in a formula.
\startformula
 \digits {12,345.67e89} + \digits {12,345.67e89}
\stopformula
I would like the \quotation{$\times$} to also be an \quotation{ord} when used 
for scientific notation.

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


Re: [NTG-context] font fallbacks

2022-08-01 Thread Denis Maier via ntg-context
Hi,
I have used more than one fallback, but each fallback is for a different 
character range
Denis

Von: ntg-context  im Auftrag von Henning Hraban 
Ramm via ntg-context 
Gesendet: Montag, 1. August 2022 19:42:51
An: Henning Hraban Ramm via ntg-context
Cc: Henning Hraban Ramm
Betreff: Re: [NTG-context] font fallbacks

Nobody?
I couldn’t find an example of more than one fallback, so I guess that’s
not supported?

Hraban

Am 30.07.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context:
> Hi,
> I thought I could use more than one fallback font, but as soon as I list
> fallbacks, they stop working.
>
> In my example, I’d like to take all missing glyphs from Segoe UI
> Symbols, and what’s still missing (emojis) from EmojiOneColor,
> preferably without specifying the exact range.
>
> Additionally, I want to replace the tilde ~ of LM Modern:
>
> """
> \definefontfallback[seguiFB]
>[file:seguisym.ttf]
>[0x0-0xF]
>[check=yes,force=no]
>
> \definefontfallback[emoneFB]
>[name:EmojiOneColor]
>[0x0-0xF]
>[check=yes,force=no]
>
> % replace tilde in LM
> \definefontfallback[tildeFB]
>[file:seguisym.ttf]
>[0x0007E-0x0007E]
>[force=yes]
>
>
> \starttypescript [start]
>\definetypeface [start] [rm] [serif] [cambria]
> [default][fallbacks={seguiFB,emoneFB}]
>\definetypeface [start] [ss] [sans]  [modern]
> [default][fallbacks={seguiFB,emoneFB}]
>\definetypeface [start] [tt] [mono]  [modern]
> [default][fallbacks={seguiFB,tildeFB,emoneFB}]
>\definetypeface [start] [mm] [math]  [modern]
> [default][fallbacks={seguiFB,emoneFB}]
> \stoptypescript
>
>
> \setupbodyfont[start,rm,12pt]
>
> \starttext
>
> \Omega\ (Omega) and \aleph\ (Aleph)
>
> \startbuffer[example]
> start missing characters: lmmono10-regular.otf
> 7  U+00327  ̧  COMBINING CEDILLA
> 7  U+00335  ̵  COMBINING SHORT STROKE OVERLAY
>14  U+003B7  η  GREEK SMALL LETTER ETA
> 7  U+021A9  ↩  LEFTWARDS ARROW WITH HOOK
>   350  U+02500  ─  BOX DRAWINGS LIGHT HORIZONTAL
>98  U+02502  │  BOX DRAWINGS LIGHT VERTICAL
>42  U+02514  └  BOX DRAWINGS LIGHT UP AND RIGHT
>   133  U+0251C  ├  BOX DRAWINGS LIGHT VERTICAL AND RIGHT
>   154  U+02772  ❲  LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT
>   154  U+02773  ❳  LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT
>14  U+0278A  ➊  DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE
> stop missing characters
> start missing characters: cambria.ttc
> 9  U+0278A  ➊  DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE
> 9  U+0FFFD  �  REPLACEMENT CHARACTER
> stop missing characters
> start missing characters: cambriai.ttf
>   266  U+0276C  ❬  MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
>   266  U+0276D  ❭  MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
> stop missing characters
> \stopbuffer
>
> \typebuffer[example]
>
> \startlines
> \getbuffer[example]
>
> {\ss\getbuffer[example]}
> \stoplines
>
> \tex{abra}\arg{...}
> \type{kadabra} \type{~~~}
>
> \stoptext
> """
>
> What’s wrong?
>
> Hraban
> ___
> 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
___
___
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
___


Re: [NTG-context] font fallbacks

2022-08-01 Thread Henning Hraban Ramm via ntg-context

Nobody?
I couldn’t find an example of more than one fallback, so I guess that’s 
not supported?


Hraban

Am 30.07.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context:

Hi,
I thought I could use more than one fallback font, but as soon as I list 
fallbacks, they stop working.


In my example, I’d like to take all missing glyphs from Segoe UI 
Symbols, and what’s still missing (emojis) from EmojiOneColor, 
preferably without specifying the exact range.


Additionally, I want to replace the tilde ~ of LM Modern:

"""
\definefontfallback[seguiFB]
   [file:seguisym.ttf]
   [0x0-0xF]
   [check=yes,force=no]

\definefontfallback[emoneFB]
   [name:EmojiOneColor]
   [0x0-0xF]
   [check=yes,force=no]

% replace tilde in LM
\definefontfallback[tildeFB]
   [file:seguisym.ttf]
   [0x0007E-0x0007E]
   [force=yes]


\starttypescript [start]
   \definetypeface [start] [rm] [serif] [cambria] 
[default][fallbacks={seguiFB,emoneFB}]
   \definetypeface [start] [ss] [sans]  [modern] 
[default][fallbacks={seguiFB,emoneFB}]
   \definetypeface [start] [tt] [mono]  [modern] 
[default][fallbacks={seguiFB,tildeFB,emoneFB}]
   \definetypeface [start] [mm] [math]  [modern] 
[default][fallbacks={seguiFB,emoneFB}]

\stoptypescript


\setupbodyfont[start,rm,12pt]

\starttext

\Omega\ (Omega) and \aleph\ (Aleph)

\startbuffer[example]
start missing characters: lmmono10-regular.otf
    7  U+00327  ̧  COMBINING CEDILLA
    7  U+00335  ̵  COMBINING SHORT STROKE OVERLAY
   14  U+003B7  η  GREEK SMALL LETTER ETA
    7  U+021A9  ↩  LEFTWARDS ARROW WITH HOOK
  350  U+02500  ─  BOX DRAWINGS LIGHT HORIZONTAL
   98  U+02502  │  BOX DRAWINGS LIGHT VERTICAL
   42  U+02514  └  BOX DRAWINGS LIGHT UP AND RIGHT
  133  U+0251C  ├  BOX DRAWINGS LIGHT VERTICAL AND RIGHT
  154  U+02772  ❲  LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT
  154  U+02773  ❳  LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT
   14  U+0278A  ➊  DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE
stop missing characters
start missing characters: cambria.ttc
    9  U+0278A  ➊  DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE
    9  U+0FFFD  �  REPLACEMENT CHARACTER
stop missing characters
start missing characters: cambriai.ttf
  266  U+0276C  ❬  MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
  266  U+0276D  ❭  MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
stop missing characters
\stopbuffer

\typebuffer[example]

\startlines
\getbuffer[example]

{\ss\getbuffer[example]}
\stoplines

\tex{abra}\arg{...}
\type{kadabra} \type{~~~}

\stoptext
"""

What’s wrong?

Hraban
___
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] font fallbacks

2022-07-30 Thread Henning Hraban Ramm via ntg-context

Hi,
I thought I could use more than one fallback font, but as soon as I list 
fallbacks, they stop working.


In my example, I’d like to take all missing glyphs from Segoe UI 
Symbols, and what’s still missing (emojis) from EmojiOneColor, 
preferably without specifying the exact range.


Additionally, I want to replace the tilde ~ of LM Modern:

"""
\definefontfallback[seguiFB]
  [file:seguisym.ttf]
  [0x0-0xF]
  [check=yes,force=no]

\definefontfallback[emoneFB]
  [name:EmojiOneColor]
  [0x0-0xF]
  [check=yes,force=no]

% replace tilde in LM
\definefontfallback[tildeFB]
  [file:seguisym.ttf]
  [0x0007E-0x0007E]
  [force=yes]


\starttypescript [start]
  \definetypeface [start] [rm] [serif] [cambria] 
[default][fallbacks={seguiFB,emoneFB}]
  \definetypeface [start] [ss] [sans]  [modern] 
[default][fallbacks={seguiFB,emoneFB}]
  \definetypeface [start] [tt] [mono]  [modern] 
[default][fallbacks={seguiFB,tildeFB,emoneFB}]
  \definetypeface [start] [mm] [math]  [modern] 
[default][fallbacks={seguiFB,emoneFB}]

\stoptypescript


\setupbodyfont[start,rm,12pt]

\starttext

\Omega\ (Omega) and \aleph\ (Aleph)

\startbuffer[example]
start missing characters: lmmono10-regular.otf
   7  U+00327  ̧  COMBINING CEDILLA
   7  U+00335  ̵  COMBINING SHORT STROKE OVERLAY
  14  U+003B7  η  GREEK SMALL LETTER ETA
   7  U+021A9  ↩  LEFTWARDS ARROW WITH HOOK
 350  U+02500  ─  BOX DRAWINGS LIGHT HORIZONTAL
  98  U+02502  │  BOX DRAWINGS LIGHT VERTICAL
  42  U+02514  └  BOX DRAWINGS LIGHT UP AND RIGHT
 133  U+0251C  ├  BOX DRAWINGS LIGHT VERTICAL AND RIGHT
 154  U+02772  ❲  LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT
 154  U+02773  ❳  LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT
  14  U+0278A  ➊  DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE
stop missing characters
start missing characters: cambria.ttc
   9  U+0278A  ➊  DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE
   9  U+0FFFD  �  REPLACEMENT CHARACTER
stop missing characters
start missing characters: cambriai.ttf
 266  U+0276C  ❬  MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
 266  U+0276D  ❭  MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
stop missing characters
\stopbuffer

\typebuffer[example]

\startlines
\getbuffer[example]

{\ss\getbuffer[example]}
\stoplines

\tex{abra}\arg{...}
\type{kadabra} \type{~~~}

\stoptext
"""

What’s wrong?

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


Re: [NTG-context] Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2022-07-27 Thread Hans Hagen via ntg-context

On 7/27/2022 7:03 AM, Aditya Mahajan via ntg-context wrote:


Very nice presentation! Lots of new features to play with.
latest upload has eperimental x scaling (as we have with text \tx \txx 
whuch can come in handy when one needs to squeeze some math into some place


\usemodule[article-basic]
\setupbodyfont[11pt]
\setuplayout[tight]

\starttext

\startbuffer

\protected\def\TinyMath{\setmscale {800}}  % {\setmscale{0.8}}
\protected\def\PettyMath   {\setmscale {700}}  % {\setmscale{0,7}}
\protected\def\PatheticMath{\setmscale {400}}  % {\setmscale{0,4}}
\protected\def\ExtremeMath {\setmscale{1500}}  % {\setmscale{1.5}}

\startformula   a=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula \mx   a=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula \mxx  a=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula \TinyMath a=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula \PettyMatha=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula \PatheticMath a=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula \ExtremeMath  a=b^2 + \sqrt[3]{\frac{1}{x}} \stopformula
\startformula
{\TinyMath a=b^2 + \sqrt[3]{\frac{1}{x}}} \quad + \quad
{\PettyMatha=b^2 + \sqrt[3]{\frac{1}{x}}} \quad + \quad
{\PatheticMath a=b^2 + \sqrt[3]{\frac{1}{x}}}
\stopformula
\stopbuffer

\input tufte

\getbuffer

\input tufte

\typebuffer

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


Re: [NTG-context] Failing \doifemptyelse

2022-06-23 Thread Wolfgang Schuster via ntg-context

Willi Egger via ntg-context schrieb am 23.06.2022 um 21:16:

Good evening gurus!

Why is the minimal example failing? i.e. executing always the else-branch?


\doifempty(else) doesn't expand the argument and any argument counts as 
not empty. To satisfy the command you can expand the first argument 
(\normalexpanded) or you use \doifnothing(else) which expands the argument.


\starttext

\startbuffer
\doifemptyelse{}{YES}{NO}

\doifemptyelse{\empty}{YES}{NO}

\normalexpanded{\doifemptyelse{}}{YES}{NO}

\normalexpanded{\doifemptyelse{\empty}}{YES}{NO}

\doifnothingelse{}{YES}{NO}

\doifnothingelse{\empty}{YES}{NO}
\stopbuffer

\typebuffer \getbuffer

\stoptext

Wolfgang

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

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


Re: [NTG-context] Help needed with slide grid layout

2022-05-25 Thread Stefan Nedeljkovic via ntg-context
I have problems setting up the grid in question. I cannot seem to configure
the grid spacing properly, despite combing through the "details" manual.
Could you help me configure the grid?

On Wed, May 25, 2022 at 6:24 PM Stefan Nedeljkovic 
wrote:

> Thank you very much Wolfgang, that solved the problem.
>
> On Wed, May 25, 2022 at 4:01 PM Wolfgang Schuster <
> wolfgang.schuster.li...@gmail.com> wrote:
>
>> Stefan Nedeljkovic via ntg-context schrieb am 25.05.2022 um 13:35:
>> > Dear list,
>> >
>> > This is a follow-up question on my previous question about Jean-Luc
>> > Doumont and his grid layouts. This time I have concrete questions. I
>> > reverse engineered his slide (slide_grid_overlay.pdf). All his units
>> are
>> > based on inches, because the inch is an integer multiple (72) of the
>> TeX
>> > point. His base unit is 0.1in. I tried implementing the layout first,
>> > but the pdf dimensions do not match the ones I set up. For example the
>> > width should be 8 inches, but the pdf is over 11 inches wide. I wish to
>> > shut off all margins and similar things and only have a text area with
>> > an offset of 0.2in all around the page (see slide_grid_overlay.pdf).
>> > Here is my current attempt:
>>
>> You have to use the \measured (with a trailing s) command when you need
>> multiples of a measure value. When you use something like 2\measure{...}
>> ConTeXt uses the "2" followed by the value of the measure, the following
>> example demonstrates this in the second output.
>>
>>  begin example
>> \definemeasure [point] [1pt]
>>
>> \starttext
>>
>> \startbuffer
>> \tex{measure}: \measure{point}
>>
>> \tex{measured}: \the\measured{point}
>> \stopbuffer
>>
>> \typebuffer \getbuffer
>>
>> \startbuffer
>> 2\tex{measure}: 2\measure{point}
>>
>> 2\tex{measured}: \the\dimexpr2\measured{point}\relax
>> \stopbuffer
>>
>> \typebuffer \getbuffer
>>
>> \stoptext
>>  end example
>>
>> Wolfgang
>>
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Help needed with slide grid layout

2022-05-25 Thread Stefan Nedeljkovic via ntg-context
Thank you very much Wolfgang, that solved the problem.

On Wed, May 25, 2022 at 4:01 PM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> Stefan Nedeljkovic via ntg-context schrieb am 25.05.2022 um 13:35:
> > Dear list,
> >
> > This is a follow-up question on my previous question about Jean-Luc
> > Doumont and his grid layouts. This time I have concrete questions. I
> > reverse engineered his slide (slide_grid_overlay.pdf). All his units are
> > based on inches, because the inch is an integer multiple (72) of the TeX
> > point. His base unit is 0.1in. I tried implementing the layout first,
> > but the pdf dimensions do not match the ones I set up. For example the
> > width should be 8 inches, but the pdf is over 11 inches wide. I wish to
> > shut off all margins and similar things and only have a text area with
> > an offset of 0.2in all around the page (see slide_grid_overlay.pdf).
> > Here is my current attempt:
>
> You have to use the \measured (with a trailing s) command when you need
> multiples of a measure value. When you use something like 2\measure{...}
> ConTeXt uses the "2" followed by the value of the measure, the following
> example demonstrates this in the second output.
>
>  begin example
> \definemeasure [point] [1pt]
>
> \starttext
>
> \startbuffer
> \tex{measure}: \measure{point}
>
> \tex{measured}: \the\measured{point}
> \stopbuffer
>
> \typebuffer \getbuffer
>
> \startbuffer
> 2\tex{measure}: 2\measure{point}
>
> 2\tex{measured}: \the\dimexpr2\measured{point}\relax
> \stopbuffer
>
> \typebuffer \getbuffer
>
> \stoptext
>  end example
>
> Wolfgang
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Help needed with slide grid layout

2022-05-25 Thread Wolfgang Schuster via ntg-context

Stefan Nedeljkovic via ntg-context schrieb am 25.05.2022 um 13:35:

Dear list,

This is a follow-up question on my previous question about Jean-Luc 
Doumont and his grid layouts. This time I have concrete questions. I 
reverse engineered his slide (slide_grid_overlay.pdf). All his units are 
based on inches, because the inch is an integer multiple (72) of the TeX 
point. His base unit is 0.1in. I tried implementing the layout first, 
but the pdf dimensions do not match the ones I set up. For example the 
width should be 8 inches, but the pdf is over 11 inches wide. I wish to 
shut off all margins and similar things and only have a text area with 
an offset of 0.2in all around the page (see slide_grid_overlay.pdf). 
Here is my current attempt:


You have to use the \measured (with a trailing s) command when you need
multiples of a measure value. When you use something like 2\measure{...}
ConTeXt uses the "2" followed by the value of the measure, the following
example demonstrates this in the second output.

 begin example
\definemeasure [point] [1pt]

\starttext

\startbuffer
\tex{measure}: \measure{point}

\tex{measured}: \the\measured{point}
\stopbuffer

\typebuffer \getbuffer

\startbuffer
2\tex{measure}: 2\measure{point}

2\tex{measured}: \the\dimexpr2\measured{point}\relax
\stopbuffer

\typebuffer \getbuffer

\stoptext
 end example

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] 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] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Uff, this is indeed deep tex. Thanks a lot for the example, Hans! I still need 
to learn a lot.

After a walk and a bit of fresh air, I found another (much easier) way around 
my problem. This works since I don't need to deal with #2 in any special way:

\tolerant\def\startMyCommand[#1]%
{
\startallbeautifulcontextcommands
% whatever #1 does
}

\tolerant\def\stopMyCommand%
{
\stopallbeautifulcontextcommands
}

Then one can do in the main files:

\startMyCommand

\beginMyBuffer
bla bla
\endMyBuffer

\stopMycommand

> On Jan 2, 2022, at 14:43, Hans Hagen  wrote:
> 
> On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:
>> Thanks, Hans, for the answer, but I'm not sure if I get the point.
>> While this is possible in ConTeXt:
>> \startsection[title={My Title}]
>> \beginMyBlock
>> bla bla
>> \endMyBlock
>> \stopsection
>> The following won't work (end of file error):
>> \startMyCommand[optional={Maybe}]
>> \beginMyBlock
>> bla bla
>> \endMyBlock
>> \stopMyCommand
>> I had hoped for a simple command/modifier like 
>> \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand to have #2 work 
>> in a similar way.
>> But maybe, as Wolfgang stated here 
>> (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
>> blocks can't be used in commands. (To add: Even when passed as arguments 
>> during compilation?)
> 
> You can bet that WS is right.
> 
> You really have to go dirty tex for this kind of magic:
> 
> \defineblock[MyBlock]
> \keepblocks[MyBlock]
> 
> \starttext
> 
> \tolerant\def\startMyCommand[#1]%
>  {\begingroup
>   \setcatcodetable\notcatcodes
>   \dostartMyCommand[#1]}
> 
> \let\stopMyCommand\relax
> 
> \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92
>  stopMyCommand}%
>  {\endgroup
>   % whatever #1 does
>   \setbuffer[foo]#2\endbuffer
>   \typebuffer[foo]
>   \getbuffer[foo]}
> 
> or
> 
> \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes 
> {\stopMyCommand}}%
>  {\endgroup
>   % whatever #1 does
>   \setbuffer[foo]#2\endbuffer
>   \typebuffer[foo]
>   \getbuffer[foo]}
> 
> \startMyCommand[optional={Maybe}]
> 
> \beginMyBlock
> bla bla
> \endMyBlock
> 
> \stopMyCommand
> 
> \stoptext
> 
> and then of course further nesting mess ...
> 
> 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] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Hans Hagen via ntg-context

On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:

Thanks, Hans, for the answer, but I'm not sure if I get the point.

While this is possible in ConTeXt:

\startsection[title={My Title}]

\beginMyBlock
bla bla
\endMyBlock

\stopsection

The following won't work (end of file error):

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

I had hoped for a simple command/modifier like 
\pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand  to have #2 work in 
a similar way.

But maybe, as Wolfgang stated here 
(https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
blocks can't be used in commands. (To add: Even when passed as arguments during 
compilation?)


You can bet that WS is right.

You really have to go dirty tex for this kind of magic:

\defineblock[MyBlock]
\keepblocks[MyBlock]

\starttext

\tolerant\def\startMyCommand[#1]%
  {\begingroup
   \setcatcodetable\notcatcodes
   \dostartMyCommand[#1]}

\let\stopMyCommand\relax

\normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92 
stopMyCommand}%

  {\endgroup
   % whatever #1 does
   \setbuffer[foo]#2\endbuffer
   \typebuffer[foo]
   \getbuffer[foo]}

or

\normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes 
{\stopMyCommand}}%

  {\endgroup
   % whatever #1 does
   \setbuffer[foo]#2\endbuffer
   \typebuffer[foo]
   \getbuffer[foo]}

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

\stoptext

and then of course further nesting mess ...

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
___


[NTG-context] Blank lines discarded when \typing

2021-12-03 Thread Thangalin via ntg-context
Note the presence of double-spaced blank lines in the following document
and in the attached source file:

\setuptyping[numbering=line]
\starttext

\startbuffer[javacode]
try {
  final var num = stack.pop();

  if( num != null ) {
stack.push( blah );
  }


  return true;
}
\stopbuffer

\type{\typebuffer}:
\typebuffer[javacode]

\type{\typing}:
\starttyping
try {
  final var num = stack.pop();

  if( num != null ) {
stack.push( blah );
  }


  return true;
}
\stoptyping

\type{\typefile}:
\typefile{t.java}

\stoptext

There appear to be two issues.

First, \typefile produces what I'd consider the "correct" result, where the
double-spaced lines appear on the page as a double-space. Both the
\typebuffer and \typing commands ignore double-spacing. The double-spacing
is also ignored by \xmldisplayverbatim. How would you configure to give
\typebuffer, \typing, and \xmldisplayverbatim to honour double-spaces the
same way as \typefile?

Second, of lesser importance, is that the blank lines aren't numbered. This
makes the line numbers inconsistent with respect to IDEs. How would you
label all blank lines as well?

Out of curiosity, does the second issue relate to the first?

Thank you!
try {
  final var num = stack.pop();
  
  if( num != null ) {
stack.push( blah );
  }
  
  
  return true;
}
___
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] getting sha512 from text in buffer

2021-12-01 Thread Pablo Rodriguez via ntg-context
Dear list,

I have this minimal sample:

  \ctxlua{require("util-sha")}

  \def\sha#1{%
  \ctxlua{context(utilities.sha2.hash512("#1"))}}

  \startbuffer[text]
  hola
  \stopbuffer

  \starttext
  \sha{hola}

  \sha{\typebuffer[text]}
  \stoptext

How can I get that both commands get the same sha512sum?

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
___


[NTG-context] io.loaddata() or buffer.assigns()

2021-09-08 Thread Thierry Horsin via ntg-context
Hi everybody
Are there any type of files that is required by io.loaddata or/and 
buffers.assign ?

The following code works pretty well if there is no compilation problem by g++.
But it fails, i.e. \typebuffer[Mybuffer], does not produce anything if g++ 
fails (due to some errors in the cpp)
I have checked that err.cpp is well and truly created when g++ fails. 
\startluacode
io.savedata("complx.h",buffers.getcontent("MyBuffer1"))
io.savedata("complx.cpp",buffers.getcontent("MyBuffer2"))
io.savedata("testcomplx.cpp",buffers.getcontent("MyBuffer3"))
local l=os.execute("g++ -O3 -Wall -o testcomplx testcomplx.cpp 
complx.cpp 2> err.cpp")
if l==0 then
os.execute("./testcomplx > testcomplx.tmp")
buffers.assign("MyBuffer",io.loaddata("testcomplx.tmp"))
else
buffers.assign("Mybuffer",io.open("err.cpp","r"))

end
\stopluacode

Many thanks
Thierry
___
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] getting line numbers

2021-09-04 Thread Thierry Horsin via ntg-context
Thank you Hans.
For what I had in mind (compiling some c++ inside a tex file) it seems to work. 
Anyway for this I am currently using the buffer and typebuffer solution you 
provide.
T.

Le Saturday 04 Sep 2021 à 10:35:34 (+0200), Hans Hagen a écrit :

> there has always been
> 
> \the\inputlineno
> 
> but it is not always accurate (because content can come from anyplace, e.g.
> lua)
> 
> 
> -
>   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] getting line numbers

2021-09-04 Thread thierry horsin via ntg-context

Hi and thank you Aditaya and again Hans.

By the way, just for fun , is there a(n easy) way to get the linenumber 
in the tex file ?


Thanks


On 03/09/2021 18:04, ntg-context-requ...@ntg.nl wrote:


--

Message: 4
Date: Fri, 3 Sep 2021 14:16:40 +0200
From: Hans Hagen 
To: mailing list for ConTeXt users 
Cc: Thierry Horsin 
Subject: Re: [NTG-context] getting line numbers
Message-ID: <807e4b7c-97ae-e20e-3207-28393544c...@xs4all.nl>
Content-Type: text/plain; charset=utf-8; format=flowed

in this case, thinking a bit different is easier ...

\starttext

\startbuffer[MyBuffer]
#include 

using namespace std;
int mysum(int,int);
int a; int b;
int main () {
  a=2; b=9;
  cout << mysum(a,b) << endl;
  return 0;
}
int mysum(int a, int b) {
  return a+b;
}
\stopbuffer

We compile and run:

\typebuffer[MyBuffer][option=C]

\startluacode
io.savedata("test.cpp",buffers.getcontent("MyBuffer"))
--os.execute("g++ -o test test.cpp")
--os.execute("./test > test.tmp")
os.execute("echo done > test.tmp")
buffers.assign("MyBuffer",io.loaddata("test.tmp"))
\stopluacode

And get:

\typebuffer[MyBuffer]

Or just:

\typefile{test.tmp}

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


--

--

Message: 6
Date: Fri, 3 Sep 2021 09:53:58 -0400 (EDT)
From: Aditya Mahajan 
To: Thierry Horsin via ntg-context 
Subject: Re: [NTG-context] getting line numbers
Message-ID:

Content-Type: text/plain; charset=US-ASCII

On Fri, 3 Sep 2021, Thierry Horsin via ntg-context wrote:


 https://github.com/adityam/filter

Behind the scenes, it works by saving the content in an external file and then
running it through any external program. It also allows for caching the
result, and has many options for customizing the behavior.

Aditya



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

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


Re: [NTG-context] getting line numbers

2021-09-03 Thread Thierry Horsin via ntg-context
Many thanks Hans.
Thierry

Le Friday 03 Sep 2021 à 14:16:40 (+0200), Hans Hagen a écrit :


> in this case, thinking a bit different is easier ...
> 
> \starttext
> 
> \startbuffer[MyBuffer]
> #include 
> 
> using namespace std;
> int mysum(int,int);
> int a; int b;
> int main () {
> a=2; b=9;
> cout << mysum(a,b) << endl;
> return 0;
> }
> int mysum(int a, int b) {
>     return a+b;
> }
> \stopbuffer
> 
> We compile and run:
> 
> \typebuffer[MyBuffer][option=C]
> 
> \startluacode
> io.savedata("test.cpp",buffers.getcontent("MyBuffer"))
> --os.execute("g++ -o test test.cpp")
> --os.execute("./test > test.tmp")
> os.execute("echo done > test.tmp")
> buffers.assign("MyBuffer",io.loaddata("test.tmp"))
> \stopluacode
> 
> And get:
> 
> \typebuffer[MyBuffer]
> 
> Or just:
> 
> \typefile{test.tmp}
> 
> \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
___


Re: [NTG-context] getting line numbers

2021-09-03 Thread Hans Hagen via ntg-context

On 9/3/2021 12:58 PM, Thierry Horsin via ntg-context wrote:

Hi everybody

Is there a way to have an automatic access to the current line number of a 
specific place inside a tex file ? To be more precise, here is what I would 
like to do.

I am currently trying to have some automatic external compilation by g++ of 
some portion of my tex file as in the following example below. \startC \stopC 
defines a framed part of text written between lines 538 and 549. Of course, if 
I add something before or inbetween my framed code, 538 and/or 549 will change. 
Thus I would like to get these two numbers automatically.

Thank you.
Thierry

\startC
#include 

using namespace std;
int mysum(int,int); int a; int b;
int main () { a=2; b=9;
   cout << mysum(a,b) << endl;
   return 0;
 }
int mysum(int a, int b)
{ return a+b; }
\stopC

\startluacode
myout = io.open("test.cpp", "w")
myin = io.open(tex.jobname..".tex", "r")
local n=0
for line in myin:lines() do
n=n+1
if n>539 and n<550 then
 myout:write(line.."\n")
  end
end
myout:close()
myin:close()
os.execute("g++ -o test test.cpp")
os.execute("./test > tmp")
local file=assert(io.open("tmp","r"))
local t = file:read("*all")
tex.print(t)
\stopluacode

in this case, thinking a bit different is easier ...

\starttext

\startbuffer[MyBuffer]
#include 

using namespace std;
int mysum(int,int);
int a; int b;
int main () {
a=2; b=9;
cout << mysum(a,b) << endl;
return 0;
}
int mysum(int a, int b) {
return a+b;
}
\stopbuffer

We compile and run:

\typebuffer[MyBuffer][option=C]

\startluacode
io.savedata("test.cpp",buffers.getcontent("MyBuffer"))
--os.execute("g++ -o test test.cpp")
--os.execute("./test > test.tmp")
os.execute("echo done > test.tmp")
buffers.assign("MyBuffer",io.loaddata("test.tmp"))
\stopluacode

And get:

\typebuffer[MyBuffer]

Or just:

\typefile{test.tmp}

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


Re: [NTG-context] line numbering restarts every page

2021-09-01 Thread Hans Hagen via ntg-context

On 9/1/2021 6:01 PM, Henning Hraban Ramm via ntg-context wrote:

Hi again,

if a "typing" environment with line numbering goes over a page break, the line 
numbers start at 1 again on the new page.
It doesn’t happen with \start/stoplinenumbering.

MWE:

\setuptyping[
   numbering=file,
]


\setuptyping[numbering=line]



\setuppaper[A5]
\setupbodyfont[18pt]

\starttext

\startbuffer
Li Europan lingues es membres del sam familie.
Lor separat existentie es un myth.
Por scientie, musica, sport etc, litot Europa usa li sam vocabular.
Li lingues differe solmen in li grammatica,
li pronunciation e li plu commun vocabules.
Omnicos directe al desirabilite de un nov lingua franca:
On refusa continuar payar custosi traductores.
At solmen va esser necessi far uniform grammatica,
pronunciation e plu sommun paroles.
Ma quande lingues coalesce, li grammatica del resultant
lingue es plu simplic e regulari quam ti del coalescent lingues.
Li nov lingua franca va esser plu simplic
e regulari quam li existent Europan lingues.
\stopbuffer

\dorecurse{10}{
   \samplefile{knuth}

   \typebuffer
}


\stoptext


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


[NTG-context] line numbering restarts every page

2021-09-01 Thread Henning Hraban Ramm via ntg-context
Hi again,

if a "typing" environment with line numbering goes over a page break, the line 
numbers start at 1 again on the new page.
It doesn’t happen with \start/stoplinenumbering.

MWE: 

\setuptyping[
  numbering=file,
]
\setuppaper[A5]
\setupbodyfont[18pt]

\starttext

\startbuffer
Li Europan lingues es membres del sam familie.
Lor separat existentie es un myth.
Por scientie, musica, sport etc, litot Europa usa li sam vocabular.
Li lingues differe solmen in li grammatica,
li pronunciation e li plu commun vocabules.
Omnicos directe al desirabilite de un nov lingua franca:
On refusa continuar payar custosi traductores.
At solmen va esser necessi far uniform grammatica,
pronunciation e plu sommun paroles.
Ma quande lingues coalesce, li grammatica del resultant
lingue es plu simplic e regulari quam ti del coalescent lingues.
Li nov lingua franca va esser plu simplic
e regulari quam li existent Europan lingues.
\stopbuffer

\dorecurse{10}{
  \samplefile{knuth}

  \typebuffer
}


\stoptext


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

2021-09-01 Thread Henning Hraban Ramm via ntg-context

> Am 01.09.2021 um 14:45 schrieb Hans Hagen via ntg-context 
> :
> 
> On 9/1/2021 2:19 PM, Henning Hraban Ramm via ntg-context wrote:
>> Hi, I’m trying to “translate” the documentation of “fiziko”* from LaTeX to 
>> ConTeXt and would like to avoid the doubling of MP code like:
>> \startMP
>> path p;
>> p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
>> draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
>> \stopMP
>> \startMPcode
>> path p;
>> p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
>> draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
>> \stopMPcode
>> I’m quite sure there’s a possibility with buffers, but how?
>> \startbuffer
>> path p;
>> p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
>> draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
>> \stopbuffer
>> \typebuffer
>> ... and then how do I get the MP graphic?
> \processMPbuffer

“of course”

Thank you!

Used here: https://github.com/fiee/fiziko/blob/master/fiziko.mkiv

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

2021-09-01 Thread Hans Hagen via ntg-context

On 9/1/2021 2:19 PM, Henning Hraban Ramm via ntg-context wrote:

Hi, I’m trying to “translate” the documentation of “fiziko”* from LaTeX to 
ConTeXt and would like to avoid the doubling of MP code like:

\startMP
 path p;
 p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
 draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopMP

\startMPcode
 path p;
 p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
 draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopMPcode

I’m quite sure there’s a possibility with buffers, but how?

\startbuffer
 path p;
 p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
 draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopbuffer

\typebuffer

... and then how do I get the MP graphic?

\processMPbuffer


-
  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] MetaPost Examples

2021-09-01 Thread Henning Hraban Ramm via ntg-context
Hi, I’m trying to “translate” the documentation of “fiziko”* from LaTeX to 
ConTeXt and would like to avoid the doubling of MP code like:

\startMP
path p;
p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopMP

\startMPcode
path p;
p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopMPcode

I’m quite sure there’s a possibility with buffers, but how?

\startbuffer
path p;
p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopbuffer

\typebuffer

... and then how do I get the MP graphic?


Hraban

*) https://github.com/jemmybutton/fiziko
___
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] file to buffer

2021-08-17 Thread Hans Hagen via ntg-context

On 8/17/2021 8:44 PM, Wolfgang Schuster via ntg-context wrote:

Hans van der Meer via ntg-context schrieb am 17.08.2021 um 15:15:
Is it possible to retrieve the contents of a file directly into a 
buffer? On the Wiki I could not find such a command. That is, 
equivalent to something like:

\startbuffer[from file]
contents of the file
\stopbuffer


Yes and no. The \samplefile command used to read file for example
stores the content of a file in a buffer to avoid rereading the file each
time the content is output but there is no way to suppress the output
neither to change the name of the buffer.

\starttext

\startnointerference
\samplefile{knuth}
\stopnointerference

\typebuffer[knuth]

\getbuffer[knuth]

\stoptext

\starttext

\ctxlua{buffers.assign(
"hvdm-is-not-afraid-of-some-lua",
io.loaddata(resolvers.findfile("tufte.tex"))
    )}

\typebuffer[hvdm-is-not-afraid-of-some-lua]

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


Re: [NTG-context] file to buffer

2021-08-17 Thread Wolfgang Schuster via ntg-context

Hans van der Meer via ntg-context schrieb am 17.08.2021 um 15:15:
Is it possible to retrieve the contents of a file directly into a 
buffer? On the Wiki I could not find such a command. That is, 
equivalent to something like:

\startbuffer[from file]
contents of the file
\stopbuffer


Yes and no. The \samplefile command used to read file for example
stores the content of a file in a buffer to avoid rereading the file each
time the content is output but there is no way to suppress the output
neither to change the name of the buffer.

\starttext

\startnointerference
\samplefile{knuth}
\stopnointerference

\typebuffer[knuth]

\getbuffer[knuth]

\stoptext

Wolfgang

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

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


Re: [NTG-context] How to check if buffer or block has content

2021-08-03 Thread Benjamin Buchmuller via ntg-context
Wow, that's powerful!

I'll add the wiki entries later tonight. 

Thanks a lot!

> On Aug 3, 2021, at 17:02, Hans Hagen  wrote:
> 
> On 8/2/2021 8:54 PM, Benjamin Buchmuller via ntg-context wrote:
>> That's great, I wikified a Note for testing if a buffer exists or has 
>> content (using the \getbuffer[…] approach for the moment).
>> If I was asked, I'd opt for \doifelseemptybuffer (doifemptyelse?) since one 
>> could think of similar commands that test for empty "objects".
>> Is there an option for testing blocks? (I actually use blocks quite 
>> frequently …)
>> I just realized they are probably handled very differently during the 
>> typesetting. Basically I would just need to test if during the first run any 
>> of \beginBLOCK … \endBLOCK was invoked (but if one gets a test for some 
>> content in-between that's even better).
>> As an alternative solution, is there a way to add content to buffers? 
>> Unfortunately, I can't use \getbuffer[first,second], but 
>> \startbuffer[first][add=yes] … \stopbuffer would be nice.
> just for fun I made this:
> 
> \starttext
> 
> \startbuffer[test]
>test
> \stopbuffer
> 
> \startbuffer[oeps]
>oeps
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = * + test]
>prepend
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = test + *]
>append
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = * +++ test]
>before
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = test +++ *]
>after
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \startbuffer[test = * + oeps + test + oeps + * ]
>DONE
> \stopbuffer
> 
> \typebuffer[test] \getbuffer[test]
> 
> \stoptext
> 
> which results in
> 
> test
> test
> prependtest
> prependtest
> prependtestappend
> prependtestappend
> before
> prependtestappend
> before
> prependtestappend
> before
> prependtestappend
> after
> before
> prependtestappend
> after
> DONEoepsbefore
> prependtestappend
> afteroepsDONE
> DONEoepsbefore
> prependtestappend
> afteroepsDONE
> 
> so basically one can combine buffers any way
> 
> +   : nothing in between
> ++  : space in between
> +++ : empty line in between
> 
> 
> -
>  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] How to check if buffer or block has content

2021-08-03 Thread Hans Hagen via ntg-context

On 8/2/2021 8:54 PM, Benjamin Buchmuller via ntg-context wrote:

That's great, I wikified a Note for testing if a buffer exists or has content 
(using the \getbuffer[…] approach for the moment).

If I was asked, I'd opt for \doifelseemptybuffer (doifemptyelse?) since one could think 
of similar commands that test for empty "objects".

Is there an option for testing blocks? (I actually use blocks quite frequently 
…)

I just realized they are probably handled very differently during the 
typesetting. Basically I would just need to test if during the first run any of 
\beginBLOCK … \endBLOCK was invoked (but if one gets a test for some content 
in-between that's even better).

As an alternative solution, is there a way to add content to buffers? 
Unfortunately, I can't use \getbuffer[first,second], but 
\startbuffer[first][add=yes] … \stopbuffer would be nice.

just for fun I made this:

\starttext

\startbuffer[test]
test
\stopbuffer

\startbuffer[oeps]
oeps
\stopbuffer

\typebuffer[test] \getbuffer[test]

\startbuffer[test = * + test]
prepend
\stopbuffer

\typebuffer[test] \getbuffer[test]

\startbuffer[test = test + *]
append
\stopbuffer

\typebuffer[test] \getbuffer[test]

\startbuffer[test = * +++ test]
before
\stopbuffer

\typebuffer[test] \getbuffer[test]

\startbuffer[test = test +++ *]
after
\stopbuffer

\typebuffer[test] \getbuffer[test]

\startbuffer[test = * + oeps + test + oeps + * ]
DONE
\stopbuffer

\typebuffer[test] \getbuffer[test]

\stoptext

which results in

test
test
prependtest
prependtest
prependtestappend
prependtestappend
before
prependtestappend
before
prependtestappend
before
prependtestappend
after
before
prependtestappend
after
DONEoepsbefore
prependtestappend
afteroepsDONE
DONEoepsbefore
prependtestappend
afteroepsDONE

so basically one can combine buffers any way

+   : nothing in between
++  : space in between
+++ : empty line in between


-
  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] Side-by-side environment

2021-05-31 Thread Werner Hennrich

Hello Tommy,
xtable is quite versatile and can do a lot of things -
place your cells next to each other by putting them into the same row.

If you haven't yet, this might be a good moment to skim through the
xtables manual
<https://www.pragma-ade.com/general/manuals/xtables-mkiv.pdf> and play
around,
for the full list of options refer to the commands reference
<http://www.pragma-ade.com/general/qrcs/setup-en.pdf>.

All the best!
Werner



Am 31.05.21 um 09:52 schrieb Tommaso Gordini:

Hello everybody.

Some time ago, Wolfgang helped me write an environment to have code
above and typeset output below.
I'll glue you a MWE below.

\mainlanguage [it]

\setupbodyfont [modern]


\defineuserdata

[example]

[alternative=example]


\defineuserdataalternative

[example]

[renderingsetup=userdata:example]


\startsetups [userdata:example]

\blank

\startembeddedxtable
[width=\textwidth,strut=no,offset=1ex,framecolor=black,rulethickness=0.5pt]

  \startxrow [corner=03,align=normal]

    \startxcell

      \typebuffer [userdata] [option=tex]

    \stopxcell

  \stopxrow

  \startxrow [corner=01,align=normal]

    \startxcell

      \getuserdata

    \stopxcell

  \stopxrow

\stopembeddedxtable

\blank

\stopsetups


\starttext


\startuserdata [example]

\starttext

C’era una volta un re\dots

\stoptext

\stopuserdata


\stoptext


Now, the question: Can the code to be improved? How can I modify the
code to have the example typeset to the right of the box? I would like
the box to be 0.5\textwidth wide.

Thanks in advance
Tommy

___
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] Side-by-side environment

2021-05-31 Thread Tommaso Gordini
Hello everybody.

Some time ago, Wolfgang helped me write an environment to have code above
and typeset output below.
I'll glue you a MWE below.

\mainlanguage [it]

\setupbodyfont [modern]


\defineuserdata

  [example]

  [alternative=example]


\defineuserdataalternative

  [example]

  [renderingsetup=userdata:example]


\startsetups [userdata:example]

  \blank

  \startembeddedxtable
[width=\textwidth,strut=no,offset=1ex,framecolor=black,rulethickness=0.5pt]

\startxrow [corner=03,align=normal]

  \startxcell

\typebuffer [userdata] [option=tex]

  \stopxcell

\stopxrow

\startxrow [corner=01,align=normal]

  \startxcell

\getuserdata

  \stopxcell

\stopxrow

  \stopembeddedxtable

  \blank

\stopsetups


\starttext


\startuserdata [example]

\starttext

  C’era una volta un re\dots

\stoptext

\stopuserdata


\stoptext


Now, the question: Can the code to be improved? How can I modify the code
to have the example typeset to the right of the box? I would like the box
to be 0.5\textwidth wide.

Thanks in advance
Tommy
___
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() does not ignore space in empty line

2021-04-19 Thread Hans Hagen

On 4/19/2021 9:22 AM, Sylvain Hubert wrote:

Dear list,

does anyone have an idea why, in the example below, context() starts a 
new paragraph at "\n\n" but not at "\n \n" with a space in between? Is 
there any way to fix it?


\starttext
Without using context(), inside the next parentheses is a new line: (
) note that a space sits between the two line breaks.

\startluacode
   context('Using context(), inside the next parentheses is also a new 
line: (\n\n) because there is *no* space between the two line breaks.\n\n')
   context('Using context(), inside the next parentheses is however *no* 
new line: (\n \n) because of the space between the two line breaks.\n\n')

\stopluacode
\stoptext

Any help is appreciated.

kind of tricky and dangerous to chanmge after many years

in cldf-ini.lua, change line 579 into

local emptyline = space^0 * newline^2 + newline * space^1

and run context --make

then test

\starttext
\startbuffer
\startluacode
context('line 1.1 (\n)   line 1.2\n\n') context.blank()
context('line 2.1 (\n )  line 2.2\n\n') context.blank()
context('line 3.1 ( \n)  line 3.2\n\n') context.blank()
context('line 4.1 ( \n ) line 4.2\n\n') context.blank()
context('line 5.1 (\n\n) line 5.2\n\n') context.blank()
context('line 6.1 (\n\n )line 6.2\n\n') context.blank()
context('line 7.1 ( \n\n)line 7.2\n\n') context.blank()
context('line 8.1 ( \n\n )   line 8.2\n\n') context.blank()
context('line 9.1 (\n \n)line 9.2\n\n') context.blank()
context('line 0.1 (\n \n \n) line 0.2\n\n') context.blank()
\stopluacode
    \stopbuffer
\typebuffer
\getbuffer
\stoptext

now, the question is, does this cover all cases and is this what we 
expect ...


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
___


[NTG-context] new font trickery

2020-12-22 Thread Hans Hagen

Hi,


I finally decided to start an experiment that I had on my todo list for 
a while: dynamically scaling fonts. Below is an example of usage (plus 
some comment). In that example some 2*200 different font sizes are used 
which in mkiv demands 400 font definitions. This costs time and memory. 
The example below runs (on my old laptop) in less than 2 seconds and 
only uses two instances. I bet that our CJK users will love it.


I post it because:

(1) I need to discuss the impact with Wolfgang ... how do we integrate 
this. We can for instance define some sizes (\tfa \tfb ...) differently.


(2) I want to see if average performance improves on huge documents with 
many fonts / sizes (that is for Massimiliano to test).


(3) Are there side effects? It does work for math (rather neat trickery) 
but maybe we need an additional configration for that.


(4) I considered several variants but for now use a low level 
\glyphscale command that takes a number (in goodl old tex tradition a 
scale of 1.0 is entered as 1000).


(5) The implementation can be improved a bit (performance wise). There 
is a bit more overhead involved but usually I can compensate that.


(6) It will not be backported to MKIV so one can only test in LMTX. 
it's a bit of a mix between engine and context features.


(7) There can be bugs (unforseen side effects, or typos in the somewhat 
quick patches in the source).


Consider it an experiment, but so far I'm rather satisfied,

Hans



 EXAMPLE 

\setuplayout[middle]

\setupbodyfont[pagella,10pt]

\setupalign[verytolerant,stretch]

\setupwhitespace[big]

\starttext

\startbuffer
\definescaledfont[bfe][scale=2000,style=bf]

\setuphead[chapter][style=\bfe]

\dostepwiserecurse {10} {2020} {10} {
\title{Here we go #1!}
\start
\glyphscale#1\relax
\setupinterlinespace
\samplefile{ward}%
\bf
\samplefile{ward}
\par
\stop
\page
}
\stopbuffer

\getbuffer

\title{Scaled fonts}

Although \CONTEXT\ is quite efficient with fonts there is always room for
improvement. However, after years of finetuning the font mechanisms 
there was not

that much room left. This made me think of a different approach to scaling.
Nowadays fonts seldom come in design sizes. Also, in \CONTEXT\ \MKIV\ and
therefore \LMTX\ we always had so called dynamic features: apply additional
features locally, although that comes with a small penalty in 
performance, it
saves additional font instances. It is a good approach for the 
occasional small

stretch of glyphs, like small capped logos and such.

We now can also do dynamic font scaling, which means that we don't need 
to define
a new font instance when the same feature set is used. Or course in 
addition to

this features one can still use the dynamic features. This means that for
instance chapter titling can use the bodyfont instance and just apply 
additional
scaling. Although for a normal run the number of loaded fonts is 
normally small,
and the number of instances also isn't that impressive it can happen in 
a large
document that you end up with a few dozen. That number can now be 
reduced to half

a dozen.

Of course there can be side effects, whcich is why it's currently tagged as
experimental. There is also a small performance hit because we now need 
to track
it but that is gained back because we load less fonts and have less 
glyph runs.

It even works in math, although there some different trickery is needed.

\typebuffer

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


Re: [NTG-context] Setting and measuring boxes TeX/Lua

2020-11-27 Thread Jano Kula
Hello again, Hans!

On Thu, 26 Nov 2020 at 09:18, Hans Hagen  wrote:

> (this mechanism is already kind of old, there are also other cheats
> possible)
>

Diving into functions and using context.stepwise() worked, until I've got
to: /cldf-stp.lua:48: bad argument #1 to 'resume' (thread expected) and
other errors. It was triar/error approach, not exactly knowing how
context.stepwise() works, and I was some more lua functions and iterations
before needing expansion.

Therefore I've changed the strategy (cannot give up):

   - Create named buffers with formatted content (and store measures)
   before they are needed.
   - When needed, use the reference to the buffer.

Tests looked promising. After \starttext buffers and measures are known
(both TeX & Lua). Also tested in functions, etc.
But inside the first \xmlsetup, they are not expanded anymore, they are
typeset (like \typebuffer).

   - How to have them expanded in \xmlsetup?
   - Is other mechanism better suited for storing typeset blocks than
   buffers (and will survive \xmlsetup)?
   - If none of them is possible, what are the *other **cheats *then?

Thanks,
Jano

MWE attached

% BUFFERS
\startluacode
-- fill buffers
for i=1,1000 do
local content = "framed-" .. i
context.startbuffer( { i } )
context.StartBox()
context.bold(i)context.par()
context.color( { "red" }, content )
context.StopBox()
context.copy(false,0)
context.stopbuffer()
print(">>", i)
end
\stopluacode

\def\StartBox{\setbox0=\hbox\bgroup\framed[width=50mm,
   background=color,
   backgroundcolor=gray,
   frame=off,align={flushleft}]%
   \bgroup%
\vbox\bgroup}
\def\StopBox{\egroup\egroup\egroup}% close vbox, framed, hbox

\def\MeasureBuffer[#1]{\setbox0\hbox{\getbuffer[#1]}%
   ht: \the\ht0\par}


% XML
\startbuffer[doc]


section
section

\stopbuffer

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

\xmlregistersetup{xml:name}

\startxmlsetups xml:name:document
\Title{inside xml:name:document}
\Title{TeX}
\MeasureBuffer[333]
\getbuffer[333]
\Title{Lua}
\startluacode
context.MeasureBuffer({"444"})
context.getbuffer({"444"})
\stopluacode
\stopxmlsetups

\def\Title#1{\blank{\bf #1}\par}


\starttext

\Title{TeX}
\MeasureBuffer[111]
\getbuffer[111]

\Title{Lua}
\startluacode
context.MeasureBuffer({"222"})
context.getbuffer({"222"})
\stopluacode

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

\stoptext


xml-buffers.tex
Description: TeX 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] lmtx

2020-10-30 Thread Jairo A. del Rio
Hi, Hans. The last release is considerably faster for smaller documents
(for larger documents differences seem to be neglectable). Thank you for
such an improvement. However, something is wrong with one manual:
luametatex manual won't compile:

156 Beware: the values are always saved in the format, independent of
the setting
157 of \prm {savinghyphcodes} at the moment the format is dumped.
158
159 A boundary node normally would mark the end of a word which
interferes with for
160 instance discretionary injection. For this you can use the \prm
{wordboundary}
161 as a trigger. Here are a few examples of usage:
162
163 \startbuffer
164 discrete---discrete
165 \stopbuffer
166 >>  \typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par
\stopnarrower
167 \startbuffer
168 discrete\discretionary{}{}{---}discrete
169 \stopbuffer
170 \typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par
\stopnarrower
171 \startbuffer
172 discrete\wordboundary\discretionary{}{}{---}discrete
173 \stopbuffer
174 \typebuffer \startnarrower \dontcomplain \hsize 1pt \getbuffer \par
\stopnarrower
175 \startbuffer
176 discrete\wordboundary\discretionary{}{}{---}\wordboundary
discrete

A number should have been here; I inserted '0'. (If you can't figure out
why I
needed to see a number, look up 'weird error' in the index to The TeXbook.)

The prepackaged PDF manual is also broken: an error banner.

Regards,

Jairo :)

El vie., 30 de oct. de 2020 a la(s) 17:29, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> Hi,
>
> I might have uploaded a new version by accident so be careful when you
> update. Make a backup first. Sorry,
>
> The test suite compiles, which doesn't day all is ok as i just run it.
>
> There are no funcional changes, only a bit of conceptual reworking of
> some internals in the process of adapting to new features as well as
> protection, so
>
>\starttext
>
>\start
>\def\framed{oeps}
>\stop
>
>\stoptext
>
> is permitted, but when you run with
>
>context --overloadmode=warning
>
> you get a warning and with
>
>context --overloadmode=error
>
> the run aborts. Here is a user macro example:
>
>\frozen\def\foo{oeps}
>   \def\foo{oeps} % warning or error
>\overloaded\def\foo{oeps} % okay
>
> eventually all system macros will be way more protected, being
> primitive, permanent, immutable to mention some of the possible
> properties. It's work in progress as you can imagine some pitfals and in
> order for it to work well quite some has to be flagged. Also, I have to
> play with some related additions.
>
> (This version also makes more extensive use of some new macro features
> but that's for later.)
>
> 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 : 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 with lmtx and color in table

2020-07-22 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 22.07.2020 um 17:09:

Hello,
With the latest version of lmtx, the background color of cells does not 
work.


Unrelated to tables.

You can reduce xtable and natural table based examples very often to a 
simple \framed because both tables types inherit many features from it.


\starttext

\startbuffer
\vrule width 4cm height 4cm depth 0pt\relax
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\hrule width 4cm height 4cm depth 0pt\relax
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\frule width 4cm height 4cm type fill\relax
\stopbuffer

\typebuffer \getbuffer

\stoptext

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

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


Re: [NTG-context] Avoid indentation after \typebuffer

2020-07-01 Thread Hans Hagen

On 7/1/2020 12:25 PM, Mikael Sundqvist wrote:


Does the indentnext do something else for this setup?

I'll look at it

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] Avoid indentation after \typebuffer

2020-07-01 Thread Mikael Sundqvist
On Wed, Jul 1, 2020 at 8:53 AM Hans Hagen  wrote:

> On 6/30/2020 9:50 PM, Mikael Sundqvist wrote:
> > Hi,
> >
> > I want to avoid indentation after \typebuffer (or set indentnext to auto
> > perhaps). I am probably missing something simple, but I thought that the
> > example file below should have worked:
> >
> > \setupindenting[yes,medium]
> >
> > \setuptyping[buffer][
> > indentnext=no,
> > ]
> >
> > \starttext
> >
> > \startbuffer
> > \startformula
> > \int_a^b f'(x)\,dx
> > \stopformula
> > \stopbuffer
> >
> > \typebuffer
> > I do not want this line to be indented.
> >
> > \stoptext
> >
> > Compiled with an updated lmxt, and resulting pdf file is attached.
> \setuptyping
>[buffer]
>[before=\blank,
> after={\blank\noindentation}]% indentnext=no]
>
>
OK, that is a way around. I thought the indentnext existed for this, since
it was present in http://www.pragma-ade.com/general/qrcs/setup-en.pdf

Does the indentnext do something else for this setup?

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

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


Re: [NTG-context] Avoid indentation after \typebuffer

2020-07-01 Thread Hans Hagen

On 6/30/2020 9:50 PM, Mikael Sundqvist wrote:

Hi,

I want to avoid indentation after \typebuffer (or set indentnext to auto 
perhaps). I am probably missing something simple, but I thought that the 
example file below should have worked:


\setupindenting[yes,medium]

\setuptyping[buffer][
indentnext=no,
]

\starttext

\startbuffer
\startformula
\int_a^b f'(x)\,dx
\stopformula
\stopbuffer

\typebuffer
I do not want this line to be indented.

\stoptext

Compiled with an updated lmxt, and resulting pdf file is attached.

\setuptyping
  [buffer]
  [before=\blank,
   after={\blank\noindentation}]% indentnext=no]

-
  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] Avoid indentation after \typebuffer

2020-06-30 Thread Mikael Sundqvist
Hi,

I want to avoid indentation after \typebuffer (or set indentnext to auto
perhaps). I am probably missing something simple, but I thought that the
example file below should have worked:

\setupindenting[yes,medium]

\setuptyping[buffer][
indentnext=no,
]

\starttext

\startbuffer
\startformula
\int_a^b f'(x)\,dx
\stopformula
\stopbuffer

\typebuffer
I do not want this line to be indented.

\stoptext

Compiled with an updated lmxt, and resulting pdf file is attached.

/Mikael


indentproblem.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] changing alignment inside a paragraph

2019-12-10 Thread Wolfgang Schuster

mf schrieb am 10.12.2019 um 12:27:

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.


Use the "end" keyword for the alignment.

\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 34, 57, 101-104, 276, 345, 401–403.
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\startalignment[end]
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, 101-104, 276, 345, 401–403.
\stopalignment
\stopbuffer

\typebuffer \getbuffer

\stoptext

Wolfgang

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

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


Re: [NTG-context] ASCII mode within \footnote

2019-11-04 Thread Wolfgang Schuster

Aditya Mahajan schrieb am 04.11.2019 um 15:05:

On Mon, 4 Nov 2019, Aditya Mahajan wrote:

That should have been:


As Hans' mentioned, use:

\startasciimode
\footnote{\type{%APPDATA%\file.txt}}
\stopasciimode


In a longer document setting \asciimode at the begin can be the better 
solution.


The reason why setting \asciimode in the \footnote doesn't work is that 
TeX uses
uses the meaning of a special character it had when it read the 
argument, i.e.
when TeX reads the text "%APPDATA%\file.txt" the percent sign acts as 
begin of
a comment and everything after it is ignored. As a result the asciimode 
command

can't work because the text has already disappeared.

Other characters like $ are less problematic because there are ways to 
change
their meaning afterwards (# can be tricky) but not comments because 
nothing remains.


\setupbuffer
  [before=\blank,
   after=\blank]

\starttext

Normal comment:

\startbuffer
    % comment
\stopbuffer

\typebuffer \getbuffer

Comment in \type{asciimode} environment:

\startbuffer
    \startasciimode
    % comment
    \stopasciimode
\stopbuffer

\typebuffer \getbuffer

Comment in the argument of a command:

\startbuffer
    \firstofoneargument
    {
    % comment
    }
\stopbuffer

\typebuffer \getbuffer

Comment in the argument of a command + \type{asciimode} in the argument:

\startbuffer
    \firstofoneargument
    {
    \startasciimode
    % comment
    \stopasciimode
    }
\stopbuffer

\typebuffer \getbuffer

Comment in a argument after \type{asciimode} was enabled:

\startbuffer
    \startasciimode
    \firstofoneargument
    {
    % comment
    }
    \stopasciimode
\stopbuffer

\typebuffer \getbuffer

\stoptext

Wolfgang

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

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


Re: [NTG-context] interlaced overbrace and underbrace

2019-10-25 Thread Hans Hagen

On 10/25/2019 4:54 PM, mf wrote:

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
the best i can so is to provide more options (one day drawing these 
things might come to a grinding halt because of them)



\starttext

\startbuffer
$a + \doublebrace[lt=1em] {b+c+d} + e$\blank
$a + \overbrace  [lt=1em] {b+c+d} + e$\blank
$a + \underbrace [lt=1em] {b+c+d} + e$\blank
$a + \doublebrace[rb=1em] {b+c+d} + e$\blank
$a + \overbrace  [rb=1em] {b+c+d} + e$\blank
$a + \underbrace [rb=1em] {b+c+d} + e$\blank
$a + \doublebrace[lt=1em,rb=1em]  {b+c+d} + e$\blank
$a + \overbrace  [lt=1em,rb=1em]  {b+c+d} + e$\blank
$a + \underbrace [lt=1em,rb=1em]  {b+c+d} + e$\blank
$a + \doublebrace[lt=-4em,rb=-4em]{b+c+d} + e$\blank
\stopbuffer

\typebuffer[option=TEX]

\getbuffer

\stoptext

so, lt for lefttop etc

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] new (lmtx) beta

2019-10-05 Thread Fabrice Couvreur
Hi Hans,
Where is this documentation ?
Thank you.
Fabrice



Le ven. 4 oct. 2019 à 21:34, Mikael P. Sundqvist  a
écrit :

> On Fri, Oct 4, 2019 at 6:11 PM Hans Hagen  wrote:
>
>> Hi,
>>
>> I uploaded a new lmtx beta. Again some more metafun trickery (see
>> luametafun manual). I attached an (lmtx only) example of some experiment
>> code, dedicated to Alan Braslau (teacher among other things).
>>
>> 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
>>
>> ___
>>
>
>
> Hi,
>
> I read the new manual with a great joy! This is really nice improvements
> of MetaFun! I also like the 3D plots!
>
> I had the possibility to try out some contour graphics on a freshly
> updated system. I have two questions:
>
> 1) I think the first (blue) plot looks fine and it looks like it could be
> the same curve as the blue one in the Mathematica plot (page 3). Why does
> my second example (orange) not match with the result from Mathematica
> (orange)? (I think I do something wrong)
> 2) Is there a way to combine the two contour plots in one MetaFun drawing?
> If I add them both to the same, only the last one shows. If I try
> functions={"-4+x^2+x^5+15*y-y^2-10*x^3*y^2+5*x*y^4","-15*x+2*x*y+5*x^4*y-10*x^2*y^3+y^5"}
> it does not show both either.
>
> /Mikael
>
> Test document (output was too big to attach (sorry if it came through to
> someone), so I put it at http://www.maths.lth.se/~mickep/polynomnoll.pdf )
>
> \starttext
> \startMPpage[offset=3bp,instance=doublefun]
> draw lmt_contour [
> xmin=-5,
> xmax=5,
> ymin=-5,
> ymax=5,
> xstep=0.01,
> ystep=0.01,
> range={0},
> levels=1,
> function="-4+x^2+x^5+15*y-y^2-10*x^3*y^2+5*x*y^4",
> linecolor="darkblue",
> linewidth=1,
> legend=false,
> cache=true,
> ]  xsized 10cm ;
> \stopMPpage
>
> \startMPpage[offset=3bp,instance=doublefun]
> draw lmt_contour [
> xmin=-5,
> xmax=5,
> ymin=-5,
> ymax=5,
> xstep=0.01,
> ystep=0.01,
> range={0},
> levels=1,
> function="-15*x+2*x*y+5*x^4*y-10*x^2*y^3+y^5",
> linecolor="orange",
> linewidth=1,
> legend=false,
> cache=true,
> ]  xsized 10cm ;
> \stopMPpage
>
> \startbuffer[mmainput]
> ContourPlot[
>  {-4+x^2+x^5+15y-y^2-10x^3y^2+5x*y^4 == 0,
>   -15x+2x*y+5*x^4*y-10x^2*y^3+y^5 == 0},
>   {x, -5, 5}, {y, -5, 5}, Frame -> False]
> \stopbuffer
> \startTEXpage[offset=2bp]
> \typebuffer[mmainput]
>
> \externalfigure[mathematicaplot][width=10cm]
> \stopTEXpage
> \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] new (lmtx) beta

2019-10-04 Thread Mikael P. Sundqvist
On Fri, Oct 4, 2019 at 6:11 PM Hans Hagen  wrote:

> Hi,
>
> I uploaded a new lmtx beta. Again some more metafun trickery (see
> luametafun manual). I attached an (lmtx only) example of some experiment
> code, dedicated to Alan Braslau (teacher among other things).
>
> 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
>
> ___
>


Hi,

I read the new manual with a great joy! This is really nice improvements of
MetaFun! I also like the 3D plots!

I had the possibility to try out some contour graphics on a freshly updated
system. I have two questions:

1) I think the first (blue) plot looks fine and it looks like it could be
the same curve as the blue one in the Mathematica plot (page 3). Why does
my second example (orange) not match with the result from Mathematica
(orange)? (I think I do something wrong)
2) Is there a way to combine the two contour plots in one MetaFun drawing?
If I add them both to the same, only the last one shows. If I try
functions={"-4+x^2+x^5+15*y-y^2-10*x^3*y^2+5*x*y^4","-15*x+2*x*y+5*x^4*y-10*x^2*y^3+y^5"}
it does not show both either.

/Mikael

Test document (output was too big to attach (sorry if it came through to
someone), so I put it at http://www.maths.lth.se/~mickep/polynomnoll.pdf )

\starttext
\startMPpage[offset=3bp,instance=doublefun]
draw lmt_contour [
xmin=-5,
xmax=5,
ymin=-5,
ymax=5,
xstep=0.01,
ystep=0.01,
range={0},
levels=1,
function="-4+x^2+x^5+15*y-y^2-10*x^3*y^2+5*x*y^4",
linecolor="darkblue",
linewidth=1,
legend=false,
cache=true,
]  xsized 10cm ;
\stopMPpage

\startMPpage[offset=3bp,instance=doublefun]
draw lmt_contour [
xmin=-5,
xmax=5,
ymin=-5,
ymax=5,
xstep=0.01,
ystep=0.01,
range={0},
levels=1,
function="-15*x+2*x*y+5*x^4*y-10*x^2*y^3+y^5",
linecolor="orange",
linewidth=1,
legend=false,
cache=true,
]  xsized 10cm ;
\stopMPpage

\startbuffer[mmainput]
ContourPlot[
 {-4+x^2+x^5+15y-y^2-10x^3y^2+5x*y^4 == 0,
  -15x+2x*y+5*x^4*y-10x^2*y^3+y^5 == 0},
  {x, -5, 5}, {y, -5, 5}, Frame -> False]
\stopbuffer
\startTEXpage[offset=2bp]
\typebuffer[mmainput]

\externalfigure[mathematicaplot][width=10cm]
\stopTEXpage
\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] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Weber, Matthias
A while back I asked a similar question, and Hans pointed out the following 
which I still use:

\defineenumeration
 [exercise]
 [way=bysection,
  text=Exercise,
  coupling=solution,
  location=hanging]

\defineenumeration
 [solution]
 [text=Solution,
  way=bysection,
  coupling=exercise,
  location=hanging]

\defineblock[exercise]
\defineblock[solution]
\hideblocks[solution]

\setupinteraction
 [state=start]

\starttext

\section{Main Text}

\subsection[subsec:1]{problem section 1}

\startexercise
Addition\index{addition} problem: $1+1=?$ 
\stopexercise

\beginsolution[one]
\startsolution
Answer: 2. 
\stopsolution
\endsolution

\subsection[subsec:2]{problem section 2}

\startexercise
Multiplication problem: $1\times1=?$
\stopexercise

\beginsolution[two]
\startsolution
Answer: 1.
\stopsolution
\endsolution

\page

%\reset[solution]

\section{Answers to the Problems}

\subsection{Answers to \in{section}[subsec:1]}

\useblocks[solution][one]

\subsection{Answers to \in{section}[subsec:2]}

\useblocks[solution][two]

\stoptext


> On Jan 31, 2019, at 5:02 PM, Wolfgang Schuster 
>  wrote:
> 
> Hi Sanjoy,
> 
> when you have a equal number of questions ans answers you can create a 
> enumeration for each and collect the answers with the block mechanism.
> 
> At the end of the document you can flush the collected answers.
> 
> \defineblock [answer]
> 
> \defineenumeration [question]
> \defineenumeration [answer]
> 
> \starttext
> 
> \startquestion
> Question 1
> \stopquestion
> 
> \beginanswer
> \startanswer
> Answer 1
> \stopanswer
> \endanswer
> 
> \startquestion
> Question 2
> \stopquestion
> 
> \beginanswer
> \startanswer
> Answer 2
> \stopanswer
> \endanswer
> 
> \page
> 
> \useblocks[answer]
> 
> \stoptext
> 
> Wolfgang
> 
> 
> Sanjoy Mahajan schrieb am 31.01.19 um 22:51:
>> Dear List,
>> I'm trying to have problem solutions automatically collected, each with
>> its corresponding problem number, e.g. 2.3, and then typeset at the end
>> of a document.  Thus, I imagine something like
>> \startproblem{A problem title}  % Problem 1.1
>> A question
>> \startsolution
>> An answer
>> \stopsolution
>> \stopproblem
>> And then the solution(s) would appear at the end (with the "1.1"
>> remembered from when the problem was typeset):
>>   Solution to Problem 1.1.
>>   An answer
>> It seems that buffers are the way to do this.  But I cannot quite get
>> the automatic numbering to work.  The delayed evaluation and information
>> passing between lua and ConTeXt has me confused and tangled in a knot.
>> Below is a minimal almost-working example.  The issue is in the line
>>   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
>> which ends up putting the verbatim string "\getnumber[problem]" into the
>> temp buffer, rather than the typeset result, which would be something
>> like 1.1 or 1.2.
>> I've read the cld-mkiv.pdf manual, but I must be missing a simple
>> solution to getting ConTeXt to send back the result of
>> \getnumber[problem].  I've also tried the analogous
>> context.getnumber({"problem"}), though without success.
>> Does anyone see what I am missing?
>> Many thanks!
>> -Sanjoy
>> \defineenumeration[problem]
>>   [title=yes, text=Problem, way=bychapter, prefix=chapter]
>> \defineenumeration[solution][problem]
>> \setupenumeration [solution][text={Solution to problem}, number=no]
>> \def\test#1{[#1]}
>> % appendbuffer modified from Sietse Brouwer's on mailing list (Jan 15, 2013)
>> \startluacode
>> userdata = userdata or { }
>> function userdata.addTempToBuffer(buffername, problem)
>> buffers.append(
>> buffername,
>> '\\startsolution{' .. problem .. '}\n' .. 
>> buffers.getcontent('APPENDTEMP') .. '\n\\stopsolution\n\n'
>> )
>> end
>> \stopluacode
>> \def\startappendbuffer[#1]%
>>   {\def\stopappendbuffer%
>>   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
>>\dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}
>> \starttext
>> \chapter{One}
>> \startproblem{Test}
>>   Test problem
>> \startappendbuffer[soln]
>> Solution
>> \stopappendbuffer
>> \stopproblem
>> \startproblem{Test}
>> Test problem
>> \startappendbuffer[soln]
>> Solution
>> \stopappendbuffer
>> \stopproblem
>> \typebuffer[soln]
>> \stoptext
>> ___
>> If your question

Re: [NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Wolfgang Schuster

Hi Sanjoy,

when you have a equal number of questions ans answers you can create a 
enumeration for each and collect the answers with the block mechanism.


At the end of the document you can flush the collected answers.

\defineblock [answer]

\defineenumeration [question]
\defineenumeration [answer]

\starttext

\startquestion
Question 1
\stopquestion

\beginanswer
\startanswer
Answer 1
\stopanswer
\endanswer

\startquestion
Question 2
\stopquestion

\beginanswer
\startanswer
Answer 2
\stopanswer
\endanswer

\page

\useblocks[answer]

\stoptext

Wolfgang


Sanjoy Mahajan schrieb am 31.01.19 um 22:51:

Dear List,

I'm trying to have problem solutions automatically collected, each with
its corresponding problem number, e.g. 2.3, and then typeset at the end
of a document.  Thus, I imagine something like

\startproblem{A problem title}  % Problem 1.1
A question

\startsolution
An answer
\stopsolution

\stopproblem

And then the solution(s) would appear at the end (with the "1.1"
remembered from when the problem was typeset):

   Solution to Problem 1.1.

   An answer

It seems that buffers are the way to do this.  But I cannot quite get
the automatic numbering to work.  The delayed evaluation and information
passing between lua and ConTeXt has me confused and tangled in a knot.

Below is a minimal almost-working example.  The issue is in the line

   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}

which ends up putting the verbatim string "\getnumber[problem]" into the
temp buffer, rather than the typeset result, which would be something
like 1.1 or 1.2.

I've read the cld-mkiv.pdf manual, but I must be missing a simple
solution to getting ConTeXt to send back the result of
\getnumber[problem].  I've also tried the analogous
context.getnumber({"problem"}), though without success.

Does anyone see what I am missing?

Many thanks!

-Sanjoy

\defineenumeration[problem]
   [title=yes, text=Problem, way=bychapter, prefix=chapter]
\defineenumeration[solution][problem]
\setupenumeration [solution][text={Solution to problem}, number=no]

\def\test#1{[#1]}

% appendbuffer modified from Sietse Brouwer's on mailing list (Jan 15, 2013)
\startluacode
 userdata = userdata or { }
 function userdata.addTempToBuffer(buffername, problem)
 buffers.append(
 buffername,
 '\\startsolution{' .. problem .. '}\n' .. 
buffers.getcontent('APPENDTEMP') .. '\n\\stopsolution\n\n'
 )
 end
\stopluacode

\def\startappendbuffer[#1]%
   {\def\stopappendbuffer%
   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
\dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}

\starttext

\chapter{One}

\startproblem{Test}
   Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\startproblem{Test}
Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\typebuffer[soln]

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

[NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Sanjoy Mahajan
Dear List,

I'm trying to have problem solutions automatically collected, each with
its corresponding problem number, e.g. 2.3, and then typeset at the end
of a document.  Thus, I imagine something like

\startproblem{A problem title}  % Problem 1.1
A question

\startsolution
An answer
\stopsolution

\stopproblem

And then the solution(s) would appear at the end (with the "1.1"
remembered from when the problem was typeset):

  Solution to Problem 1.1.

  An answer

It seems that buffers are the way to do this.  But I cannot quite get
the automatic numbering to work.  The delayed evaluation and information
passing between lua and ConTeXt has me confused and tangled in a knot.

Below is a minimal almost-working example.  The issue is in the line

  {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}

which ends up putting the verbatim string "\getnumber[problem]" into the
temp buffer, rather than the typeset result, which would be something
like 1.1 or 1.2.

I've read the cld-mkiv.pdf manual, but I must be missing a simple
solution to getting ConTeXt to send back the result of
\getnumber[problem].  I've also tried the analogous
context.getnumber({"problem"}), though without success.

Does anyone see what I am missing?

Many thanks!

-Sanjoy

\defineenumeration[problem]
  [title=yes, text=Problem, way=bychapter, prefix=chapter]
\defineenumeration[solution][problem]
\setupenumeration [solution][text={Solution to problem}, number=no]

\def\test#1{[#1]}

% appendbuffer modified from Sietse Brouwer's on mailing list (Jan 15, 2013)
\startluacode
userdata = userdata or { }
function userdata.addTempToBuffer(buffername, problem)
buffers.append(
buffername,
'\\startsolution{' .. problem .. '}\n' .. 
buffers.getcontent('APPENDTEMP') .. '\n\\stopsolution\n\n'
)
end
\stopluacode

\def\startappendbuffer[#1]%
  {\def\stopappendbuffer%
  {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
   \dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}

\starttext

\chapter{One}

\startproblem{Test}
  Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\startproblem{Test}
Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\typebuffer[soln]

\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] A ConTeXt Guide in Italian

2018-12-02 Thread Wolfgang Schuster

Tommaso Gordini schrieb am 27.11.18 um 08:14:
Wolfgang, your code works very fine for me, and the result is very 
beautiful, but I have noticed that it does not allow the interruption 
between two pages.


I tried to pass the split=yes option to the \startembeddedxtable, 
\startxrow or\startxcell commands, but nothing happens: where am I wrong?
Is it possible to get what I want? Often I need to write long codes, 
with and without output, and a breakable environment would avoid large 
ugly spaces on the page.


Use the framedtext environment for the content of your examples.


Below a MWE.

Thanks in advance
Tommaso

\defineuserdata [purecode] [alternative=purecode]

\defineuserdataalternative [purecode] [renderingsetup=userdata:purecode]

\startsetups [userdata:purecode]
   \blank
   \startembeddedxtable 
[width=\textwidth,strut=no,offset=1ex,framecolor=black,rulethickness=0.5pt]

     \startxrow [corner=round,align=normal]
       \startxcell
         \typebuffer [userdata] [option=tex]
       \stopxcell
     \stopxrow
   \stopembeddedxtable
   \blank
\stopsetups


\startsetups [userdata:purecode]
  \blank
  \startframedtext 
[width=max,offset=1ex,corner=round,framecolor=black,rulethickness=0.5pt]

\typebuffer [userdata] [option=tex]
  \stopframedtext
  \blank
\stopsetups


\defineuserdata [example] [alternative=example]

\defineuserdataalternative [example] [renderingsetup=userdata:example]

\startsetups [userdata:example]
   \blank
   \startembeddedxtable 
[width=\textwidth,strut=no,offset=1ex,framecolor=black,rulethickness=0.5pt]
     \startxrow [corner=03,align=normal]
       \startxcell
         \typebuffer [userdata] [option=tex]
       \stopxcell
     \stopxrow
     \startxrow [corner=01,align=normal]
       \startxcell
         \getuserdata
       \stopxcell
     \stopxrow
   \stopembeddedxtable
   \blank
\stopsetups


\startsetups [userdata:example]
  \blank
  \startframedtext 
[width=max,offset=1ex,corner=03,framecolor=black,rulethickness=0.5pt,location=none]

\typebuffer [userdata] [option=tex]
  \stopframedtext
  \nointerlineskip
  \startframedtext 
[width=max,offset=1ex,corner=01,framecolor=black,rulethickness=0.5pt,location=none]

\getuserdata
  \stopframedtext
  \blank
\stopsetups

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

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

Re: [NTG-context] Problems with setups module

2018-11-26 Thread Wolfgang Schuster

Hi Tommaso,

I sent a fix to the dev list and the problem should be fixed in a new beta.

Wolfgang


Tommaso Gordini schrieb am 26.11.18 um 11:08:

Hi everyone.

The following code gives different results by commenting and 
decommending the indicated lines.


Could it be a problem with the setups module?

Thanks in advance
Tommy

\usemodule [setups]


\starttext


%\startbuffer

%\framed [width=3cm,height=1cm] {testo}

%\stopbuffer

%

%\typebuffer

%\getbuffer


\cmdfullsetup [setuppapersize]


\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] Problems with setups module

2018-11-26 Thread Tommaso Gordini
Sorry, the correct code is the following:

\usemodule [setups]


\starttext


\startbuffer

\framed [width=3cm,height=1cm] {testo}

\stopbuffer


\typebuffer

\getbuffer


\cmdfullsetup [setuppapersize]


\startbuffer[foo]

\framed [width=3cm,height=1cm] {testo}

\stopbuffer


\typebuffer[foo]

\getbuffer[foo]


\cmdfullsetup [setuppapersize]


\stoptext

Il giorno lun 26 nov 2018 alle ore 11:08 Tommaso Gordini <
illinguista1...@gmail.com> ha scritto:

> Hi everyone.
>
> The following code gives different results by commenting and decommending
> the indicated lines.
>
> Could it be a problem with the setups module?
>
> Thanks in advance
> Tommy
>
> \usemodule [setups]
>
>
> \starttext
>
>
> %\startbuffer
>
> %\framed [width=3cm,height=1cm] {testo}
>
> %\stopbuffer
>
> %
>
> %\typebuffer
>
> %\getbuffer
>
>
> \cmdfullsetup [setuppapersize]
>
>
> \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] Problems with setups module

2018-11-26 Thread Tommaso Gordini
Hi everyone.

The following code gives different results by commenting and decommending
the indicated lines.

Could it be a problem with the setups module?

Thanks in advance
Tommy

\usemodule [setups]


\starttext


%\startbuffer

%\framed [width=3cm,height=1cm] {testo}

%\stopbuffer

%

%\typebuffer

%\getbuffer


\cmdfullsetup [setuppapersize]


\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] Subformula numbering

2018-11-26 Thread luigi scarso
On Mon, Nov 26, 2018 at 8:40 AM adrien Licari 
wrote:

> Hi everyone,
>
> I can't get cases subformula to work properly. My MWE, inspired from the
> wiki and the My Way "Using \startalign and friends" by Aditya Mahajan, is :
>
> \starttext\placeformula\startformula
> \startcases
>   \NC x = a \NR[+]
>   \NC y = b \NR[+]
> \stopcases\stopformula\stoptext
>
> This only prints (2) on the right of the whole cases system. If I use
> \placesubformula, the behavior remains exactly the same. It also yields
> the same output with live ConTeXt. The ConTeXt version I am using is
> 2018.01.19 13:42
>
> Has there been a change in the behavior since the documents were written ?
> I asked on stackexchange, and since the document is 12 years old and the
> wiki consistent with it, they suggested me to ask the mailing list.
> Thanks in advance,
>
>
\starttext
\startbuffer
\placeformula \startformula \startcases
\NC 2 \NC $ y > 0 $ \NR
\NC 7 \NC $ x = 7 $ \NR[+]
\NC 4 \NC otherwise \NR
\stopcases \stopformula
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\placeformula \startformula x \startcases
\NC 2 \NC $ y > 0 $ \NR[+]
\NC 7 \NC $ x = 7 $ \NR
\NC 4 \NC otherwise \NR
\stopcases \stopformula
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\placeformula \startformula \startcases
\NC 2 \NC $ y > 0 $ \NR
\NC 7 \NC $ x = 7 $ \NR
\NC 4 \NC otherwise \NR
\stopcases \stopformula
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\placeformula \startformula x \startcases
\NC 2 \NC $ y > 0 $ \NR
\NC 7 \NC $ x = 7 $ \NR
\NC 4 \NC otherwise \NR
\stopcases \stopformula
\stopbuffer

\typebuffer \getbuffer

%% your example
\placeformula
\startformula
\startcases
  \NC x = a \NR[+]
  \NC y = b \NR[+]
\stopcases
\stopformula
\stoptext

What I see is (more or less)


   1



\placeformula \startformula \startcases
\NC 2 \NC $ y > 0 $ \NR
\NC 7 \NC $ x = 7 $ \NR[+]
\NC 4 \NC otherwise \NR
\stopcases \stopformula

 {2 푦 > 0
 ⎧
 ⎨ 7 푥=7(1)
 {
 ⎩ 4 otherwise
\placeformula \startformula x \startcases
\NC 2 \NC $ y > 0 $ \NR[+]
\NC 7 \NC $ x = 7 $ \NR
\NC 4 \NC otherwise \NR
\stopcases \stopformula

 {2 푦 > 0
 ⎧
푥⎨7 푥 = 7   (2)
 {
 ⎩ 4 otherwise
\placeformula \startformula \startcases
\NC 2 \NC $ y > 0 $ \NR
\NC 7 \NC $ x = 7 $ \NR
\NC 4 \NC otherwise \NR
\stopcases \stopformula

 {2 푦 > 0
 ⎧
 ⎨ 7 푥=7(3)
 {
 ⎩ 4 otherwise
\placeformula \startformula x \startcases
\NC 2 \NC $ y > 0 $ \NR
\NC 7 \NC $ x = 7 $ \NR
\NC 4 \NC otherwise \NR
\stopcases \stopformula

 {2 푦 > 0
 ⎧
푥⎨7 푥 = 7   (4)
 {
 ⎩ 4 otherwise
  푥=푎
  { (6)
  푦=푏




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

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

Re: [NTG-context] Which commands to use to show setups?

2018-11-25 Thread Wolfgang Schuster

Hi Tommaso,

\startttyping is a generated command (\definetyping[typing]) and to show
the command with \showdefinition you have to use

    \showdefinition [starttyping:instance:typing]

or

\showdefinition [starttyping:instance:argument:typing]


A complete list with all arguments can be found in setup-mapping-en.pdf.


The output of \definition is wrong because there is a wrong check for 
the number

of arguments for the command (because you can pass a list of commands).

The \showdefinition command needs also a small change because when you
use a instance (e.g. \showdefinition [starttyping:instance:typing]) the 
caption

shows the passed argument (e.g. Definition 1 \starttyping:instance:typing)
and not the correct command (e.g. Definition 1 \starttyping).


Wolfgang



Tommaso Gordini schrieb am 25.11.18 um 09:03:

Hi Wolfgang,

thank you very much for your code, which works very well.
I still have a few doubts about one thing: is it possible that the 
commands you suggested to me do not work with all ConTeXt commands?


For example, if I write

\usemodule [setups]

\starttext

\showdefinition [starttyping]

\stoptext

I get in the PDF

missing: starttyping

It's correct?

The second question concerns the \definition command.
As you can see in the attached PDF, a «and 1» appears below the 
definition. It's correct?


Thank you in advance

Il giorno sab 24 nov 2018 alle ore 12:29 Wolfgang Schuster 
<mailto:wolfgang.schuster.li...@gmail.com>> ha scritto:




Tommaso Gordini schrieb am 24.11.18 um 11:45:
> Hello, list.
>
> In my ConTeXt guide, I need to show the syntax of ConTeXt commands.
>
> Below I paste a MWE showing the different possible commands, but
I do
> not know if there are others.
> I see, however, that the result is different depending on the
command
> used.
>
> Do you have any advice to give to me? Which of the commands in the
> code should I use in a guide? Or better: do they have to be used
> according to needs?
>
> Are there other commands of this kind?

\usemodule[setups]

\starttext

When you describe a command, e.g.
\type{\startdescription{\cmdbasicsetup[...]} ... \stopdescription}:

\startbuffer [basicsetup]
\cmdbasicsetup [startxtable]
\stopbuffer

\typebuffer [basicsetup]
\getbuffer  [basicsetup]

When you show the syntax of a command without the options:

\startbuffer [shortsetup]
\cmdshortsetup [startxtable]
\stopbuffer

\typebuffer [shortsetup]
\getbuffer  [shortsetup]

When you show the syntax of a command with the options:

\startbuffer [fullsetup]
    \cmdfullsetup [startxtable]
\stopbuffer

\typebuffer [fullsetup]
\getbuffer  [fullsetup]

When you want to show the name of a command (similar to \tex{type}):

\startbuffer [internal]
    \cmdinternal {startxtable}
\stopbuffer

\typebuffer [internal]
\getbuffer  [internal]

When you want to show the syntax of a command as a float:

\startbuffer [showdefinition]
\showdefinition [startxtable]
\stopbuffer

\typebuffer [showdefinition]
\getbuffer  [showdefinition]

When you want to refer to the definition:

\startbuffer [definition]
\definition [startxtable]
%\definition [startxtable,startembeddedxtable]
\stopbuffer

\typebuffer [definition]
\getbuffer  [definition]

\page

When you have a generated command (e.g. \tex {placefigure}):

\startbuffer [instance]
\cmdbasicsetupinstance {placefloat} {figure}
\cmdshortsetupinstance {placefloat} {figure}
\cmdfullsetupinstance  {placefloat} {figure}
\stopbuffer

\typebuffer [instance]
\getbuffer  [instance]

\stoptext


Wolfgang



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

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

Re: [NTG-context] Which commands to use to show setups?

2018-11-25 Thread Tommaso Gordini
Hi Wolfgang,

thank you very much for your code, which works very well.
I still have a few doubts about one thing: is it possible that the commands
you suggested to me do not work with all ConTeXt commands?

For example, if I write

\usemodule [setups]

\starttext

\showdefinition [starttyping]

\stoptext

I get in the PDF

missing: starttyping

It's correct?

The second question concerns the \definition command.
As you can see in the attached PDF, a «and 1» appears below the definition.
It's correct?

Thank you in advance

Il giorno sab 24 nov 2018 alle ore 12:29 Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> ha scritto:

>
>
> Tommaso Gordini schrieb am 24.11.18 um 11:45:
> > Hello, list.
> >
> > In my ConTeXt guide, I need to show the syntax of ConTeXt commands.
> >
> > Below I paste a MWE showing the different possible commands, but I do
> > not know if there are others.
> > I see, however, that the result is different depending on the command
> > used.
> >
> > Do you have any advice to give to me? Which of the commands in the
> > code should I use in a guide? Or better: do they have to be used
> > according to needs?
> >
> > Are there other commands of this kind?
>
> \usemodule[setups]
>
> \starttext
>
> When you describe a command, e.g.
> \type{\startdescription{\cmdbasicsetup[...]} ... \stopdescription}:
>
> \startbuffer [basicsetup]
> \cmdbasicsetup [startxtable]
> \stopbuffer
>
> \typebuffer [basicsetup]
> \getbuffer  [basicsetup]
>
> When you show the syntax of a command without the options:
>
> \startbuffer [shortsetup]
> \cmdshortsetup [startxtable]
> \stopbuffer
>
> \typebuffer [shortsetup]
> \getbuffer  [shortsetup]
>
> When you show the syntax of a command with the options:
>
> \startbuffer [fullsetup]
> \cmdfullsetup [startxtable]
> \stopbuffer
>
> \typebuffer [fullsetup]
> \getbuffer  [fullsetup]
>
> When you want to show the name of a command (similar to \tex{type}):
>
> \startbuffer [internal]
> \cmdinternal {startxtable}
> \stopbuffer
>
> \typebuffer [internal]
> \getbuffer  [internal]
>
> When you want to show the syntax of a command as a float:
>
> \startbuffer [showdefinition]
> \showdefinition [startxtable]
> \stopbuffer
>
> \typebuffer [showdefinition]
> \getbuffer  [showdefinition]
>
> When you want to refer to the definition:
>
> \startbuffer [definition]
> \definition [startxtable]
> %\definition [startxtable,startembeddedxtable]
> \stopbuffer
>
> \typebuffer [definition]
> \getbuffer  [definition]
>
> \page
>
> When you have a generated command (e.g. \tex {placefigure}):
>
> \startbuffer [instance]
> \cmdbasicsetupinstance {placefloat} {figure}
> \cmdshortsetupinstance {placefloat} {figure}
> \cmdfullsetupinstance  {placefloat} {figure}
> \stopbuffer
>
> \typebuffer [instance]
> \getbuffer  [instance]
>
> \stoptext
>
>
> Wolfgang
>


setups-1.tex
Description: TeX document


setups-1.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] Which commands to use to show setups?

2018-11-24 Thread Wolfgang Schuster



Tommaso Gordini schrieb am 24.11.18 um 11:45:

Hello, list.

In my ConTeXt guide, I need to show the syntax of ConTeXt commands.

Below I paste a MWE showing the different possible commands, but I do 
not know if there are others.
I see, however, that the result is different depending on the command 
used.


Do you have any advice to give to me? Which of the commands in the 
code should I use in a guide? Or better: do they have to be used 
according to needs?


Are there other commands of this kind?


\usemodule[setups]

\starttext

When you describe a command, e.g. 
\type{\startdescription{\cmdbasicsetup[...]} ... \stopdescription}:


\startbuffer [basicsetup]
\cmdbasicsetup [startxtable]
\stopbuffer

\typebuffer [basicsetup]
\getbuffer  [basicsetup]

When you show the syntax of a command without the options:

\startbuffer [shortsetup]
\cmdshortsetup [startxtable]
\stopbuffer

\typebuffer [shortsetup]
\getbuffer  [shortsetup]

When you show the syntax of a command with the options:

\startbuffer [fullsetup]
\cmdfullsetup [startxtable]
\stopbuffer

\typebuffer [fullsetup]
\getbuffer  [fullsetup]

When you want to show the name of a command (similar to \tex{type}):

\startbuffer [internal]
\cmdinternal {startxtable}
\stopbuffer

\typebuffer [internal]
\getbuffer  [internal]

When you want to show the syntax of a command as a float:

\startbuffer [showdefinition]
\showdefinition [startxtable]
\stopbuffer

\typebuffer [showdefinition]
\getbuffer  [showdefinition]

When you want to refer to the definition:

\startbuffer [definition]
\definition [startxtable]
%\definition [startxtable,startembeddedxtable]
\stopbuffer

\typebuffer [definition]
\getbuffer  [definition]

\page

When you have a generated command (e.g. \tex {placefigure}):

\startbuffer [instance]
\cmdbasicsetupinstance {placefloat} {figure}
\cmdshortsetupinstance {placefloat} {figure}
\cmdfullsetupinstance  {placefloat} {figure}
\stopbuffer

\typebuffer [instance]
\getbuffer  [instance]

\stoptext


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

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

Re: [NTG-context] A ConTeXt Guide in Italian

2018-11-21 Thread Wolfgang Schuster


Tommaso Gordini schrieb am 21.11.18 um 22:30:

Hello everyone!
This is my first message here.

I'm trying to write a ConTeXt guide in Italian.

The LaTeX *tcolorbox* package defines an environment dedicated to 
LaTeX examples: above (or on the left) the source is written, and 
below (or on the right) the typeset result.


Is there something similar for ConTeXt? Does it make sense, in your 
opinion, to showing examples of source code with the related outputs 
in this way?


There is no environment which produces the same output as the mentioned 
package

you can use buffers for your examples in the document.


\starttext

\startbuffer
\startframedtext
\samplefile{klein}
\stopframedtext
\stopbuffer

\typebuffer[option=tex]

\getbuffer

\stoptext


You can use this to write your own environment for the examples (or use 
the userdata

environment when you’re lazy :)


\defineuserdata [example] [alternative=example]

\defineuserdataalternative [example] [renderingsetup=userdata:example]

\startsetups [userdata:example]
  \startembeddedxtable 
[width=\textwidth,strut=no,offset=1ex,framecolor=red]

    \startxrow [corner=03]
  \startxcell
    \typebuffer [userdata] [option=tex]
  \stopxcell
    \stopxrow
    \startxrow [corner=01]
  \startxcell
    \getuserdata
  \stopxcell
    \stopxrow
  \stopembeddedxtable
\stopsetups

\starttext

\startuserdata [example]
\startframedtext
\samplefile{klein}
\stopframedtext
\stopuserdata

\stoptext


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

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

Re: [NTG-context] Including part of a program source file

2018-04-21 Thread Alan Braslau
Can't one also use matching strings in the range={,}, 
(with the command \typefile)?

Alan

On Sat, 21 Apr 2018 17:29:58 +0200
Wolfgang Schuster <schuster.wolfg...@gmail.com> wrote:

> The verbatim commands have a range key which let you select parts of
> the code,
> you can use line numbers to include a small block (e.g. range={3,10}
> or range {3,+7})
> or you put labels in your code.
> 
> \startbuffer
> % cmd:one:begin
> \define\FirstCommand
>{\dosingleempty\doFirstCommand}
> 
> \def\doFirstCommand[#1]%
>{This is the definition for the first command}
> % cmd:one:end
> 
> % cmd:two:begin
> \define\SecondCommand
>{\dosingleempty\doSecondCommand}
> 
> \def\doSecondCommand[#1]%
>{This is the definition for the second command}
> % cmd:two:end
> \stopbuffer
> 
> \starttext
> \typebuffer[range={cmd:two:begin,cmd:two:end}]
> \stoptext
> 
> Wolfgang
> > N. Raghavendra <mailto:nyraghu27...@gmail.com>
> > 21. April 2018 um 16:00
> > I am writing some notes using ConTeXt, which involves displaying
> > parts of some program source files. At present, I am manually
> > cutting and pasting the parts into the ConTeXt file. Is it possible
> > to make ConTeXt do that for me? I am thinking of including each
> > part of the Coq sources between tags like this:
> >
> > 
> > $ cat src-file
> > 
> > part_to_be_included_1
> > 
> >
> > 
> > part_to_be_included_2
> > 
> > 
> >
> > I would like to say something like
> >
> > \IncludePart{src-file}{tag-1}
> >
> > in my ConTeXt file to get
> >
> > part_to_be_included_1
> >
> > at that place in the PDF output after I run `context'. I would
> > appreciate any advice on how to go about this.
> >
> > Thanks,
> > Raghu.
> >
> > --
> > N. Raghavendra <ra...@hri.res.in>, http://www.retrotexts.net/
> > Harish-Chandra Research Institute, http://www.hri.res.in/
> > ___
> > 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] Including part of a program source file

2018-04-21 Thread Wolfgang Schuster
The verbatim commands have a range key which let you select parts of the 
code,
you can use line numbers to include a small block (e.g. range={3,10} or 
range {3,+7})

or you put labels in your code.

\startbuffer
% cmd:one:begin
\define\FirstCommand
  {\dosingleempty\doFirstCommand}

\def\doFirstCommand[#1]%
  {This is the definition for the first command}
% cmd:one:end

% cmd:two:begin
\define\SecondCommand
  {\dosingleempty\doSecondCommand}

\def\doSecondCommand[#1]%
  {This is the definition for the second command}
% cmd:two:end
\stopbuffer

\starttext
\typebuffer[range={cmd:two:begin,cmd:two:end}]
\stoptext

Wolfgang

N. Raghavendra <mailto:nyraghu27...@gmail.com>
21. April 2018 um 16:00
I am writing some notes using ConTeXt, which involves displaying parts
of some program source files. At present, I am manually cutting and
pasting the parts into the ConTeXt file. Is it possible to make ConTeXt
do that for me? I am thinking of including each part of the Coq sources
between tags like this:


$ cat src-file

part_to_be_included_1



part_to_be_included_2



I would like to say something like

\IncludePart{src-file}{tag-1}

in my ConTeXt file to get

part_to_be_included_1

at that place in the PDF output after I run `context'. I would
appreciate any advice on how to go about this.

Thanks,
Raghu.

--
N. Raghavendra <ra...@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/
___
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] Problem with Filter Module in latent context beta

2018-04-17 Thread Aditya Mahajan

On Tue, 17 Apr 2018, Aditya Mahajan wrote:


On Tue, 17 Apr 2018, Hans Hagen wrote:


On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, 
except for one final bug: leading spaces are stripped from the buffer.


\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


\samplefile{ward}
\startnarrower
   \samplefile{ward}
   \startbuffer[test]
   Leading spaces
 And some more
   \stopbuffer
   \typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
   Leading spaces
   And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs


Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
 {\buff_pickup
   {Aditya}%
   {StartAditya}%
   {StopAditya}%
   {}%
   {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
   \zerocount}


This is perfect as I am already using `\grabbufferdata` in my code. I can 
easily adapt it to use `\buff_pickup` instead. Thanks!.


Does what you want but of course it's sort of ugly for a module to do that. 
What we can do is this which is still ugly but picking up verbatim is 
always ugly:


\def\buff_start_indeed#1#2#3#4%
 {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%

\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect


I want this to be configurable at runtime and the vim module already has code 
that enables `strip=yes` and `strip=no` options (I do this via a function in 
vim so that it works with both mkii and mkiv; although I don't think that 
anyone uses the mkii module any longer).


I added `strip=yes` option to the filter module, which is now the default 
option. See "Stripping leading whitespace" in the module documentation 
(https://github.com/adityam/filter). This is a MkIV only feature and I 
will not implement it in MkII.


I also made `strip=yes` to be the default in t-vim (to be consistent with 
t-filter). In t-vim, the `strip` option works with both mkii and mkiv.


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

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

Re: [NTG-context] Problem with Filter Module in latent context beta

2018-04-17 Thread Aditya Mahajan

On Tue, 17 Apr 2018, Hans Hagen wrote:


On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, 
except for one final bug: leading spaces are stripped from the buffer.


\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


\samplefile{ward}
\startnarrower
   \samplefile{ward}
   \startbuffer[test]
   Leading spaces
 And some more
   \stopbuffer
   \typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
   Leading spaces
   And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs


Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
 {\buff_pickup
   {Aditya}%
   {StartAditya}%
   {StopAditya}%
   {}%
   {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
   \zerocount}


This is perfect as I am already using `\grabbufferdata` in my code. I can 
easily adapt it to use `\buff_pickup` instead. Thanks!.


Does what you want but of course it's sort of ugly for a module to do that. 
What we can do is this which is still ugly but picking up verbatim is 
always ugly:


\def\buff_start_indeed#1#2#3#4%
 {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%

\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect


I want this to be configurable at runtime and the vim module already has 
code that enables `strip=yes` and `strip=no` options (I do this via a 
function in vim so that it works with both mkii and mkiv; although I don't 
think that anyone uses the mkii module any longer).


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

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

Re: [NTG-context] Problem with Filter Module in latent context beta

2018-04-17 Thread Hans Hagen

On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, 
except for one final bug: leading spaces are stripped from the buffer.


\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).


\samplefile{ward}
\startnarrower
\samplefile{ward}
\startbuffer[test]
Leading spaces
  And some more
\stopbuffer
\typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
Leading spaces
And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs


Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
  {\buff_pickup
{Aditya}%
{StartAditya}%
{StopAditya}%
{}%
{\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
\zerocount}

\unexpanded\def\StopAditya
  {}

\protect

\StartAditya
Leading spaces
And some more
\StopAditya

(1)

\typebuffer[Aditya]

(2)

\typefile{test-temp.tmp}

Does what you want but of course it's sort of ugly for a module to do 
that. What we can do is this which is still ugly but picking up verbatim 
is always ugly:


\unprotect

\def\buff_start_indeed#1#2#3#4%
  {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%

\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect

\definebuffer[Aditya][strip=no]

\startAditya
Leading spaces
And some more
And even more
\stopAditya

\typeAditya

But then we need Wolfgang to double check if this extension has side 
effects elsewhere.


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] \basegrid ignores color

2018-03-22 Thread Henri Menke
Bump!

I attached the updated core file to make it easier for you.

On Wed, 2018-03-21 at 09:51 +1300, Henri Menke wrote:
> Dear devs,
> 
> The \basegrid macro ignores its color option.  That's kind of obvious because
> as
> I look at the code I don't see the color being communicated to Metapost at any
> point.  When you're at it, could you please also add a rulethickness
> parameters?
>  Thanks!
> 
> Reproducible in TL2018 pertest and latest beta.  MWE is below (as always).
> 
> Cheers, Henri
> 
> ---
> 
> \starttext
> 
> \basegrid[color=red]
> 
> \color[red]{\basegrid}
> 
> \stoptext
> %D \module
%D   [   file=meta-grd,
%Dversion=2012.06.28,
%D  title=\METAPOST\ Graphics,
%D   subtitle=grids,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{MetaPost Graphics / Grids}

%D This used to be a \TEX\ method, and a rather old one too. We keep it around but
%D in a more modern way.
%D
%D \startbuffer
%D \basegrid
%D   [nx=8,ny=5,
%Ddx=.5,dy=.25,
%Dunit=cm,scale=2,factor=1,
%Doffset=1ex,xstep=2,ystep=1,
%Dalign=middle,style=\tt\tx]
%D \stopbuffer
%D
%D \typebuffer
%D
%D \placefigure
%D   {An example of a grid.}
%D   {\getbuffer}

\startuseMPgraphic{grid}{nx,ny,dx,dy,factor,scale,xstep,ystep,xoffset,yoffset,align,rulecolor,rulethickness}
begingroup ;

save nx, ny, dx, dy, wd, ht, xstep, ystep, xoffset, yoffset, align, xalign, yalign, rulecolor, rulethickness ;

numeric nx  ; nx  := \MPvar{nx} ;
numeric ny  ; ny  := \MPvar{ny} ;
numeric dx  ; dx  := \MPvar{factor} * \MPvar{scale} * \MPvar{dx} ;
numeric dy  ; dy  := \MPvar{factor} * \MPvar{scale} * \MPvar{dy} ;
numeric wd  ; wd  := nx * dx ;
numeric ht  ; ht  := ny * dy ;
numeric xstep   ; xstep   := \MPvar{xstep} ;
numeric ystep   ; ystep   := \MPvar{ystep} ;
numeric xoffset ; xoffset := \MPvar{xoffset} ;
numeric yoffset ; yoffset := \MPvar{yoffset} ;
numeric align   ; align   := \MPvar{align} ;
color rulecolor ; rulecolor := \MPvar{rulecolor} ;
numeric rulethickness ; rulethickness := \MPvar{rulethickness} ;
numeric xalign  ; xalign  := 0 ;
numeric yalign  ; yalign  := 0 ;

if align = 1 :
xalign := dx/2 ;
yalign := dy/2 ;
fi ;

for i=0 step dx until wd :
draw (i,0) -- (i,ht)
withpen pencircle scaled rulethickness
withcolor rulecolor ;
endfor ;
for i=0 step dy until ht :
draw (0,i) -- (wd,i)
withpen pencircle scaled rulethickness
withcolor rulecolor ;
endfor ;

if xstep > 0 :
for i=1 step xstep until nx :
draw thetextext.bot(decimal i,(i*dx-xalign,-xoffset));
endfor ;
fi ;
if ystep > 0 :
for i=1 step ystep until ny :
draw thetextext.lft(decimal i,(-yoffset,i*dy-yalign)) ;
endfor ;
fi ;

endgroup ;
\stopuseMPgraphic

\unprotect

\unexpanded\def\basegrid
  {\dosingleempty\typo_grid_base}

\def\typo_grid_base[#1]%
  {\hbox\bgroup
   \getdummyparameters
 [\c!nx=10,\c!ny=10,\c!dx=.5,\c!dy=.5,\c!xstep=0,\c!ystep=0,
  \c!unit=\s!cm,\c!scale=1,\c!factor=1,
  \c!offset=.25ex,\c!xoffset=\directdummyparameter\c!offset,\c!yoffset=\directdummyparameter\c!offset,
  \c!align=,
  \c!rulecolor=\s!black,
  \c!rulethickness=\linewidth,
  #1]%
   \usedummystyleandcolor\c!style\c!color
   \edef\p_align{\directdummyparameter\c!align}%
   \ifx\p_align\v!middle
  \let\p_align\!!plusone
   \else
  \let\p_align\!!zerocount
   \fi
   \useMPgraphic
{grid}%
{nx=\directdummyparameter\c!nx,%
 ny=\directdummyparameter\c!ny,%
 dx=\directdummyparameter\c!dx\directdummyparameter\c!unit,%
 dy=\directdummyparameter\c!dy\directdummyparameter\c!unit,%
 factor=\directdummyparameter\c!factor,%
 scale=\directdummyparameter\c!scale,%
 xstep=\directdummyparameter\c!xstep,%
 ystep=\directdummyparameter\c!ystep,%
 xoffset=\directdummyparameter\c!xoffset,%
 yoffset=\directdummyparameter\c!yoffset,%
 align=\p_align,%
 rulecolor=\directdummyparameter\c!rulecolor,%
 rulethickness=\directdummyparameter\c!rulethickness,%
}%
  \egroup}

\let\grid\basegrid

\protect \endinput
\loadmarkfile{meta-grd}
\starttext
\basegrid[rulecolor=gray,rulethickness=.1pt]
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Aditya Mahajan

On Thu, 21 Dec 2017, Pablo Rodriguez wrote:


On 12/21/2017 08:05 PM, Aditya Mahajan wrote:

On Thu, 21 Dec 2017, Pablo Rodriguez wrote:

[...]
I don’t remember which were the options in t-vim,  but I need the
options from \setuptyping and \setuptype.


Currently vim does not support these primarily because I don't use XML so 
I never thought of this.


Could you send me a minimal example showing how \xmlprettyprinttext is 
used and I can check how to create an interface for t-vim.


Aditya,

many thanks for your help.

The goodie (as per lxml-ini.mkiv) reads as follow:

   \def\xmltempbuffername{xml-temp}

   \unexpanded\def\prettyprintbuffer#1#2% only used here
 {\ifdefined\scitebuffer
\scitebuffer[#2][#1]%
  \else
\typebuffer[#1][\c!option=#2]%
  \fi}

   %~ \unexpanded\def\xmlprettyprint#1#2%
 %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
  %~ \prettyprintbuffer\xmltempbuffername{#2}}

   \unexpanded\def\xmlprettyprinttext#1#2%
 {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
  \prettyprintbuffer\xmltempbuffername{#2}}

   \unexpanded\def\inlineprettyprintbuffer#1#2% only used here
 {\ifdefined\sciteinlinebuffer
\sciteinlinebuffer[#2][#1]%
  \else
\typeinlinebuffer[#1][\c!option=#2]%
  \fi}

   %~ \unexpanded\def\xmlinlineprettyprint#1#2%
 %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
  %~ \inlineprettyprintbuffer\xmltempbuffername{#2}}

   \unexpanded\def\xmlinlineprettyprinttext#1#2%
 {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
  \inlineprettyprintbuffer\xmltempbuffername{#2}}

\xmltobuffertextonly is required to clean HTML hightlighted code, such
as in https://shorturl.at/pS124.

This is why only adapting both \xmlprettyprinttext and
\xmlinlineprettyprint gets the fuctionality for the other two commands.

The commands are invoked in this way:

   \xmlinlineprettyprinttext{#1}{tex}

   \xmlprettyprinttext{#1}{lua}

Maybe adapting \prettyprintbuffer and \inlineprettyprintbuffer to the
t-vim module works fine. (But this code is all Greek to me.)

Many thanks for your help again,


Can you post a minimal working example. I don't use XML so it is difficult 
for me to understand how these commands are used in practice.


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

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

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Pablo Rodriguez
On 12/21/2017 08:05 PM, Aditya Mahajan wrote:
> On Thu, 21 Dec 2017, Pablo Rodriguez wrote:
>> [...]
>> I don’t remember which were the options in t-vim,  but I need the
>> options from \setuptyping and \setuptype.
> 
> Currently vim does not support these primarily because I don't use XML so 
> I never thought of this.
> 
> Could you send me a minimal example showing how \xmlprettyprinttext is 
> used and I can check how to create an interface for t-vim.

Aditya,

many thanks for your help.

The goodie (as per lxml-ini.mkiv) reads as follow:

\def\xmltempbuffername{xml-temp}

\unexpanded\def\prettyprintbuffer#1#2% only used here
  {\ifdefined\scitebuffer
 \scitebuffer[#2][#1]%
   \else
 \typebuffer[#1][\c!option=#2]%
   \fi}

%~ \unexpanded\def\xmlprettyprint#1#2%
  %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
   %~ \prettyprintbuffer\xmltempbuffername{#2}}

\unexpanded\def\xmlprettyprinttext#1#2%
  {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
   \prettyprintbuffer\xmltempbuffername{#2}}

\unexpanded\def\inlineprettyprintbuffer#1#2% only used here
  {\ifdefined\sciteinlinebuffer
 \sciteinlinebuffer[#2][#1]%
   \else
 \typeinlinebuffer[#1][\c!option=#2]%
   \fi}

%~ \unexpanded\def\xmlinlineprettyprint#1#2%
  %~ {\xmltobufferverbose{#1}{.}{\xmltempbuffername}%
   %~ \inlineprettyprintbuffer\xmltempbuffername{#2}}

\unexpanded\def\xmlinlineprettyprinttext#1#2%
  {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}%
   \inlineprettyprintbuffer\xmltempbuffername{#2}}

\xmltobuffertextonly is required to clean HTML hightlighted code, such
as in https://shorturl.at/pS124.

This is why only adapting both \xmlprettyprinttext and
\xmlinlineprettyprint gets the fuctionality for the other two commands.

The commands are invoked in this way:

\xmlinlineprettyprinttext{#1}{tex}

\xmlprettyprinttext{#1}{lua}

Maybe adapting \prettyprintbuffer and \inlineprettyprintbuffer to the
t-vim module works fine. (But this code is all Greek to me.)

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] issues with \scitebuffer and \sciteinlinebuffer

2017-09-05 Thread Hans Hagen

On 9/5/2017 6:33 PM, Pablo Rodriguez wrote:

Hans,

after updating to latest beta (from 2017.09.05 15:10) to enjoy the new
none method in the scite buffers, I have the following sample:

 \setupindenting[yes, always, big]
 \usemodule[scite]
 \setuptyping[margin=2cm]
 \startbuffer[typebuffer]
 | \ConTeXt\ \ConteXt \par
 \stopbuffer
 \starttext
 \scitebuffer[typebuffer]

 \scitebuffer[none][typebuffer]

 \letterbar a \sciteinlinebuffer[typebuffer]. b
 \stoptext

And I’m experiencing the following issues:

1. "|" breaks compilation when method is set to "none".


i'll look at it later


2. "\sciteinlinebuffer" adds always an extra blank space after it.

3. Method "none" treats spaces as linebreaks and removes "\".

4. \setuptyping and \setuptype don’t work with the scite buffers.
well, it's a different (basically unrelated) mechanism that kicks in ... 
one can't have it all


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
___

[NTG-context] issues with \scitebuffer and \sciteinlinebuffer

2017-09-05 Thread Pablo Rodriguez
Hans,

after updating to latest beta (from 2017.09.05 15:10) to enjoy the new
none method in the scite buffers, I have the following sample:

\setupindenting[yes, always, big]
\usemodule[scite]
\setuptyping[margin=2cm]
\startbuffer[typebuffer]
| \ConTeXt\ \ConteXt \par
\stopbuffer
\starttext
\scitebuffer[typebuffer]

\scitebuffer[none][typebuffer]

\letterbar a \sciteinlinebuffer[typebuffer]. b
\stoptext

And I’m experiencing the following issues:

1. "|" breaks compilation when method is set to "none".

2. "\sciteinlinebuffer" adds always an extra blank space after it.

3. Method "none" treats spaces as linebreaks and removes "\".

4. \setuptyping and \setuptype don’t work with the scite buffers.

What am I doing wrong?

Many thanks for your help,

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] source code and result side by side

2017-08-04 Thread Henning Hraban Ramm
Am 2017-08-04 um 06:30 schrieb Henri Menke <henrime...@gmail.com>:

> On 08/04/2017 07:46 AM, Henning Hraban Ramm wrote:
>> Am 2017-07-31 um 03:26 schrieb Aditya Mahajan <adit...@umich.edu>:
>> 
>>> You can't do that with buffers. If you need to define your own macros that 
>>> behave like buffers, you need to use \grabbufferdata (see buff-ini.mkiv). 
>>> But in this case, there is a simpler solution:
>>> 
>>> \defineframed
>>> [CodeExampleFramed]
>>> [
>>>   frame=off,
>>>   width=0.5\textwidth,
>>>   align=normal,
>>> ]
>>> 
>>> \definebuffer
>>>   [CodeExample]
>>> 
>>> \define\stopCodeExample
>>>   {\placesidebyside
>>> {\CodeExampleFramed{\typeCodeExample}}
>>> {\CodeExampleFramed{\getCodeExample}}}
>> 
>> Oh, I overlooked something:
>> Can I get pretty printing back, like in \startTEX ... \stopTEX?
>> 
>> I couldn’t find any suitable setup options.
> 
> \typebuffer[whatever][option=tex]

\typebuffer[CodeExample][option=tex] doesn’t do anything,
but \typeCodeExample[option=tex] actually works, I didn’t expect that.
Thank you!


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
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
___

Re: [NTG-context] (again) \typebufferinline for XML inline code

2017-08-02 Thread Hans Hagen

On 8/1/2017 9:12 PM, Pablo Rodriguez wrote:

On 08/01/2017 04:27 PM, Hans Hagen wrote:

On 7/31/2017 7:16 PM, Pablo Rodriguez wrote:

[...]
Would it be possible to have a new \typebufferinline that behaves such
as \type above (and has the same options in \setuptype)?

The most important part isn’t the suppression of line breaks inside, but
avoiding the addition of line breaks after and before the typed buffer.

I have been reading buff-ver.mkiv, but I’m afraid I cannot contribute
such a patch.

This is essential to have \xmlprettyprintinline and
\xmlprettyprintinlinetext in order to handle inline code in XML.


\startbuffer[foo]
foo \bar{crap}
\stopbuffer

\starttext
  \typebuffer[foo]
\stoptext


Many thanks for your reply, Hans.

I’m afraid this isn’t what I was looking for.


i'll make \xmlinlineprettyprinttext but there is where this madness stops


As shown in the following sample, I need \xmlprettyprinttext for code
inside a paragraph, not building its own paragraph.

 \startbuffer[demo]
 
 I can use colored code blocks:
 \starttext
 \ConTeXt\ is awesome!
 \stoptext
 But I’m afraid I cannot use \xmlprettyprinttext inline.
 
 \stopbuffer

 \startxmlsetups xml:initialize
  \xmlsetsetup{#1}{doc|p|code}{xml:*}
  \xmlsetsetup{#1}{pre/code}{xml:pre:code}
 \stopxmlsetups

 \xmlregistersetup{xml:initialize}

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

 \startxmlsetups xml:p
  \startpar\xmlflush{#1}\stoppar
 \stopxmlsetups

 \startxmlsetups xml:pre:code
  \xmlprettyprinttext{#1}{tex}
 \stopxmlsetups

 \startxmlsetups xml:code
 \begingroup\xmlprettyprinttext{#1}{tex}\endgroup
 \stopxmlsetups

 \starttext

 \subject{Dealing with XML}

  \xmlprocessbuffer{main}{demo}{}

 \subject{In standard \ConTeXt}

 \setuptyping[option=TEX]
 \setuptype[option=TEX]

 I can use colored code blocks:

 \starttyping
 \starttext
 \ConTeXt\ is awesome!
 \stoptext
 \stoptyping

 But I'm afraid I cannot use \type{\xmlprettyprinttext} inline.
 \stoptext

Many thanks for your help,

Pablo




--

-
  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] (again) \typebufferinline for XML inline code

2017-08-01 Thread Pablo Rodriguez
On 08/01/2017 04:27 PM, Hans Hagen wrote:
> On 7/31/2017 7:16 PM, Pablo Rodriguez wrote:
>> [...]
>> Would it be possible to have a new \typebufferinline that behaves such
>> as \type above (and has the same options in \setuptype)?
>>
>> The most important part isn’t the suppression of line breaks inside, but
>> avoiding the addition of line breaks after and before the typed buffer.
>>
>> I have been reading buff-ver.mkiv, but I’m afraid I cannot contribute
>> such a patch.
>>
>> This is essential to have \xmlprettyprintinline and
>> \xmlprettyprintinlinetext in order to handle inline code in XML.
> 
> \startbuffer[foo]
> foo \bar{crap}
> \stopbuffer
> 
> \starttext
>  \typebuffer[foo]
> \stoptext

Many thanks for your reply, Hans.

I’m afraid this isn’t what I was looking for.

As shown in the following sample, I need \xmlprettyprinttext for code
inside a paragraph, not building its own paragraph.

\startbuffer[demo]

I can use colored code blocks:
\starttext
\ConTeXt\ is awesome!
\stoptext
But I’m afraid I cannot use \xmlprettyprinttext inline.

\stopbuffer

\startxmlsetups xml:initialize
 \xmlsetsetup{#1}{doc|p|code}{xml:*}
 \xmlsetsetup{#1}{pre/code}{xml:pre:code}
\stopxmlsetups

\xmlregistersetup{xml:initialize}

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

\startxmlsetups xml:p
 \startpar\xmlflush{#1}\stoppar
\stopxmlsetups

\startxmlsetups xml:pre:code
 \xmlprettyprinttext{#1}{tex}
\stopxmlsetups

\startxmlsetups xml:code
\begingroup\xmlprettyprinttext{#1}{tex}\endgroup
\stopxmlsetups

\starttext

\subject{Dealing with XML}

 \xmlprocessbuffer{main}{demo}{}

\subject{In standard \ConTeXt}

\setuptyping[option=TEX]
\setuptype[option=TEX]

I can use colored code blocks:

\starttyping
\starttext
\ConTeXt\ is awesome!
\stoptext
\stoptyping

But I'm afraid I cannot use \type{\xmlprettyprinttext} inline.
\stoptext

Many thanks for your help,

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] (again) \typebufferinline for XML inline code

2017-08-01 Thread Hans Hagen

On 7/31/2017 7:16 PM, Pablo Rodriguez wrote:

Hans,

sorry for asking for this again, but I really need it to write some
documents about ConTeXt.

I have the following sample:

 \startTEXpage[offset=1em]
 only \type{a

 b

 c} one line
 \stopTEXpage
 \stoptext

\type

Would it be possible to have a new \typebufferinline that behaves such
as \type above (and has the same options in \setuptype)?

The most important part isn’t the suppression of line breaks inside, but
avoiding the addition of line breaks after and before the typed buffer.

I have been reading buff-ver.mkiv, but I’m afraid I cannot contribute
such a patch.

This is essential to have \xmlprettyprintinline and
\xmlprettyprintinlinetext in order to handle inline code in XML.


\startbuffer[foo]
foo \bar{crap}
\stopbuffer

\starttext
\typebuffer[foo]
\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
___

Re: [NTG-context] source code and result side by side

2017-07-30 Thread Aditya Mahajan

On Sun, 30 Jul 2017, Henning Hraban Ramm wrote:


Am 2017-07-29 um 00:57 schrieb Aditya Mahajan <adit...@umich.edu>:


On Fri, 28 Jul 2017, Henning Hraban Ramm wrote:


Ahoi again,

I’m preparing some ConTeXt docs with a lot of examples and would like to 
reproduce what we have in the wiki as


...


i.e. sourcecode beside the result.

Often the shown source is exactly what I want to show, in other cases I need 
some additional setup that I don’t want to show.

Which approach would you suggest? Combinations?


\startbuffer[example-1]

\stopbuffer


\placesidebyside
   {\typebuffer[example-1]}
   {\getbuffer[setups, example-1]}



Thank you again, that should be enough for most of my small examples.
I guess I never heard of or forgot about \placesidebyside as well as 
\placeontopofeachother.

But I’d like to show a lot of similar examples to explain several options.
Therefore, if I’d like to simplify my code, but this doesn’t work:

\def\CodeExample#1{%
\startbuffer[zB]
#1
\stopbuffer
\typebuffer[zB]
\getbuffer[zB]
}

\CodeExample{\framed[frame=off,leftframe=on,rulethickness=1em,framecolor=blue]{Klotz
 am Bein}}


You can't do that with buffers. If you need to define your own macros that 
behave like buffers, you need to use \grabbufferdata (see buff-ini.mkiv). 
But in this case, there is a simpler solution:


\defineframed
  [CodeExampleFramed]
  [
frame=off,
width=0.5\textwidth,
align=normal,
  ]

\definebuffer
[CodeExample]

\define\stopCodeExample
{\placesidebyside
{\CodeExampleFramed{\typeCodeExample}}
{\CodeExampleFramed{\getCodeExample}}}


\starttext
\startCodeExample
\framed
  [
frame=off,
leftframe=on,
rulethickness=1em,
framecolor=blue,
  ]{Klotz am Bein}
\stopCodeExample


\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] source code and result side by side

2017-07-30 Thread Pablo Rodriguez
On 07/30/2017 07:13 PM, Henning Hraban Ramm wrote:
> [...]
> But I’d like to show a lot of similar examples to explain several options.
> Therefore, if I’d like to simplify my code, but this doesn’t work:
> 
> \def\CodeExample#1{%
> \startbuffer[zB]
> #1
> \stopbuffer
> \typebuffer[zB]
> \getbuffer[zB]
> }
> 
> \CodeExample{\framed[frame=off,leftframe=on,rulethickness=1em,framecolor=blue]{Klotz
>  am Bein}}
> 
> Compilation just stops, maybe some infinite loop?

This is what I get from your sample above.

> Simpler:
> 
> \def\CodeExample#1{%
> \startTEX
> #1
> \stopTEX
> #1
> }
> 
> Stops with the error:

Without or without definitions, there should be no expansion inside
\starttyping...\stoptyping.

Even with some expansion, I get an infinite loop:

\starttext
\setuptyping[TEX][escape=yes]
\def\CodeExample#1{%
\startTEX
/BTEX #1/ETEX
\stopTEX
#1
}
\CodeExample{\framed[frame=off,leftframe=on,rulethickness=1em,framecolor=blue]{Klotz
am Bein}}

\stoptext

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] source code and result side by side

2017-07-30 Thread Henning Hraban Ramm
Am 2017-07-29 um 00:57 schrieb Aditya Mahajan <adit...@umich.edu>:

> On Fri, 28 Jul 2017, Henning Hraban Ramm wrote:
> 
>> Ahoi again,
>> 
>> I’m preparing some ConTeXt docs with a lot of examples and would like to 
>> reproduce what we have in the wiki as
>> 
>> 
>> ...
>> 
>> 
>> i.e. sourcecode beside the result.
>> 
>> Often the shown source is exactly what I want to show, in other cases I need 
>> some additional setup that I don’t want to show.
>> 
>> Which approach would you suggest? Combinations?
> 
> \startbuffer[example-1]
> 
> \stopbuffer
> 
> 
> \placesidebyside
>{\typebuffer[example-1]}
>{\getbuffer[setups, example-1]}


Thank you again, that should be enough for most of my small examples.
I guess I never heard of or forgot about \placesidebyside as well as 
\placeontopofeachother.

But I’d like to show a lot of similar examples to explain several options.
Therefore, if I’d like to simplify my code, but this doesn’t work:

\def\CodeExample#1{%
\startbuffer[zB]
#1
\stopbuffer
\typebuffer[zB]
\getbuffer[zB]
}

\CodeExample{\framed[frame=off,leftframe=on,rulethickness=1em,framecolor=blue]{Klotz
 am Bein}}


Compilation just stops, maybe some infinite loop?

Simpler:

\def\CodeExample#1{%
\startTEX
#1
\stopTEX
#1
}


Stops with the error:
Use of \m_syst_action_yes doesn't match its definition




Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
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
___

Re: [NTG-context] ligatures/substituation at word boundaries

2017-07-30 Thread Hans Hagen

On 7/30/2017 11:39 AM, Ulrike Fischer wrote:

Am Fri, 28 Jul 2017 23:21:18 +0200 schrieb Hans Hagen:


Is it possible to refer in fonts.handlers.otf.addfeature to the word
boundary? The luatex manual speaks of a virtual "left_boundary"
char, but I couldn't find a way to use it.



It is possible to check against spaces in contextual lookups. There
isn't something like left boundary. I added some test code to the beta
but keep in mind that this will only work with self-made features.


Thanks. It seems to work quite good and after some playing around I
also got the knack of the syntax.

A few questions:

1. "lookups = { 1 }," refers to the first lookup. Is it possible to
name the lookups and to refer to this name?.


no, because order matters


2. 0xFFFC refers more or less to the begin and end of line, right?
Why doesn't it interfere with hyphenations? I tried to get
   ab-
ab

and the second wasn't replaced (as wanted) and I wondered how it
worked.


0xFFFC is just the same as "anything other than glyph or discretionary"


3. Why is in the following example "abcd" not replaced by "12"?


i'll have a look at this (advancing in somewhat messy defined)


\startluacode
  fonts.handlers.otf.addfeature {
  name= "test-a",
  type= "chainsubstitution",
  lookups = {
  {
  type = "ligature",
  data = {
  ['1'] = { "a", "b" },
  ['2'] = { "c", "d" },
  },
  },
  },
  data = {
  rules = {
  {
  before  = { { " ", 0xFFFC } },
  current = { { "a" }, { "b" } },
  lookups = { 1 },
  },
  {
  current = { { "c" }, { "d" } },
  after   = { { 0xFFFC, " " } },
  lookups = { 1 },
      },
  },
  },
  }


\stopluacode

\definefontfeature[test-a][test-a=yes]

\startbuffer
xxx abcd abxcd xxx
\stopbuffer

\starttext

\typebuffer

\definedfont[file:dejavu-serif.ttf*default] \getbuffer \blank
\definedfont[file:dejavu-serif.ttf*default,test-a] \getbuffer \blank

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

Re: [NTG-context] ligatures/substituation at word boundaries

2017-07-30 Thread Ulrike Fischer
Am Fri, 28 Jul 2017 23:21:18 +0200 schrieb Hans Hagen:

>> Is it possible to refer in fonts.handlers.otf.addfeature to the word
>> boundary? The luatex manual speaks of a virtual "left_boundary"
>> char, but I couldn't find a way to use it.

> It is possible to check against spaces in contextual lookups. There 
> isn't something like left boundary. I added some test code to the beta 
> but keep in mind that this will only work with self-made features. 

Thanks. It seems to work quite good and after some playing around I
also got the knack of the syntax.

A few questions: 

1. "lookups = { 1 }," refers to the first lookup. Is it possible to
name the lookups and to refer to this name?.

2. 0xFFFC refers more or less to the begin and end of line, right?
Why doesn't it interfere with hyphenations? I tried to get 
  ab-
ab 

and the second wasn't replaced (as wanted) and I wondered how it
worked. 

3. Why is in the following example "abcd" not replaced by "12"? 


\startluacode
 fonts.handlers.otf.addfeature {
 name= "test-a",
 type= "chainsubstitution",
 lookups = {
 {
 type = "ligature",
 data = {
 ['1'] = { "a", "b" },
 ['2'] = { "c", "d" },
 },
 },
 },
 data = {
 rules = {
 {
 before  = { { " ", 0xFFFC } },
 current = { { "a" }, { "b" } },
 lookups = { 1 },
 },
 {
 current = { { "c" }, { "d" } },
 after   = { { 0xFFFC, " " } },
     lookups = { 1 },
 },
 },
 },
 }


\stopluacode

\definefontfeature[test-a][test-a=yes]

\startbuffer
xxx abcd abxcd xxx
\stopbuffer

\starttext

\typebuffer

\definedfont[file:dejavu-serif.ttf*default] \getbuffer \blank
\definedfont[file:dejavu-serif.ttf*default,test-a] \getbuffer \blank

\stoptext





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

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

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

Re: [NTG-context] source code and result side by side

2017-07-29 Thread Pablo Rodriguez
On 07/29/2017 10:58 AM, Pablo Rodriguez wrote:
> On 07/29/2017 12:57 AM, Aditya Mahajan wrote:
>> [...]
>> \placesidebyside
>>  {\typebuffer[example-1]}
>>  {\getbuffer[setups, example-1]}
> [...]
> Is there now hay to avoid the forced horizontal mode on both sides?

Replying to my own question, a fast fix (although far from perfect)
would be using xtables:

\def\replacesidebyside#1{%
\blank\startembeddedxtable[frame=off, option=stretch]
\startxrow
    \startxcell\typebuffer[#1][option=TEX]\stopxcell
\startxcell\getbuffer[setups, #1]\stopxcell
\stopxrow
\stopembeddedxtable\blank}

\def\replaceontopofeachother#1{%
\blank\startembeddedxtable[frame=off, option=stretch]
\startxrow
    \startxcell\typebuffer[#1][option=TEX]\stopxcell
\stopxrow
\startxrow[toffset=1em, split=yes]
\startxcell\getbuffer[setups, #1]\stopxcell
\stopxrow
\stopembeddedxtable\blank}

\starttext
\startbuffer[example-1]
\setupexternalfigures[location=default]
\starttext
\ConTeXt\ is awesome!

\externalfigure[cow.pdf][scale=250]
\stoptext
\stopbuffer

Frames won’t be split accross pages. There may be other issues, but none
tham I’m aware of ;-).

Just in case it helps,

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] source code and result side by side

2017-07-29 Thread Pablo Rodriguez
On 07/29/2017 12:57 AM, Aditya Mahajan wrote:
> [...]
> \startbuffer[example-1]
>   
> \stopbuffer
> 
> 
> \placesidebyside
>  {\typebuffer[example-1]}
>  {\getbuffer[setups, example-1]}

Many thanks for your suggestion, Aditya.

I’m afraid everything is forced to be in horizontal mode:

\starttext
\startbuffer[example-1]
\setupexternalfigures[location=default]
\starttext
\ConTeXt\ is awesome!

\externalfigure[cow.pdf][scale=250]
\stoptext
\stopbuffer

\placesidebyside
 {\typebuffer[example-1]}
 {\getbuffer[setups, example-1]}
\stoptext

\placeontopofeachother has the same feature.

This causes that \placefigure cannot be used.

Is there now hay to avoid the forced horizontal mode on both sides?

Many thanks for your help,

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] source code and result side by side

2017-07-28 Thread Aditya Mahajan

On Fri, 28 Jul 2017, Henning Hraban Ramm wrote:


Ahoi again,

I’m preparing some ConTeXt docs with a lot of examples and would like to 
reproduce what we have in the wiki as


...


i.e. sourcecode beside the result.

Often the shown source is exactly what I want to show, in other cases I 
need some additional setup that I don’t want to show.


Which approach would you suggest? Combinations?


\startbuffer[example-1]
 
\stopbuffer


\placesidebyside
{\typebuffer[example-1]}
{\getbuffer[setups, example-1]}


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

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

  1   2   3   >