. This is a simplified version of what I use in the filter
module:
\unprotect
\def\AnyFilename#1%
{\ctxcommand{getreadfilename("any",".","#1")}}
\def\ProcessFile#1%
{\edef\InputFile{\AnyFilename{#1}}%
\InputFile
\typefile[\InputFile]}
module:
\unprotect
\def\AnyFilename#1%
{\ctxcommand{getreadfilename("any",".","#1")}}
\def\ProcessFile#1%
{\edef\InputFile{\AnyFilename{#1}}%
\InputFile
\typefile[\InputFile]}
\protect
\starttext
\ProcessFile{http://cim
ld be as the file name is "Test.mkiv".
But the code:
\starttext
\jobname
\doifelse{\jobname}{Test}{Yes}{No}
\def\T{Test}
\ifx\jobname\T True\else False\fi
\ctxcommand{doifelse("\jobname" == "Test")}{1}{0}
\stoptext
yields "No", &
{No}
\def\T{Test}
\ifx\jobname\T True\else False\fi
\ctxcommand{doifelse("\jobname" == "Test")}{1}{0}
\stoptext
yields "No", "False" and "1", so only the printed "1" is what I expect.
Why \doifelse and \ifx are evaluated as false
Hello,
I'm trying to test whether value of \jobname is "Test"; I suppose it should be as the
file name is "Test.mkiv".
But the code:
\starttext
\jobname
\doifelse{\jobname}{Test}{Yes}{No}
\def\T{Test}
\ifx\jobname\T True\else False\fi
\ctxcommand{doifelse
%
%D %%% Hans’ redefinition of write function: %%%
\def\syst_write#1#2%
{\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}
\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
\normalwrite#1{#2}%
\fi
\relax \the \everystarttext
\global
\everystarttext \e...
l.1 \dostarttext
\ctxcommand #1-\directlua {commands.#1}
l.1 \starttext
Could you fix this?
it works here .. can others confirm the issue
\dostarttext
\ctxcommand #1-\directlua {commands.#1}
l.1 \starttext
Could you fix this?
Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg
...ttext \relax \the \everystarttext
\global
\everystarttext \e...
l.1 \dostarttext
\ctxcommand #1-\directlua {commands.#1}
l.1 \starttext
Could you fix this?
it works here .. can others confirm the issue?
I can confirm the problem. I
in a tex.write which is wrong
so we need to revert to this:
\def\syst_write_execute#1%
{\ctxcommand{execute(\!!bs#1\!!es)}}
\unexpanded\def\write#1#%
{\ifnum#1=18
\expandafter\syst_write_execute
\else
\normalwrite#1%
\fi}
(context itself doesn't suffer from this as it does things
values but at least they return something) but
something like this works:
\def\syst_write#1#2%
{\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}
\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
\normalwrite#1{#2}%
\fi
!verbatim\currenttype\??type
\ctxcommand{typestring{
data= \!!bs\detokenize{#1}\!!es,
tab = \typeparameter\c!tab,
method = \typeparameter\c!option,
+escape = \!!bs\typeparameter\c!escape\!!es,
nature = inline,
compact = \typeparameter\c!compact
command doesn’t support a escape function but it can be added an
additional line in the code (buff-ver.miv):
\def\buff_verbatim_type_normal#1%
{\buff_verbatim_initialize_type_two
\dostarttaggedchained\t!verbatim\currenttype\??type
\ctxcommand{typestring{
data= \!!bs\detokenize{#1
%
{\buff_verbatim_initialize_type_two
\dostarttaggedchained\t!verbatim\currenttype\??type
\ctxcommand{typestring{
data= \!!bs\detokenize{#1}\!!es,
tab = \typeparameter\c!tab,
method = \typeparameter\c!option,
+escape = \!!bs\typeparameter\c!escape\!!es,
nature = inline,
compact
)
\spac_vspacing_yes_indeed ...\ifmmode \else \par
\ctxcommand {vspacing(#1...
l.75 \blank[2*big]
empty file
I'm broken. Please show this to someone who can fix can fix
I don’t know where to start looking, I guess it’s something with the letter
\ctxcommand {vspacing(#1...
l.75 \blank[2*big]
empty file
I'm broken. Please show this to someone who can fix can fix
I don’t know where to start looking, I guess it’s something with the letter
module.
The same files used to work
\currentnotenumber{#id}%
\edef\currentnote{#tag}%
\strc_constructions_initialize{#tag}%
\strc_notes_synchronize
\edef\currentconstructionlistentry{\ctxcommand{notelistindex(\currentnote,#id)}}%
\reinstateconstructionnumberentry\currentconstructionlistentry
\dontcomplain
}{demo}{}
\unexpanded\def\handlenoteitself#tag#id%
{\edef\currentnotenumber{#id}%
\edef\currentnote{#tag}%
\strc_constructions_initialize{#tag}%
\strc_notes_synchronize
\edef\currentconstructionlistentry{\ctxcommand{notelistindex(\currentnote,#id
}%
\strc_notes_synchronize
\edef\currentconstructionlistentry{\ctxcommand{notelistindex(\currentnote,#id)}}%
\reinstateconstructionnumberentry\currentconstructionlistentry
\dontcomplain
\strc_notes_interaction_check_display
\strc_notes_set_reference_attribute_text
\strc_constructions_stored_start
-con.miv
\def\spanishnumerals #1{\ctxcommand{alphabetic(\number#1,spanish)}}
\def\Spanishnumerals #1{\ctxcommand{Alphabetic(\number#1,spanish)}}
and the following line in core-con.la
counters['spanishnumerals'] = counters['spanish
] [\spanishnumerals]
\defineconversion [Spanishnumerals] [\Spanishnumerals]
ah, it should be spanishcharacters
What’s missing as well are these two definitions in core-con.miv
\def\spanishnumerals #1{\ctxcommand{alphabetic(\number#1,spanish)}}
\def\Spanishnumerals #1
\nointerlineskip ^^@-\prevdepth
-\thousandpoint
l.22 \nointerlineskip
\ctxcommand #1o-\directlua {commands.#1}
\tabl_x_process ...lse \tabl_x_flush_text_checked
\fi \fi \ctxcommand
{x_tab...
l.8 }
\ctxlxml #1h-\ctxlua {lxml.#1
/err.tex: !
Missing number, treated as zero
to be read again
f
argument f
oo
\addaskedblankskip ..._vspacing_temp #1\dimexpr #2
\relax
l.8 }
\ctxcommand #12-\directlua {commands.#1}
\spac_vspacing_yes_indeed ...mand {vspacing(#1
\ctxluacode{inspect(metapost.variables)}
\ctxcommand{mprunvar(x)}
\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
) ;
passvariable(point,(1,2)) ;
passvariable(triplet,(1,2,3)) ;
passvariable(quad,(1,2,3,4)) ;
passvariable(boolean,false) ;
passvariable(path,fullcircle scaled 1cm) ;
\stopMPcode
\ctxluacode{inspect(metapost.variables)}
\ctxcommand{mprunvar(array)}
Thanks in advance
that's less
) ;
passvariable(path,fullcircle scaled 1cm) ;
\stopMPcode
\ctxluacode{inspect(metapost.variables)}
\ctxcommand{mprunvar(array)}
Thanks in advance
that's less trivial (as automatism) so i provide passarrayvariable now
(next beta) ... of course the next request would concern complex arrays
so i also made
)) ;
passvariable(boolean,false) ;
passvariable(path,fullcircle scaled 1cm) ;
\stopMPcode
\ctxluacode{inspect(metapost.variables)}
\ctxcommand{mprunvar(array)}
Thanks in advance
that's less trivial (as automatism) so i provide passarrayvariable now
(next beta) ... of course the next request would
\ctxluacode{inspect(metapost.variables)}
\ctxcommand{mprunvar(array)}
Thanks in advance
Jorge
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http
}{\input ward \par}
13
14 \stopmixedcolumns
15
16 \stoptext
17
\ctxcommand #1 -\directlua {commands.#1}
\page_mix_routine_construct ...\else false\fi , }}
\deadcycles
\zerocount
\dorecurse{4}{\input ward \par}
8
9 %\testcolumn[10][-1pt] % 10 lines - 1pt slack
10 \column
11
12 \dorecurse{2}{\input ward \par}
13
14 \stopmixedcolumns
15
16 \stoptext
17
\ctxcommand #1 -\directlua {commands.#1}
\page_mix_routine_construct ...\else false\fi
.
---
\useURL[apurl][http://wiki.contextgarden.net/Category:Commands]
\starttext
\from[apurl]
\url[apurl]
\stoptext
I use TeXshop.
The console gives me the following cryptic message about a LuaTeX error:
\ctxcommand #1
Hello,
Lua way:
\setuplabeltext[chapter=]
\define[1]\MyCommand{\ctxcommand{doifelse(1==\currentsectioncountervalue)}{ONE}{#1}}
\setuphead[chapter][deepnumbercommand=\MyCommand]
\starttext
\chapter{Cool}
\chapter{Cat}
\chapter{Mouse}
\stoptext
I'm sure there is also a cleaner
[textcolor=simpleslides:textcolor]
157
158 %D We use \METAPOST\ to draw backgrounds.
159
160 \startuseMPgraphic{simpleslides:MP:horizontal}
\ctxcommand #1^^@-\directlua {commands.#1}
\colo_basics_define ...lse,\v_colo_freeze_state )}
\unexpanded \setvalue {#1}...
l.150 ...:backgroundcolor
...
1
2 \usetypescriptfile[mathdesign]
3
4 \usemodule[simplefonts]
5
6 \setmainfont[Adobe Garamond Pro]
7 \setmathfont[mathdesigngm]
8
9 \starttext
10 I want \m{x^2+y^2=z^2} in my text, and $\alpha\beta\gamma$ too.
11 \stoptext
\ctxcommand #1^^@-\directlua
eft#right#dummy[#label]
\ctxcommand #1i-\directlua {commands.#1}
\syst_helpers_start_tex_definition_two ...n(#1)}
{#2}
l.32 \stoptexdefinition
, trobeu les seves descomposicions en forma de
potència:
41 \startitemize[a,columns,three,packed]
42 \item 64
43 \item 16
44 \column
45 \item 81
\ctxcommand #1^^@-\directlua {commands.#1}
\page_mix_routine_construct ...\else false\fi
(metapost.variables)}
\ctxcommand{mprunvar(number)}
\ctxcommand{mprunvar(string)}
\stoptext
the inspect shows:
table={
[boolean]=false,
[number]=123,
[path]={
{ 10.02177, 10.02177, 12.67969, 7.36386, 7.36386, 12.67969 },
{ 0, 14.17323, 3.75914, 14.17323, -3.75914, 14.17323
)) ;
passvariable(quad,(1,2,3,4)) ;
passvariable(boolean,false) ;
passvariable(path,fullcircle scaled 1cm) ;
draw fullcircle scaled 20pt ;
\stopMPcode
\ctxlua{inspect(metapost.variables)}
\ctxcommand{mprunvar(number)}
\ctxcommand{mprunvar(string)}
\stoptext
the inspect shows:
table={
[boolean
\directlua ]:1: in main chunk.
system tex error on line 137 in file
/Users/tas/context/tex/texmf-context/tex/context/base/cont-yes.mkiv: LuaTeX
error ...
\ctxcommand #1^^@-\directlua {commands.#1}
l.137 }
\ctxcommand #1^^@-\directlua
/base/back-pdf.lua:44:
attempt to call global 'f_rotation' (a nil value)
stack traceback:
/usr/share/texmf/tex/context/base/back-pdf.lua:44: in function
'pdfstartrotation'
[string \directlua ]:1: in main chunk.
\ctxcommand #1^^@-\directlua {commands.#1
'injectreference'
[string \directlua ]:1: in main chunk.
\ctxcommand #1^^@-\directlua {commands.#1}
Respectfully,
PS Please copy me if you remember, as I am not currently a subscriber.
--
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http
:
...
references unknown reference '[Leitmotifs][Resources For
Everyone]'
pagesflushing realpage 9, userpage 9, subpage 2
! LuaTeX error [string \directlua ]:1: invalid escape sequence
near '\#'.
\ctxcommand #1
.tex: LuaTeX error ...
+++
1 \definefont[amiri][file:amiri-regular.ttf*arabic at 17pt]
2 \define[1]\Arab{\amiri#1}
3
4 \starttext
5 \Arab{بِسْمِ اللَّـهِ الرَّحْمَـٰنِ الرَّحِيمِ}
6 \stoptext
7
8
9
10
11
12
13
14
15
\ctxcommand #1-\directlua
]'
pagesflushing realpage 9, userpage 9, subpage 2
! LuaTeX error [string \directlua ]:1: invalid escape sequence
near '\#'.
\ctxcommand #1^^@-\directlua {commands.#1}
\bibgotoURL #1#2\-\useURL [#1][#2][][#1
\directlua ]:1: invalid escape sequence
near '\#'.
\ctxcommand #1^^@-\directlua {commands.#1}
\bibgotoURL #1#2\-\useURL [#1][#2][][#1]
\from [#1]
argument ...ded
\environment env
2
3 \startproduct prd
4
5 \component cmp
6
7 \stopproduct
8
\ctxcommand #1^^@-\directlua {commands.#1}
l.5 }
\ctxcommand #1^^@-\directlua {commands.#1}
l.5 \component cmp
! == Fatal error occurred, no output PDF file produced!
mtx-context | fatal error
\startproduct prd
4 5 \component cmp
6 7 \stopproduct
8
\ctxcommand #1^^@-\directlua {commands.#1}
l.5 }
\ctxcommand #1^^@-\directlua {commands.#1}
l.5 \component cmp
! == Fatal error occurred, no output PDF file produced!
mtx-context | fatal error: return code
commands with optional argument aren’t expandable and \date *has* two
optional argument.
To get now the date in the output you can either use the expandable
\rawdate[] command (the brackets are necessary) or you use
\ctxcommand{currentdate(specification,language)} (language can also
because when I run this example
\starttext
\rawdate[]
\stoptext
I get “march unknown, 2013” as output.
When I use now (instead of \currentlanguage you can also use a language tag,
e.g. nl)
\starttext
\ctxcommand{currentdate(month, ,day, , year,\currentlanguage)}
\stoptext
I get
I see. But this is not working too. Following your suggestion I now get:
\edef\thisdate{\ctxcommand{currentdate(month, ,day, ,
year,\currentlanguage)}}\writestatus{***}{\meaning\thisdate}
*** macro:-\labeltext {march} 20 2013
The problem is essentially the same.
I am most unhappy
Am 20.03.2013 um 15:29 schrieb Meer H. van der h.vanderm...@uva.nl:
I see. But this is not working too. Following your suggestion I now get:
\edef\thisdate{\ctxcommand{currentdate(month, ,day, ,
year,\currentlanguage)}}\writestatus{***}{\meaning\thisdate}
*** macro:-\labeltext
:#1-\ctxcommand {monthname(#1)}- \labeltext
{unknown}RROR
\year- 2013
\time- 982
I strongly ask that ConTeXt abstains from changing the definition of \month and
reverts to the exact result as given by plain TeX, i.e. a number in the range
[1-12]. Because
\month - \month WHY NOT monthname?}
\writestatus{}{\meaning\year - \the\year}
\writestatus{}{\meaning\time - \the\time}
\stoptext
Result:
\protected macro:-\dodoubleempty \syst_converters_date - \date
\day- 20
macro:#1-\ctxcommand {monthname(#1)}- \labeltext {unknown}HY NOT monthname?
\year
- 20
macro:#1-\ctxcommand {monthname(#1)}- \labeltext {unknown}HY NOT
monthname?
\year- 2013
\time- 989
Plain TeX here gives:
\message{\meaning\day - \the\day}
\message{\meaning\month - \the\month}
\message{\meaning\year - \the\year}
\message{\meaning\time - \the\time}
\end
has changed and
the settings from \setupreferencestructureprefix are ignored.
When I change the definition from
\def\currentreferencedefault
{\ctxcommand{filterdefaultreference()}}
to (this is the code from 2011 adapted to the current version)
\def\currentreferencedefault
=\currentdate,
8 %D copyright={PRAGMA ADE \ \CONTEXT\ Development Team}]
9 %C
10 %C This module is part of the \CONTEXT\ macro||package and is
11 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
\ctxcommand #1-\directlua {commands.#1
minexample.tex: LuaTeX error ...
10 \setupannotation[bigquote]
11 [alternative=command,
12 command=\AnnotationCommand]
13
14 \starttext
15
16 He said:
17 \startbigquote
18 This is interesting!
19 \stopbigquote
20
21 \stoptext
22
\ctxcommand #1-\directlua {commands.#1}
to be read
\stoptext
argument ... internal(\currentlistentryinternal
)\!!es ,\luaconditional \h...
\ctxcommand #1-\directlua {commands.#1
}
\doifreferencefoundelse ...ional \gotonewwindow
\stoptext
9
\ctxcommand #1-\directlua {commands.#1}
\font_helpers_low_level_define ..._designsize )}
\edef \somefontspec
{at \n...
\font_helpers_trigger_define ..._identifier_class
\csname
On 12/19/2012 7:09 PM, Troy Henderson wrote:
\calc{1/3.8} and have it return 0.263157894736842 (or rounded)
\ctxcommand{format(@0.3f,1/3.8)}
@ as well as % ... just lua format but @ is more tex friendly
Do \luaexpr{1/3.8} and \ctxcommand{format(@0.3f,1/3.8)} return numbers or
strings? That is, I would like to use these results in a \if or \ifnum
command to exit a \doloop.
Troy
___
If your question is of interest
Le 20 déc. 12 à 05:43, Troy Henderson a écrit :
Do \luaexpr{1/3.8} and \ctxcommand{format(@0.3f,1/3.8)} return
numbers or strings? That is, I would like to use these results in a
\if or \ifnum command to exit a \doloop.
Troy
Bonjour,
\ctxlua{context(type(\luaexpr{1/3.8}))} gives
On 12/19/2012 7:43 PM, Troy Henderson wrote:
Do \luaexpr{1/3.8} and \ctxcommand{format(@0.3f,1/3.8)} return numbers
or strings? That is, I would like to use these results in a \if or
\ifnum command to exit a \doloop.
they return tokens i.e.
\ifnum\luaexpr{math.round(1/3.8)}1\relax
should
On 12/19/2012 8:19 PM, Roland Thiers wrote:
Le 20 déc. 12 à 05:43, Troy Henderson a écrit :
Do \luaexpr{1/3.8} and \ctxcommand{format(@0.3f,1/3.8)} return
numbers or strings? That is, I would like to use these results in a
\if or \ifnum command to exit a \doloop.
Troy
Bonjour,
\ctxlua
···date: 2012-12-19, Wednesday···from: Troy Henderson···
Do \luaexpr{1/3.8} and \ctxcommand{format(@0.3f,1/3.8)} return numbers or
strings? That is, I would like to use these results in a \if or \ifnum
command to exit a \doloop.
Fwiw there are Lua-side conditionals available as well:
http
inserted text
}
to be read again
\endgroup
\\-\endgroup
\par \doalignline {\hss }{\hss }\begingroup
l.1 Second chapter title \\
which is very very very looong
\ctxcommand ...\directlua
\\
which is very very very looong
\ctxcommand ...\directlua \zerocount {commands.#1}
\getheadtitle ...lecommand \relax \structuretitle
\else \normalexpanded
{\no...
...
l.10 ...r title \\ which is very very very looong}
If I
{doif(true)}{t} % Gives nothing; why?
B
\stoptext
Probably very basic question... What am I doing wrong?
indeed as it's \ctxcommand
the \cldcommand does a context.doif an that one takes three arguments
so you've something to wikify: :
\starttext
A
\ctxlua{commands.doif(true)}{one
On Thu, 29 Nov 2012 10:27:36 +0100, Hans Hagen pra...@wxs.nl wrote:
On 11/29/2012 9:32 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
indeed as it's \ctxcommand
the \cldcommand does a context.doif an that one takes three arguments
so you've something to wikify: :
\starttext
are you using? converters.verbose was put in on november
12. Are you using the latest beta, or the TeX Live 2012 stable
version?
As for the error you got:
Try the new beta Hans just uploaded, Spanish conversions are working
in that one.
E.g. \ctxcommand{verbose(123, es)}.
The bugs we discusses
\crlf
\ctxcommand{verbose(#1, spanish)}}
\obeylines
\vbes{}
\vbes{2221101}
\vbes{}
\vbes{1218}
\vbes{1234}
\vbes{12345}
\vbes{1234567890}
\stopcode
___
If your question
field 'verbose' (a nil
value)
stack traceback:
main ctx instance:1: in main chunk.
system tex error on line 7 in file prueba2.tex: LuaTeX error ...
1 \starttext
2 \def\vbes#1%
3 {#1\crlf
4 \ctxcommand{verbose(#1, spanish)}}
5
6
conversion.
In core-con.mkiv, the `month` conversion calls `\monthlong`, which
calls the Lua command.month. But that prints the number of the current
month; \monthlong should call command.monthname, instead.
% core-con.mkiv, line 204
-\def\monthlong #1{\ctxcommand{month(#1)}}
+\def\monthlong #1
is to get a expandable version of the
list entry because \currentlistentrytitle itself isn’t expandable and can’t
be used in \doifelse. Instead of using \ctxcommand better ask Hans for
a raw/expandable version of the tile/pagenumber commands.
\setupheadertexts
[\setups{headlist}]
\startsetups
}
%\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle(\currentlist,\currentlistindex)}}
{\color[red] {\currentlistentrytitle}}
{\color[blue]{\currentlistentrytitle}}
\stoplinealignment
\par
\stopsetups
That's a neat and clean solution. Thanks Wolfgang.
Marco
][first]}{\currentlistentrytitle}
%\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle(\currentlist,\currentlistindex)}}
{\color[red] {\currentlistentrytitle}}
{\color[blue]{\currentlistentrytitle}}
\stoplinealignment
\par
\stopsetups
That's a neat and clean solution
[middle]
\doifelse{\fetchmark[chapter][first]}{\currentlistentrytitle}
%\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle(\currentlist,\currentlistindex)}}
{\color[red] {\currentlistentrytitle}}
{\color[blue]{\currentlistentrytitle}}
\stoplinealignment
\par
\externalfigure [dummy]
\stopTEXpage
\stopbuffer
\ctxcommand{runbuffer(\jobname.tmp, image, true)}
\starttext
\startMPcode
picture pic;
pic = externalfigure \jobname-\jobname.tmp.pdf scaled 1cm;
draw pic rotated 20;
\stopMPcode
\stoptext
Marco
here:
\startbuffer [image]
\useMPlibrary [dum]
\startTEXpage
\externalfigure [dummy]
\stopTEXpage
\stopbuffer
\ctxcommand{runbuffer(\jobname.tmp, image, true)}
\starttext
\startMPcode
picture pic;
pic = externalfigure \jobname-\jobname.tmp.pdf scaled 1cm;
draw pic rotated
{#first}\edef\x{#second}}%
\fi
\else
\edef\x{#first}%
\fi
\ctxcommand{matrix_with_symbol(\!!bs\sym\!!es, \x, \y)}%
\egroup%
}
\protect
\starttext
\startformula
\printsymbolmatrix[3]%% symbol is “a”, matrix is square
\stopformula
\startformula
\printsymbolmatrix[4][8
{\strc_define_commands_not...
\define_notation ...\fi \the \everydefinenotation
\let \currentnotation \sav...
inserted text ...noteparent ][\c!type =\v!note ]
\fi \ctxcommand
}}%
\edef\p_start{\counterparameter{#1}\c!start}%
\ctxcommand{checkcountersetup(#1,\currentcounterlevel,\ifx\p_start\empty0\else\number\p_start\fi,\counterparameter{#1}\c!state)}%
\fi}
ConTeXt uses \p_start to store the current value of the start parameter.
When you set now a value for start
{#1}\c!start}%
\ctxcommand{checkcountersetup(#1,\currentcounterlevel,\ifx\p_start\empty0\else\number\p_start\fi,\counterparameter{#1}\c!state)}%
\fi}
ConTeXt uses \p_start to store the current value of the start parameter.
When you set now a value for start in \setuppagenumber the value
that
odd and even are just dummy values. I can change them to anything, and can
in fact even turn \v!oddeven to a switch statement that returns multiple
values)
\unprotect
\def\redefineoddeven% HACK
{\def\v!oddeven##1% Return odd if in set 1-3, 7-9, etc. and even otherwise
{\ctxcommand
(setupsuffixtext,suffixes)%
%}
\ctxcommand{definelabels(prefix, prefixes )}
\ctxcommand{definelabels(unit,units)}
\ctxcommand{definelabels(operator,operators)}
\ctxcommand{definelabels(suffix, suffixes )}
Wolfgang
Hello,
sometimes in this mail discussion I'm encountering a Ctx/Lua command which has
been unknown for me or I would use other (known) commands to do the job.
So - would it be possible to explain
- what's the difference/advantage btw \directlua and \ctxlua
- what \ctxcommand{} does
- what
/advantage btw \directlua and \ctxlua
No difference, just another name, there are even more synonyms.
- what \ctxcommand{} does
\ctxcommand{...} == \ctxlua{commands}
- what \cldcontext{} does?
\cldcontext{...} == \ctxlua{context(...)}
There is also \cldcommand{...} which is a short form
sorts of things that are tricky in TeX:
\ctxlua{ commands.doifelse( string.len( -45 ) 5 ) }{long}{short}
Cheers,
Sietse
... Has been wikified -
http://wiki.contextgarden.net/Command/doif…;
For functions in the commands namespace you can write e.g.
\ctxcommand{doifelse(…)}{…}{…} instead
) }{long}{short}
Cheers,
Sietse
... Has been wikified -
http://wiki.contextgarden.net/Command/doif…;
For functions in the commands namespace you can write e.g.
\ctxcommand{doifelse(…)}{…}{…} instead of \ctxlua{commands.doifelse(…)}{…}{…}.
Wolfgang
... I also found another solution reposter before:
\ctxlua{commands.testcase(condition)}
{ If true...}
{If false}
Note that both blocks (if-true and if-false) are mandatory.
Considering Wolfgang's last answer, it would be better to write:
\ctxcommand{testcase(condition
{scrn_attachment_method_\v!hidden}%
{\ctxcommand{insertattachment{
tag= \currentattachment,
registered = \currentattachmentregistered,
method = \v!hidden
}}}
While such anonymizing mode may be required for some security-obsessed
people, who do not want filenames leak into shipped out
need a raw untagged and expandable fetch:
\def\rawstructurelistuservariable#name%
{\ctxcommand{listuserdata(\currentlist,\currentlistindex,#name)}}
\protect
% so, after some 5 lines patching we can do:
\starttext
\startplacefigure[reference=fig:mill,title={A Mill}][resource=mill
: in
function 'notedeltapage'
main ctx instance:1: in main chunk.
and finishes with:
\ctxcommand ...\directlua \zerocount {commands.#1}
\strc_notes_set_style_color_special ...tenumber
l.1 Prof.\
ABC
\ctxcommand ...\directlua \zerocount {commands.#1}
\handlenoteitself ...text \strc_notes_inject_text
\endstrut
\strc_constructi...
\handlenoteinsert ... {\handlenoteitself {#1}{#2
vic} \stopitem
\startitem Baz Pvt Ltd {\sc abc} \stopitem
\stopinstitm
\stopTEXpage
\stoptext
an \if going wild du eto a lack of \relax'ing
\unexpanded\def\getrandomcount #1#2#3%
{#1=\ctxcommand{getrandomcounta(\number#2,\number#3)}\relax
'
main ctx instance:1: in main chunk.
system tex error on line 24 in file c_2012-01_Johnson.tex:
LuaTeX error
…
ctxcommand ...\directlua \zerocount {commands.#1}
\strc_notes_set_style_color_special ...tenumber )}
\relax
traceback:
...TeXt/tex/texmf-context/tex/context/base/strc-not.lua:351: in
function 'notedeltapage'
main ctx instance:1: in main chunk.
system tex error on line 24 in file c_2012-01_Johnson.tex:
LuaTeX error
…
ctxcommand ...\directlua \zerocount {commands.#1
(tag,n)) end
function commands.notedeltapage (tag,n) context(getdeltapage (tag,n)) end
In strc-not.mkiv, the lines are:
\def\strc_notes_set_style_color_special
{\iftrialtypesetting
% keep
\else\ifx\currentcolorparameter\empty
\scratchcounter\ctxcommand{notedeltapage(\currentnote
{\iftrialtypesetting
% keep
\else\ifx\currentcolorparameter\empty
\scratchcounter\ctxcommand{notedeltapage(\currentnote,\currentnotenumber)}\relax
% todo calculate once
\setlocationcolorspecified\scratchcounter
\fi\fi}
\unexpanded\def\strc_notes_inject_pointer % todo
{\iftrialtypesetting
% keep
\else\ifx\currentcolorparameter\empty
\scratchcounter\ctxcommand{notedeltapage(\currentnote,\currentnotenumber)}\relax
% todo calculate once
\setlocationcolorspecified\scratchcounter
\fi\fi}
\unexpanded\def
1 - 100 of 153 matches
Mail list logo