Hi, I'd like to change the phrase "if lastskip equals \EinsSignal set vskip to 0pt else ..." to "if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... " in the following code ... \newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...] Some native (tex)speaker can help me translating? Steffen
On Sep 10, 2008, at 1:49 PM, Steffen Wolfrum wrote:
Hi,
I'd like to change the phrase
"if lastskip equals \EinsSignal set vskip to 0pt else ..."
to
"if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... "
in the following code ...
\newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...]
Some native (tex)speaker can help me translating?
Steffen I'm not a native texspeaker, but this should wo what you want:
\def\EbeneDreibefore% {\ifdim\lastskip=\EinsSignal \vskip-0pt% \else\ifdim\lastskip=\ZweiSignal \vskip-2pt% \else \blank[20pt]% \fi% \fi} You just nest the two \ifdim tests. Thomas
Dnia Wed, Sep 10, 2008 at 01:49:52PM +0200, Steffen Wolfrum napisał(a):
Hi,
I'd like to change the phrase
"if lastskip equals \EinsSignal set vskip to 0pt else ..."
to
"if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... "
in the following code ...
\newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...]
What about just that you wrote? \ifdim ... \else\ifdim ... \fi\fi
Some native (tex)speaker can help me translating?
Non-native, but close (OTOH, not so close as Hans;)) -- Marcin Borkowski (http://mbork.faculty.fmcs.amu.edu.pl) <><
Thanks Marcin, that's it! BTW: what language is that actually? TeX or ConTeXt? I'd like to learn some more then just "Hello World" ;o) Steffen Am 10.09.2008 um 14:15 schrieb Marcin Borkowski:
Dnia Wed, Sep 10, 2008 at 01:49:52PM +0200, Steffen Wolfrum napisał(a):
Hi,
I'd like to change the phrase
"if lastskip equals \EinsSignal set vskip to 0pt else ..."
to
"if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... "
in the following code ...
\newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...]
What about just that you wrote?
\ifdim ... \else\ifdim ... \fi\fi
Some native (tex)speaker can help me translating?
Non-native, but close (OTOH, not so close as Hans;))
-- Marcin Borkowski (http://mbork.faculty.fmcs.amu.edu.pl)
<>< ___________________________________________________________________________________ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Marcin Borkowski wrote:
Dnia Wed, Sep 10, 2008 at 01:49:52PM +0200, Steffen Wolfrum napisał(a):
Hi,
I'd like to change the phrase
"if lastskip equals \EinsSignal set vskip to 0pt else ..."
to
"if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... "
in the following code ...
\newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...]
What about just that you wrote?
\ifdim ... \else\ifdim ... \fi\fi
Some native (tex)speaker can help me translating?
Non-native, but close (OTOH, not so close as Hans;))
ok then, an obscure solution for the natives ... untested: \setvalue{Ebene:\the\dimexpr 0pt\relax}{1pt} \setvalue{Ebene:\the\dimexpr 1pt\relax}{-2pt} \vskip\executeifdefined{Ebene:\the\lastskip}{0pt}\relax ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Wed, Sep 10, 2008 at 2:31 PM, Hans Hagen
Marcin Borkowski wrote:
Dnia Wed, Sep 10, 2008 at 01:49:52PM +0200, Steffen Wolfrum napisał(a):
Hi,
I'd like to change the phrase
"if lastskip equals \EinsSignal set vskip to 0pt else ..."
to
"if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... "
in the following code ...
\newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...]
What about just that you wrote?
\ifdim ... \else\ifdim ... \fi\fi
Some native (tex)speaker can help me translating?
Non-native, but close (OTOH, not so close as Hans;))
ok then, an obscure solution for the natives ... untested:
\setvalue{Ebene:\the\dimexpr 0pt\relax}{1pt} \setvalue{Ebene:\the\dimexpr 1pt\relax}{-2pt}
\vskip\executeifdefined{Ebene:\the\lastskip}{0pt}\relax
But this is newspeak ;-) Wolfgang
Wolfgang Schuster wrote:
On Wed, Sep 10, 2008 at 2:31 PM, Hans Hagen
wrote: Marcin Borkowski wrote:
Dnia Wed, Sep 10, 2008 at 01:49:52PM +0200, Steffen Wolfrum napisał(a):
Hi,
I'd like to change the phrase
"if lastskip equals \EinsSignal set vskip to 0pt else ..."
to
"if lastskip equals \EinsSignal set vskip to 0pt else if lastskip equals \\ZweiSignal set vskip to -2pt else ... "
in the following code ...
\newsignal\ZweiSignal \def\EbeneDreibefore {\ifdim\lastskip=\EinsSignal \vskip-0pt \else \blank[20pt]\fi} \setuphead[EbeneDrei][...,before=\EbeneDreibefore,...] What about just that you wrote?
\ifdim ... \else\ifdim ... \fi\fi
Some native (tex)speaker can help me translating? Non-native, but close (OTOH, not so close as Hans;)) ok then, an obscure solution for the natives ... untested:
\setvalue{Ebene:\the\dimexpr 0pt\relax}{1pt} \setvalue{Ebene:\the\dimexpr 1pt\relax}{-2pt}
\vskip\executeifdefined{Ebene:\the\lastskip}{0pt}\relax
But this is newspeak ;-)
newspeak would be using an attribute and postprocessing the node list -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 10.09.2008 um 17:15 schrieb Hans Hagen:
newspeak would be using an attribute and postprocessing the node list -)
How could I write this in newspeak: \newsignal\yesnosignal \def\yesno{\scratchdimen\lastskip\ifdim\scratchdimen=\yesnosignal YES \else NO\fi} \starttext text \hskip\yesnosignal \yesno\ text \hskip\yesnosignal text \yesno\ text \stoptext Wolfgang
Wolfgang Schuster wrote:
Am 10.09.2008 um 17:15 schrieb Hans Hagen:
newspeak would be using an attribute and postprocessing the node list -)
How could I write this in newspeak:
\newsignal\yesnosignal
\def\yesno{\scratchdimen\lastskip\ifdim\scratchdimen=\yesnosignal YES \else NO\fi}
in traditional speak: \def\YesNo{\relax\ifdim\lastskip=\yesnosignal YES\else NO\fi}
\starttext
text \hskip\yesnosignal \yesno\ text \hskip\yesnosignal text \yesno\ text
\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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sat, Sep 13, 2008 at 2:18 PM, Wolfgang Schuster
Am 10.09.2008 um 17:15 schrieb Hans Hagen:
newspeak would be using an attribute and postprocessing the node list -)
How could I write this in newspeak:
\newsignal\yesnosignal
\def\yesno{\scratchdimen\lastskip\ifdim\scratchdimen=\yesnosignal YES \else NO\fi}
\starttext
text \hskip\yesnosignal \yesno\ text \hskip\yesnosignal text \yesno\ text
\stoptext
It's no mkiv way (aka "newspeak") . I worked to something like this at Bohinj (I don't know why '25' in an.number==25 ) . I'm not sure that it works, If i have time I will check it . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def\StudyBox#1#2#3{% \startluacode nodes = nodes or {} local traverse_id = node.traverse_id local head = tex.box[#1].list local m = 0 local hlist, vlist, whatsit,glue = node.id('hlist'), node.id('vlist'), node.id('whatsit'),node.id('glue') local attribute = node.id('attribute') local attributeList = node.id('attribute_list') texio.write_nl(' ** SigStartC='..tostring(tex.count['SignalStartC'])..' SigStopC='..tostring(tex.count['SignalStopC'])..'\n') local SigStartC = #2 or 0 local SigStopC = #3 or 0 local function searchrecursive(head) %%-- if node.type(head.id)== 'rule' then attlist = head.attr %%print("==>",tostring(nodes.serialize(nodes.totable(head)))) for an in node.traverse(attlist) do if node.has_field(an, 'number') and node.has_field(an, 'value') and an.number==25 and an.value==101 then texio.write_nl('SigStartC INCRESEAD'..'\n') SigStartC = SigStartC +1 end if node.has_field(an, 'number') and node.has_field(an, 'value') and an.number==25 and an.value==111 then texio.write_nl('SigStop decresead'..'\n') SigStopC = SigStopC +1 end end %%-- end if node.has_field(head,'list') then %%-- print("ok") for n in node.traverse(head.list) do %%-- print(tostring(n)) searchrecursive(n) end end end texio.write_nl('SigStartC='..SigStartC..' SigStopC='..SigStopC..'\n') searchrecursive(tex.box[#1]) texio.write_nl('SigStartC='..SigStartC..' SigStopC='..SigStopC..'\n') tex.setcount('SignalStartC',SigStartC) tex.setcount('SignalStopC',SigStopC) \stopluacode} \global\newcount\SignalStartC \global\newcount\SignalStopC \defineattribute[SigStart] \def\SignalStart{\hbox attr\dogetattributeid{SigStart}=101 to 0sp {\vrule width 0sp height0sp depth0sp}} \def\SignalStop{\hbox attr\dogetattributeid{SigStart}=111 to 0sp {\vrule width 0sp height0sp depth0sp}} \starttext \setbox100=\vbox{ \nobreak\SignalStart\nobreak Some text . \nobreak\SignalStop\nobreak } \StudyBox{100}{\the\SignalStartC}{\the\SignalStopC}% end \stoptext %%%%%%%%%%%%%%%% See log and output for some -- luigi
participants (6)
-
Hans Hagen
-
luigi scarso
-
Marcin Borkowski
-
Steffen Wolfrum
-
Thomas A. Schmitz
-
Wolfgang Schuster