[NTG-context] Fwd: Re: Alignment of bullets withn \tabulate within \itemize

2021-08-05 Thread Lukas/ConTeXt via ntg-context
Hello Wolfgang,

this look good, thank you.

See my slightly modified sample - is there a way to make "MT" horizontally 
aligned, too?
- That within \tabulate is shifted somehow, neither "i0" 
(\starttabulate[|l|pi0|p|]) produces well aligned result.


\starttext
  \startitemize[packed_,intext][headstyle_=,]
    \item MT

    \starttabulate[|l|p|p|]
    %\starttabulate[|l|pi0|p|]
  \NI MT \NC MT \NC\AR
  \NI M\input knuth \NC M\input knuth \NC\AR
    \stoptabulate

    \item MT
  \stopitemize
\stoptext


Thanks anyway.

Best regards,

Lukas

-- Původní e-mail --

Od: Wolfgang Schuster 
Komu: mailing list for ConTeXt users 
Datum: 4. 8. 2021 20:44:31
Předmět: Re: [NTG-context] Alignment of bullets withn \tabulate within \itemize

Lukas/ConTeXt via ntg-context schrieb am 04.08.2021 um 17:03:

> Hello,
>
> let's have the following sample:
>
> 
> \starttext
>\startitemize[packed_,][headstyle_=,]
>  \item CC
>
>  \starttabulate[|l|||]
>\NI aa \NC bb \NC\NR
>  \stoptabulate
>
>  \item AA
>\stopitemize
> \stoptext
> 
>
> How do I make bullets (\itemtag) horizontally aligned one bellow another?
>
> In my case - bullets within \tabulate are indented (shifted rightwards) 
> somehow, which is undesired.

You can use the 'intext' keyword but this works only well for short texts, 
otherwise text continus below the bullet point.

\starttext
\startitemize[intext]
 \item XXX
 \starttabulate[|l|||]
 \NI aa \NC bb \NC\NR
 \stoptabulate
 \item YYY
\stopitemize
\stoptext

Wolfgang\starttext
  \startitemize[packed_,intext][headstyle_=,]
\item MT

\starttabulate[|l|p|p|]
%\starttabulate[|l|pi0|p|]
  \NI MT \NC MT \NC\AR
  \NI M\input knuth \NC M\input knuth \NC\AR
\stoptabulate

\item MT
  \stopitemize
\stoptext


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


[NTG-context] Alignment of bullets withn \tabulate within \itemize

2021-08-04 Thread Lukas/ConTeXt via ntg-context
Hello,

let's have the following sample:


\starttext
  \startitemize[packed_,][headstyle_=,]
\item CC

\starttabulate[|l|||]
  \NI aa \NC bb \NC\NR
\stoptabulate

\item AA
  \stopitemize
\stoptext


How do I make bullets (\itemtag) horizontally aligned one bellow another?

In my case - bullets within \tabulate are indented (shifted rightwards) 
somehow, which is undesired.

TIA.

Best regards,

Lukas\starttext
  \startitemize[packed_,][headstyle_=,]
\item CC

\starttabulate[|l||p|]
  \NI aa \NC bb \NC\NR
\stoptabulate

\item AA
  \stopitemize
\stoptext


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


[NTG-context] Make LMTX load a custom library

2021-03-01 Thread Lukas/ConTeXt
Hello,

suppose having a custom DLL (actualy a Lua module) in:

  d:\Lukas\Lua\54\WinCon.dll

How exactly should I alter the path specification so LMTX be able to load 
WinCon.dll?

My trials - without success so far - are:

1. Alter LUA_CPATH before running Ctx, so something like:

 (command line)
set LUA_CPATH=d:\Lukas\Lua\54\?.dll;%LUA_CPATH%
context.exe test.tex ...


2. Alter LUAINPUTS before running Ctx, so something like:

 (command line)
set LUAINPUTS=%LUAINPUTS%;d:\Lukas\Lua\54\?.dll;%LUA_CPATH%
context.exe test.tex ...


3. Changing the path at runtime, so something like:

 test.tex
\startluacode
  package.cpath = package.cpath .. ";d:/Lukas/Lua/54/?.dll"
  require "MyLib"
\stopluacode


But I'm still getting errors like:

"
...
token call, execute: 
...TX/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: module 
'WinCon' not found:
no field package.preload['WinCon']
no file 'd:\Lukas\Lua\WinCon.lua'
no file 'd:\Lukas\Common\Statics\WinCon.lua'
no file 'd:\Lukas\Lua\3rdParty\WinCon.lua'
no file 'd:\Lukas\Lua\3rdParty\stdlib\modules\WinCon.lua'
no file 'd:\Lukas\Lua\3rdParty\LuaXML\WinCon.lua'
no file 'C:\Program Files (x86)\Lua\5.1\lua\WinCon.luac'
no file 'd:\Lukas\Lua\Geom'
...
"

Surprisingly, loader tries to locate a *.lua* only, whilst here I nedd to load 
a .dll;
and in genereal case, .lua, .luac and .dll may be required.

So - how to specify the path correctly, be it on the command line or within a 
.tex (LMTX run-time)?

Best regards,

Lukas
___
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] Warning: "nodes: unable to store reference from lua in tex"

2021-02-26 Thread Lukas/ConTeXt
Hello,

after I renewed ConTeXt MkIV, I started to get the following warning:

"
...
luatex warning  > nodes: unable to store reference from lua in tex
...
(repeated more times)
"

This happens when I try to typeset a looo...ong table (by 
\start/\stop-tabulate) over several pages.
It used to work OK with a Ctx version several months (or half year) ago.
Is there a simple way to overtake the problem?

MWE:


\starttext
  \startluacode
context[[
\starttabulate[|Tr|]
  \HL
  \NC AABBCC \NC\AR
  \HL[3]
]]

for i = 1, 4000 do
  context.NC(i)
  context.NC()
  context.AR()
end

context[[
  \HL
\stoptabulate
]]
  \stopluacode
\stoptext


Best regards,

Lukasopen source > level 1, order 1, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system  > 
system  > ConTeXt  ver: 2021.02.01 13:17 MKIV  fmt: 2021.2.3  int: 
english/english
system  > 
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'

system      > jobfiles > using path: d:/Lukas/ConTeXt/Styles
system  > files > jobname 't', input 
'D:/Lukas/Jobs/Chrastany-D5.4-RDS/SO_201/t.mkiv', result 't'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 2, order 3, name 
'D:/Lukas/Jobs/Chrastany-D5.4-RDS/SO_201/t.mkiv'
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern-designsize rm 12pt' is loaded
luatex warning  > nodes: unable to store reference from lua in tex
luatex warning  > nodes: unable to store reference from lua in tex
luatex warning  > nodes: unable to store reference from lua in tex
luatex warning  > nodes: unable to store reference from lua in tex
backend > xmp > using file 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pages   > flushing realpage 1, userpage 1, subpage 1
pages   > flushing realpage 2, userpage 2, subpage 2
pages   > flushing realpage 3, userpage 3, subpage 3
pages   > flushing realpage 4, userpage 4, subpage 4
pages   > flushing realpage 5, userpage 5, subpage 5
pages   > flushing realpage 6, userpage 6, subpage 6
pages   > flushing realpage 7, userpage 7, subpage 7
pages   > flushing realpage 8, userpage 8, subpage 8
pages   > flushing realpage 9, userpage 9, subpage 9
pages   > flushing realpage 10, userpage 10, subpage 10
pages   > flushing realpage 11, userpage 11, subpage 11
pages   > flushing realpage 12, userpage 12, subpage 12
pages   > flushing realpage 13, userpage 13, subpage 13
pages   > flushing realpage 14, userpage 14, subpage 14
pages   > flushing realpage 15, userpage 15, subpage 15
pages   > flushing realpage 16, userpage 16, subpage 16
pages   > flushing realpage 17, userpage 17, subpage 17
pages   > flushing realpage 18, userpage 18, subpage 18
pages   > flushing realpage 19, userpage 19, subpage 19
pages   > flushing realpage 20, userpage 20, subpage 20
pages   > flushing realpage 21, userpage 21, subpage 21
pages   > flushing realpage 22, userpage 22, subpage 22
pages   > flushing realpage 23, userpage 23, subpage 23
pages   > flushing realpage 24, userpage 24, subpage 24
pages   > flushing realpage 25, userpage 25, subpage 25
pages   > flushing realpage 26, userpage 26, subpage 26
pages   > flushing realpage 27, userpage 27, subpage 27
pages   > flushing realpage 28, userpage 28, subpage 28
pages   > flushing realpage 29, userpage 29, subpage 29
pages   > flushing realpage 30, userpage 30, subpage 30
pages   > flushing realpage 31, userpage 31, subpage 31
pages   > flushing realpage 32, userpage 32, subpage 32
pages   > flushing realpage 33, userpage 33, subpage 33
pages   > flushing realpage 34, userpage 34, subpage 34
pages   > flushing realpage 35, userpage 35, subpage 35
pages   > flushing realpage 36, userpage 36, subpage 36
pages   > flushing realpage 37, userpage 37, subpage 37
pages   > flushing realpage 38, userpage 38, subpage 38
pages   > flushing realpage 39, userpage 39, subpage 39
pages   > flushing realpage 40, userpage 40, subpage 40
pages   > flushing realpage 41, userpage 41, subpage 41
pages   > flushing realp

Re: [NTG-context] How to shift unnumbered ToC entry?

2020-09-23 Thread Lukas/ConTeXt
Hello,

yes, this works well, thanks you!
 
(I guessed there was a built-in option to achieve this simply.)
 
Best regards,
 
Lukas



-- Původní e-mail --

Od: Tomas Hala 

Komu: mailing list for ConTeXt users 

Datum: 23. 9. 2020 12:08:50

Předmět: Re: [NTG-context] How to shift unnumbered ToC entry?

Hello Lukas,

you can try this:

\setuphead[subsubsection][number=no]
\setuplist[subsubsection][distance=20mm,width=20mm,textcommand=\mycmd]

\def\mycmd#1{\hskip20mm#1}

\starttext
  \placecontent
  \page
  \section{S}
\subsection{Ss}
  \subsubsection{Sss}
\stoptext

Best wishes,

Tomáš 

Wed, Sep 23, 2020 ve 10:33:45AM +0200 Lukas/ConTeXt napsal(a):
# Hello,
# 
# how do I shift unnumbered ToC entry (here: \subsubsection)? My attempt:
# 
# 
# \setuphead[subsubsection][number=no]
# \setuplist[subsubsection][distance=20mm,width=20mm]
# 
# \starttext
#   \placecontent
#   \page
#   \section{S}
# \subsection{Ss}
#   \subsubsection{Sss}
# \stoptext
# 
# 
# I'm getting:
# 
# "
# 1. S
# 1.1  Ss
# Sss
# "
# 
# but I'd rather see:
# 
# "
# 1. S
# 1.1  Ss
# Sss
# "
# 
# How to achieve this?
# 
# Best regards,
# 
# Lukas

# \setuphead[subsubsection][number=no]
# \setuplist[subsubsection][distance=20mm,width=20mm]
# 
# \starttext
#   \placecontent
#   \page
#   \section{S}
# \subsection{Ss}
#   \subsubsection{Sss}
# \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] How to shift unnumbered ToC entry?

2020-09-23 Thread Lukas/ConTeXt
Hello,

how do I shift unnumbered ToC entry (here: \subsubsection)? My attempt:


\setuphead[subsubsection][number=no]
\setuplist[subsubsection][distance=20mm,width=20mm]

\starttext
  \placecontent
  \page
  \section{S}
\subsection{Ss}
  \subsubsection{Sss}
\stoptext


I'm getting:

"
1. S
1.1  Ss
Sss
"

but I'd rather see:

"
1. S
1.1  Ss
Sss
"

How to achieve this?

Best regards,

Lukas\setuphead[subsubsection][number=no]
\setuplist[subsubsection][distance=20mm,width=20mm]

\starttext
  \placecontent
  \page
  \section{S}
\subsection{Ss}
  \subsubsection{Sss}
\stoptext


t.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] white-space after section-head in columns

2020-07-15 Thread Lukas/ConTeXt
Hello Peter,

playing with "grid" option within \setuplayout and \setuphead might help - see:


\setuplayout[grid=no]
\setuphead[section][grid=no]

\starttext
  \startsection[title=Space is ok here]
\input tufte
  \stopsection

  \blank

  \startcolumns[n=2]
\startsection[title=Too much white-space here]
  \input tufte
\stopsection

\setuphead[section]%[after=\vskip-2ex]

\startsection[title=Space is ok here with workaround]
  \input tufte
\stopsection
  \stopcolumns
\stoptext


Best regards,

Lukas


-- Původní e-mail --

Od: Peter Münster 

Komu: ConTeXt users 

Datum: 15. 7. 2020 14:57:26

Předmět: [NTG-context] white-space after section-head in columns

Hi,

What is the right way please to get normal white-space after a section in
columns, i.e. not too much?

Example, that shows the problem:

--8<---cut here---start->8---
\starttext
\startsection[title=Space is ok here]
  \input tufte
\stopsection
\startcolumns[n=2]
\startsection[title=Too much white-space here]
  \input tufte
\stopsection
\setuphead[section][after=\vskip-2ex]
\startsection[title=Space is ok here with workaround]
  \input tufte
\stopsection
\stopcolumns
\stoptext
--8<---cut here---end--->8---

TIA,
--
   Peter
___
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
___\setuplayout[grid=no]
\setuphead[section][grid=no]

\starttext
  \startsection[title=Space is ok here]
\input tufte
  \stopsection

  \blank

  \startcolumns[n=2]
\startsection[title=Too much white-space here]
  \input tufte
\stopsection

\setuphead[section]%[after=\vskip-2ex]

\startsection[title=Space is ok here with workaround]
  \input tufte
\stopsection
  \stopcolumns
\stoptext


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


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

2020-07-08 Thread Lukas/ConTeXt
Hello,

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

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

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


\setupexternalfigures[location=default]

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


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

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

Best regards,

Lukas\setupexternalfigures[location=default]

\starttext
  \placetable[force,none]{}{\externalfigure[cow]}
  \placefloat[force,none]{}{\externalfigure[cow]}
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


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

2020-07-08 Thread Lukas/ConTeXt
Hello,

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


\setupexternalfigures[location=default]

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


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

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

Best regards,

Lukas\setupexternalfigures[location=default]

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


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

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


Re: [NTG-context] Checking for singlesided/doublesided at run-time

2020-06-24 Thread Lukas/ConTeXt

Hello,




I've just been noticed about wiki update related to *singlesided and *
doublesided modes.




Thank you, Wolfgang and Aditya, for answering and filling in the wiki.




Best regards,




Lukas




-- Původní e-mail --
Od: Wolfgang Schuster 
Komu: mailing list for ConTeXt users 
Datum: 24. 6. 2020 15:08:33
Předmět: Re: [NTG-context] Checking for singlesided/doublesided at run-time
"Lukas/ConTeXt schrieb am 24.06.2020 um 08:19:
> Hello,
>
> is there a way to detect whether the document is intended as single- or 
double- sided, IOW, whether
> \setuppagenumbering[alternative=singlesided]
> or
> \setuppagenumbering[alternative=doublesided]
> has been specified?
>
> If so, is it possible by Lua, too?

%\setuppagenumbering[alternative=singlesided]
%\setuppagenumbering[alternative=doublesided]
%\setuppagenumbering[alternative={singlesided,doublesided}]

\starttext

\doifmode{*singlesided}{a}
\doifmode{*doublesided}{b}

\startluacode

if tex.modes["*singlesided"] then
context("x")
end

if tex.modes["*doublesided"] then
context("y")
end

\stopluacode

\stoptext

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

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


[NTG-context] Automatic userdata storage between runs

2020-06-24 Thread Lukas/ConTeXt
Hello,

first - thanks for the perfectly synoptical
  https://wiki.contextgarden.net/Programming_in_LuaTeX#Namespaces !

My question (and the answer sould appear on wiki, too):

Is any of the namespaces (userdata, thirddata, moduledata, documentdata, 
parametersets) automatically serialized between Ctx first(-second(-third)) runs?

I'm asking because user may call some (longer) code and put the result into a 
namespace (be it e.g. "userdata"). And if that namespace was automatically 
serialized for next run(s), that code could be called conditionally - typically 
just in first run (= mode "*first" enabled) - as in next runs results of the 
additional code would be available in a namespace (instead of repetitive call 
of that (longer) code).

Of course, user can perform such evaluation, storage and conditional 
extra-code-call individually, but maybe there is some support for similar 
situations in Ctx.

Best regards,

Lukas

___
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] Checking for singlesided/doublesided at run-time

2020-06-24 Thread Lukas/ConTeXt
Hello,

is there a way to detect whether the document is intended as single- or double- 
sided, IOW, whether 
  \setuppagenumbering[alternative=singlesided]
or
  \setuppagenumbering[alternative=doublesided]
has been specified?

If so, is it possible by Lua, too?

Regards,

Lukas
___
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] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-19 Thread Lukas/ConTeXt
Hello Hans,

-- Původní e-mail -- {
Od: Hans Hagen 

as you updated, it's just:

   \startluacode
 local defined = tokens.defined
 for _, v in ipairs{ "MyMacro", "MyMacWithPars", "Undefined", "DoNothing", 
"NonExisting" } do
   print(string.format("\letterpercent-12s", v), defined(v), defined(v, 
true), defined(v, false))
 end
   \stopluacode
-- Původní e-mail -- }

your solution gives me:

"
MyMacro false   truefalse
MyMacWithPars   false   truefalse
Undefined   false   truefalse
DoNothing   false   truefalse
NonExisting false   false   false
"
which desn't recognize \Undefined - it should give 'false' in the 2nd column of 
results, like \NonExisting does.

But I have another solution (asked in Czech TUG) - use of 
'token.get_meaning(cs)': 

  \startluacode
for _, v in ipairs{ "MyMacro", "MyMacWithPars", "Undefined", "DoNothing", 
"NonExisting" } do
  print(string.format("\letterpercent-12s", v), "get_meaning", 
token.get_meaning(v) or "(non-existing/undefined)")
end
  \stopluacode


- Produces:

"
MyMacro get_meaning ->Ahoj
MyMacWithPars   get_meaning #1#2->Something
Undefined   get_meaning (non-existing/undefined)
DoNothing   get_meaning ->
NonExisting get_meaning (non-existing/undefined)
"
which is perfectly what I need.

But thank you anyway for your effort.

Best regards,

Lukas
___
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] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-18 Thread Lukas/ConTeXt

Hello,




I need to check within Lua.

My sample cases are very minimalistic - I'm working on more complicated task
actually, where check-for-control-sequence-existence need to be performed 
run-time within Lua scope.




Best,




Lukas



-- Původní e-mail --
Od: Hans van der Meer 
Komu: NTG ConTeXt 
Datum: 18. 6. 2020 12:25:42
Předmět: Re: [NTG-context] Checking existence of a macro (control sequence)
by Lua - problem after updating MkIV
"
Why can you not simply use one of the doifundefined macro's? Something for
example:


\doifundefined{ExitStatus}{\gdef\ExitStatus{0}} % default to ok as in UNIX




dr. Hans van der Meer









"
On 18 Jun 2020, at 10:27, Lukas/ConTeXt mailto:lpr.cont...@email.cz)> wrote:



Hello,
I'm using Hans' macro suggested some time before.
I've just updated Ctx MkIV and my sample code:


\starttext
 \def\MyMacro{Ahoj}

  \def\MyMacWithPars#1#2{Something}

  \def\Undefined{}
  \let\Undefined\undefined

  \def\DoNothing{}
  \let\DoNothing\donothing

  \startluacode
    if CONTEXTLMTXMODE == 0 then
   local d = tokens.defined
   local c = tokens.create

   function tokens.defined(s,b)
   if b then
   return d(s)
   else
    return c(s).cmd_name == "undefined_cmd"
   end
    end
    end

    --

    local defined = tokens.defined

   for _, v in ipairs{ "MyMacro", "MyMacWithPars", "Undefined", "DoNothing",
"NonExisting" } do
 print(string.format("\letterpercent-12s", v), defined(v), defined(v,
true), defined(v, false))
   end
  \stopluacode

  Aaa
\stoptext


gives:
"
MyMacro false   false   false
MyMacWithPars   false   false   false
Undefined   false   false   false
DoNothing   false   false   false
NonExisting false   false   false
"

IOW, I'm not able to determine whether a control sequence has not been
defined (or has \undefined value) or not.

Am I doing a trivial mistake or has anything changed?

Thank you for patience...

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

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

___


"


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

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

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

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


[NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-18 Thread Lukas/ConTeXt
Hello,
I'm using Hans' macro suggested some time before.
I've just updated Ctx MkIV and my sample code:


\starttext
  \def\MyMacro{Ahoj}

  \def\MyMacWithPars#1#2{Something}

  \def\Undefined{}
  \let\Undefined\undefined

  \def\DoNothing{}
  \let\DoNothing\donothing

  \startluacode
if CONTEXTLMTXMODE == 0 then
local d = tokens.defined
local c = tokens.create

function tokens.defined(s,b)
if b then
return d(s)
else
return c(s).cmd_name == "undefined_cmd"
end
end
end

--

local defined = tokens.defined

for _, v in ipairs{ "MyMacro", "MyMacWithPars", "Undefined", "DoNothing", 
"NonExisting" } do
  print(string.format("\letterpercent-12s", v), defined(v), defined(v, 
true), defined(v, false))
end
  \stopluacode

  Aaa
\stoptext


gives:
"
MyMacro false   false   false
MyMacWithPars   false   false   false
Undefined   false   false   false
DoNothing   false   false   false
NonExisting false   false   false
"

IOW, I'm not able to determine whether a control sequence has not been defined 
(or has \undefined value) or not.

Am I doing a trivial mistake or has anything changed?

Thank you for patience...

Lukasopen source > level 1, order 1, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system  > 
system  > ConTeXt  ver: 2020.06.17 18:56 MKIV beta  fmt: 2020.6.18  
int: english/english
system  > 
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'

system  > jobfiles > using path: d:/Lukas/ConTeXt/Styles
system  > files > jobname 'IsMacDef3', input 
'D:/Lukas/ConTeXt/Test/IsMacDef3.mkiv', result 'IsMacDef3'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 2, order 3, name 'D:/Lukas/ConTeXt/Test/IsMacDef3.mkiv'
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern-designsize rm 12pt' is loaded
backend > xmp > using file 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pages   > flushing realpage 1, userpage 1, subpage 1
close source> level 2, order 3, name 'D:/Lukas/ConTeXt/Test/IsMacDef3.mkiv'
close source> level 1, order 3, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'

system  > start used files

system  > text: IsMacDef3

system  > stop used files


system  > start used files

system  >1: filename=char-prv.lua filetype=tex format=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/char-prv.lua 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/char-prv.lua 
usedmethod=database
system  >2: filename=cont-yes.mkiv filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv 
usedmethod=database
system  >3: filename=publ-imp-default.lua filetype=lua 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua
 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua
 usedmethod=otherwise
system  >4: filename=cont-new.mkiv filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv 
usedmethod=database
system  >5: filename=lang-exc.lua filetype=lua 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua 
usedmethod=otherwise
system  >6: filename=lang-us.lua filetype=lua 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua 
usedmethod=otherwise
system  >7: filename=D:/Lukas/ConTeXt/Test/IsMacDef3.mkiv 
foundname=D:/Lukas/ConTeXt/Test/IsMacDef3.mkiv 
fullname=D:/Lukas/ConTeXt/Test/IsMacDef3.mkiv usedmethod=direct
system  >8: filename=lm.lfg filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg 
usedmethod=database
system  >9: filename=lmroman12-regular filetype=otf format=otf 
foundname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm

[NTG-context] Bar within math (amended)

2020-06-09 Thread Lukas/ConTeXt
Hello,

it seems that bar (even with option 'continue=yes') is not rendered in place of 
'~' within math. See the sample:


\definebar[MyBar][color=green,rulethickness=2.8,order=background,offset=1.5,continue=yes]

\starttext
  1 + 2 = \startbar[MyBar]3~kN\stopbar % OK

  $1 + 2 = \startbar[MyBar]3~\text{kN}\stopbar$ % No background behind space

  $1 + 2 = 
\inframed[frame=off,background=color,backgroundcolor=green,offset=0pt,]{3~\text{kN}}$
 % OK!
\stoptext


In the sample 'kN' is a unit, which should be separated by space from the 
result (here: 3);
I am used to put the unit into the math environment and enclose it into 
\text{...}.

Is there a way to make the bar be rendered in places of blanks within math, too 
(like if it was inside $ ... $ - as the first line of the sample)?

- Note that I can use \inframed to get background filled fully, but anyway - 
how about usage of "bar" for this?

Best regards,

Lukas\definebar[MyBar][color=green,rulethickness=2.8,order=background,offset=1.5,continue=yes]

\starttext
  1 + 2 = \startbar[MyBar]3~kN\stopbar

  $1 + 2 = \startbar[MyBar]3~\text{kN}\stopbar$

  $1 + 2 = 
\inframed[frame=off,background=color,backgroundcolor=green,offset=0pt,]{3~\text{kN}}$
\stoptext


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