Re: [NTG-context] For Windows users: ConTeXt + SciTe installation instructions updated
Lähetetty kännystäni / Sent from my iPhone On 20.10.2011, at 13.06, Hans Hagen pra...@wxs.nl wrote: On 20-10-2011 10:50, Lutz Haseloff wrote: if i install SciTe and the the ConTeXt files for SciTe on my Win 7 64 bit, i can no longer scroll the text in the editor. Windows quits SciTe because of an unknown error :-( Has someone else the same error? I assume that you installed the lexer lua libs too. I don't know if that one is 64 bit (I'm on a by now pretty old 32 bit machine). Hans I'm running 32-bit SciTe, because that's what I got by using Troy Simpson's Windows installer for SciTe; both my work laptop and the Win 7 Home I used to test my wiki text are 64-bit computers. The stuff on the wiki worked on those two computers, can't vouch for anything else... Or, rather: SciTe got installed into the (x86) directory, so I just *assumed* that it is a 32-bit version. Mari ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] For Windows users: ConTeXt + SciTe installation instructions updated
2011/10/20 Mari Voipio mvoi...@gmail.com: Lähetetty kännystäni / Sent from my iPhone On 20.10.2011, at 13.06, Hans Hagen pra...@wxs.nl wrote: On 20-10-2011 10:50, Lutz Haseloff wrote: if i install SciTe and the the ConTeXt files for SciTe on my Win 7 64 bit, i can no longer scroll the text in the editor. Windows quits SciTe because of an unknown error :-( Has someone else the same error? I assume that you installed the lexer lua libs too. I don't know if that one is 64 bit (I'm on a by now pretty old 32 bit machine). Hans I'm running 32-bit SciTe, because that's what I got by using Troy Simpson's Windows installer for SciTe; both my work laptop and the Win 7 Home I used to test my wiki text are 64-bit computers. The stuff on the wiki worked on those two computers, can't vouch for anything else... Or, rather: SciTe got installed into the (x86) directory, so I just *assumed* that it is a 32-bit version. I tried to install SciTe/ConTeXt on a WinXP 32 bit machine. I installed Troy Simpson's Windows installer for SciTe, deleted all filles except SciTe.exe, SciTEGlobal.properties and SciLexer.dll. Then I copied the files from scintillua229-1.zip and from /context/data/scite to the progran directory. The problem remains. Scrolling in my 4000+ lines file crashes SciTe. Without the line import scite-context-user in SciTEGlobal.properties scrolling works without problems. Lutz ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] For Windows users: ConTeXt + SciTe installation instructions updated
On 21-10-2011 08:42, Lutz Haseloff wrote: The problem remains. Scrolling in my 4000+ lines file crashes SciTe. Any file or just that one? If only that one, can you send it? (the problem is that there are no error messages in the windows version - that is, i have no clue how to intercept the gui's output) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Links in exported XHTML file
Hi all, how do I manage to get proper links in the exported XHTML document. It works well with intern references. \setupinteraction[state=start] \setupbackend[export=yes,xhtml=yes,css=export-example.css] \starttext \useURL[google][http://www.google.com/][][Google] \from[google] \textreference[txt:ref]{some text} \in[txt:ref] % OK \goto{Google}[url(http://www.google.com/)] \stoptext I would appreciate any tips. Regards Andreas ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] For Windows users: ConTeXt + SciTe installation instructions updated
2011/10/21 Hans Hagen pra...@wxs.nl: On 21-10-2011 08:42, Lutz Haseloff wrote: The problem remains. Scrolling in my 4000+ lines file crashes SciTe. Any file or just that one? If only that one, can you send it? Any fairly large tex file (about 3000 lines). If I rename the files to *.text, scrolling works. The same effect I get if I select a large chunk of the text and do Shift-F11 wrap. (the problem is that there are no error messages in the windows version - that is, i have no clue how to intercept the gui's output) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] For Windows users: ConTeXt + SciTe installation instructions updated
On 21-10-2011 11:35, Lutz Haseloff wrote: 2011/10/21 Hans Hagenpra...@wxs.nl: On 21-10-2011 08:42, Lutz Haseloff wrote: The problem remains. Scrolling in my 4000+ lines file crashes SciTe. Any file or just that one? If only that one, can you send it? Any fairly large tex file (about 3000 lines). If I rename the files to *.text, scrolling works. The same effect I get if I select a large chunk of the text and do Shift-F11 wrap. The lexer gets pretty large chunks (basically from start to current) .. a good test is to go to the end of the document which lexes the whole; after that some sort of whitespace analysis determines what local (nested) lexer to use .. at least that's what the basic lexing framework does ... I'm still wondering if I should redo that part (I already rewrote some of the lua code to be more efficient). Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Error with anglebetween(…)
Hello Hans, has something changed with the anglebetween definition in MetaPost? I’m sure this worked a couple of betas ago. \startMPpage path p,q ; p := origin -- (50,0) ; q := origin -- (50,50); drawarrow anglebetween(p,q,somelabel) ; \stopMPpage ! Missing `)' has been inserted. Regards Andreas ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Image compression/resizing in PDFs
Hi all, Is there a way to have context automatically compress or resample included images to a given output resolution? I have not been following recent developments... I can obviously pre-reduce all images to the desired dpi. But: 1) This is a bit of work (and hard to get non-technical people to do) 2) In 5 years time we might want the images to be higher resolution and not be as concerned about PDF size. But the information will be lost (or be elsewhere). So a command line or document setting would be ideal, is there such a thing? \setpdfimageresolution[300dpi]. Thanks, -- John Devereux ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] accessibility of PDF (inter word space
Hello, I am very new in Context and have my first Problems. I read a lot, but can't find the solution. I try to produce accessible PDF. One Point is, that they have to be reflowed in a PDF-Viewer. But if I reflow my documents, there are no interwordspaces. I know that there is no space-character in Tex. I found an work-around for pdftex with an patch. \pdfmapline{+dummy-space dummy-space.pfb} \pdfgeninterwordspace But how can I do this in Context mkiv? Thanks Stefan -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaFun: Confusion with `function()` and `xyscaled`
Am Freitag, den 21.10.2011, 01:14 +0200 schrieb Paul Menzel: Dear ConTeXt/MetaFun folks, looking at the example for grid and functions in the MetaFun manual [1] section 9.3 drawoptions(withpen pencircle scaled .25pt withcolor .5white) ; draw hlingrid(0, 20, .2, 20cm, 10cm) ; draw vloggrid(0, 10, .5, 10cm, 20cm) ; drawoptions(withpen pencircle scaled .50pt) ; draw hlingrid(0, 20, 1, 20cm, 10cm) ; draw vloggrid(0, 10, 1, 10cm, 20cm) ; fmt_pictures := false ; % use TeX as formatting engine textextoffset := ExHeight ; % a variable set by ConTeXt draw hlintext.lft(0, 20, 5, 20cm, @3e) ; draw vlogtext.bot(0, 10, 9, 10cm, @3e) ; draw function(1,log(x),x,1,10,1) xyscaled (10cm,2cm) withpen pencircle scaled 5mm withcolor transparent(1,.5,yellow) ; I am confused how the resulting function is scaled correctly. The resulting dimensions seem to be 10cm and 18 cm. So I guess the 2 cm mean to shift it up some how. Could someone please explain to me how `xyscaled` works in this case please. I though `xyscaled (αcm, ζcm)` would set the object/path to a width of α cm and a height of ζ cm. Looking up the definition of the macro `xyscaled` it is indeed just a short version of `xscaled αcm yscaled ζcm`. $ more mp-tool.mp […] %D More robust: % let normalscaled = scaled ; % let normalxscaled = xscaled ; % let normalyscaled = yscaled ; % % def scaled expr s = normalscaled (s) enddef ; % def xscaled expr s = normalxscaled (s) enddef ; % def yscaled expr s = normalyscaled (s) enddef ; %D Shorter primarydef p xyscaled q = begingroup ; save qq ; pair qq ; qq = paired(q) ; ( p if xpart qq0 : xscaled (xpart qq) fi if ypart qq0 : yscaled (ypart qq) fi ) endgroup enddef ; […] I am still confused though what happens in the above example scaling the path of the function. Trying \starttext \startMPcode draw fullsquare xscaled 10cm yscaled 2cm; \stopMPcode \stoptext the resulting rectangle has the dimensions of 10 cm width and 2 cm height but the path of the function above does not. Thanks, Paul [1] http://www.pragma-ade.com/general/manuals/metafun-s.pdf signature.asc Description: This is a digitally signed message part ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] metapost question
I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. Hans van der Meer ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Image compression/resizing in PDFs
On Fri, Oct 21 2011, John Devereux wrote: Is there a way to have context automatically compress or resample included images to a given output resolution? Hello, See also http://archive.contextgarden.net/thread/20110629.173015.6dcd7b3e.en.html t-degrade.tex is broken with latest context. If you fix it (should be easy), please send me the patch! :-) (Sorry, too busy now for fixing it myself...) -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaFun: Confusion with `function()` and `xyscaled`
Hi Paul, I agree, this is confusing on the first sight. But scaling is not meant as 'scaling to' a dimension. In fact is is just a simple multiplication. The reason why it seems to work this way with 'fullsquare' and such predefined paths is, that they have a 'neutral' size/scale (bounding box size of filled path is (1pt,1pt)). Multiplying such a path with (x,y) gives an object with size (1*x,1*y). In general: if the bounding box of an object has the size (a,b) and you scale it with (x,y), the resulting object has a size of (ax,by). That's all the magic. I must admit that this wasn't clear to me before you came up with your question. So thanks for that. :-) Best wishes, Peter Am 21.10.2011 13:38, schrieb Paul Menzel: Am Freitag, den 21.10.2011, 01:14 +0200 schrieb Paul Menzel: Dear ConTeXt/MetaFun folks, looking at the example for grid and functions in the MetaFun manual [1] section 9.3 drawoptions(withpen pencircle scaled .25pt withcolor .5white) ; draw hlingrid(0, 20, .2, 20cm, 10cm) ; draw vloggrid(0, 10, .5, 10cm, 20cm) ; drawoptions(withpen pencircle scaled .50pt) ; draw hlingrid(0, 20, 1, 20cm, 10cm) ; draw vloggrid(0, 10, 1, 10cm, 20cm) ; fmt_pictures := false ; % use TeX as formatting engine textextoffset := ExHeight ; % a variable set by ConTeXt draw hlintext.lft(0, 20, 5, 20cm, @3e) ; draw vlogtext.bot(0, 10, 9, 10cm, @3e) ; draw function(1,log(x),x,1,10,1) xyscaled (10cm,2cm) withpen pencircle scaled 5mm withcolor transparent(1,.5,yellow) ; I am confused how the resulting function is scaled correctly. The resulting dimensions seem to be 10cm and 18 cm. So I guess the 2 cm mean to shift it up some how. Could someone please explain to me how `xyscaled` works in this case please. I though `xyscaled (αcm, ζcm)` would set the object/path to a width of α cm and a height of ζ cm. Looking up the definition of the macro `xyscaled` it is indeed just a short version of `xscaled αcm yscaled ζcm`. $ more mp-tool.mp […] %D More robust: % let normalscaled = scaled ; % let normalxscaled = xscaled ; % let normalyscaled = yscaled ; % % def scaled expr s = normalscaled (s) enddef ; % def xscaled expr s = normalxscaled (s) enddef ; % def yscaled expr s = normalyscaled (s) enddef ; %D Shorter primarydef p xyscaled q = begingroup ; save qq ; pair qq ; qq = paired(q) ; ( p if xpart qq0 : xscaled (xpart qq) fi if ypart qq0 : yscaled (ypart qq) fi ) endgroup enddef ; […] I am still confused though what happens in the above example scaling the path of the function. Trying \starttext \startMPcode draw fullsquare xscaled 10cm yscaled 2cm; \stopMPcode \stoptext the resulting rectangle has the dimensions of 10 cm width and 2 cm height but the path of the function above does not. Thanks, Paul [1] http://www.pragma-ade.com/general/manuals/metafun-s.pdf ___ 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 : http://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
Am 21.10.2011 15:05, schrieb Hans van der Meer: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: Have you already tried if modifier = : else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. Hans van der Meer ___ 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 : http://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost: Confusion with `function()` and `xyscaled`
Dear Peter, thank you for your answer. Am Freitag, den 21.10.2011, 17:02 +0200 schrieb Peter Rolf: I agree, this is confusing on the first sight. But scaling is not meant as 'scaling to' a dimension. In fact is is just a simple multiplication. The reason why it seems to work this way with 'fullsquare' and such predefined paths is, that they have a 'neutral' size/scale (bounding box size of filled path is (1pt,1pt)). So how can I find out what the dimension of the path of a function is? Not scaling it, it also looked pretty small, so I am guessing (1pt,1pt). Multiplying such a path with (x,y) gives an object with size (1*x,1*y). In general: if the bounding box of an object has the size (a,b) and you scale it with (x,y), the resulting object has a size of (ax,by). That's all the magic. but if you use numbers with a unit than it should not be multiplied but expanded to that value, should not it? Otherwise I am unsure how multiplication works with a unit. I must admit that this wasn't clear to me before you came up with your question. So thanks for that. :-) Thank you for your answer. As written above it is still not entirely clear to me. I hope you can remedy my last confusion. Thanks a lot, Paul signature.asc Description: This is a digitally signed message part ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
On 21 okt. 2011, at 17:13, Peter Rolf wrote: Am 21.10.2011 15:05, schrieb Hans van der Meer: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: Have you already tried if modifier = : else: fi enddef; I tried it now, but it doesn't work. Something like if(TEXT4) =:;fi in the error log. No, Metapost is not happy with this construct. How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. Hans van der Meer ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaPost: Confusion with `function()` and `xyscaled`
Am 21.10.2011 17:26, schrieb Paul Menzel: Dear Peter, thank you for your answer. Am Freitag, den 21.10.2011, 17:02 +0200 schrieb Peter Rolf: I agree, this is confusing on the first sight. But scaling is not meant as 'scaling to' a dimension. In fact is is just a simple multiplication. The reason why it seems to work this way with 'fullsquare' and such predefined paths is, that they have a 'neutral' size/scale (bounding box size of filled path is (1pt,1pt)). So how can I find out what the dimension of the path of a function is? Not scaling it, it also looked pretty small, so I am guessing (1pt,1pt). I guess in this case its size is (10,log(10)) + pen size when drawn. Multiplying such a path with (x,y) gives an object with size (1*x,1*y). In general: if the bounding box of an object has the size (a,b) and you scale it with (x,y), the resulting object has a size of (ax,by). That's all the magic. but if you use numbers with a unit than it should not be multiplied but expanded to that value, should not it? Otherwise I am unsure how multiplication works with a unit. 1pt is the base unit in MP (used if no dimension is given; probably stored as 65536sp (scaled point) units). Now if you use pure numerics for scale, such as 'xscaled 2', this is interpreted as '2pt' (or 2*65536sp). If you use any dimension, it is also converted into scaled points. All the same for MP. If I'm right this should all be the same (untested) xscaled 2 xscaled 2pt xscaled (2*65536sp) 1 = 1pt = 65536sp I must admit that this wasn't clear to me before you came up with your question. So thanks for that. :-) Thank you for your answer. As written above it is still not entirely clear to me. I hope you can remedy my last confusion. Thanks a lot, Paul ___ 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 : http://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
In article 0e2e620e-1148-41ad-9966-54a594fcc...@xs4all.nl, Hans van der Meer havdm...@xs4all.nl wrote: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. A text argument is a (more or less) arbitrary sequence of tokens—that is, loosely speaking, any “chunk” of MetaPost code. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text This is the best I could think of: vardef emptytext?@# text t = (str @# = empty.sandwich) enddef; def mydef(expr a,b,c) text t = if begingroup emptytext? empty t sandwich endgroup: % t is empty draw unitsquare scaled 1cm; else: % t is not empty fill unitsquare scaled 1cm t ; fi; enddef; The key is the 'emptytext? empty t sandwich;' line: if t is empty, @# matches 'empty.sandwich', otherwise it matches 'empty' possibly followed by something else (depending on what t actually is). The undelimited text parameter of emptytext? is needed to “swallow” whatever tokens are left (possibly none) after matching the implicit suffix parameter. Note that begingroup and endgroup are necessary in the if clause, otherwise emptytext?'s undelimited text parameter will match beyond the colon. In practice, you should rename 'sandwich' to some token that you are pretty sure will never occur as the beginning of the text argument when you invoke mydef. I'd be glad to hear about other solutions: this question has bugged me for some time… Regards, Nicola ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] metapost question
Peter, Thanks for trying to help. Because I solved the problem in another way you might be interested or even benefit from it. The underlying problem was drawing a border around a picture of given dimensions. The border being either colored or left uncolored. The border color should come from a withcolor modifier, with the uncolored case done simply by leaving this out, for example: borderinsideframe(u,v,2g); and borderinsideframe(u,v,2g) withcolor red; It turns out this can be done with an unfill. I learned that a bare unfill erases, but add a withcolor modifier and the effect is a coloring. Thus the trick is: def bordercolorframe (expr w, h, off, clr) text modifier = unfill (-off,-off)--(w+off,-off)--(w+off,h+off)--(-off,h+off)--cycle modifier; fill (0,0)--(w,0)--(w,h)--(0,h)--cycle withcolor clr enddef; The omission of a semicolon after the last statement of the def allows one to add in a withcolor somecolor without triggering an error. Hope this will be of use to someone. Hans van der Meer On 21 okt. 2011, at 17:13, Peter Rolf wrote: Am 21.10.2011 15:05, schrieb Hans van der Meer: I cannot find the answer to the following question in Knuth's Metafont book. The following definition with a trailing text argument: def mydef (expr a, b, c) text modifier = if modifier = empty: Have you already tried if modifier = : else: fi enddef; How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. I must do the switch, because fill modifier with an empty modifier gives horrible results. Usage would be calls like: mydef(1,2,3) withcolor green; % with modifier text mydef(1,2,3); % without modifier text Thanks in advance. Hans van der Meer ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Standardmakeup
Thank you Wolfgang. I do not remember but there was a time where \godown would not work without the strut. So I have mistaken this. And indeed the result is ok whithout the start- stoplines. Thanks! Willi On 20 Oct 2011, at 15:42, Wolfgang Schuster wrote: Am 19.10.2011 um 22:03 schrieb Willi Egger: Hi, Hans told me, that one needs to set before and after for the lines to nil. Indeed that solves the problem as long as you do not want to insert extra white space between the lines. The effect of moving down the lines occurs also with inserting an empty line. Add \vfill before \stopstandardmakeup. \setupmakeup[standard][top=,bottom=] \setuplines[before=,after=] \starttext \startstandardmakeup[doublesided=no,page=yes] \strut \godown[.25\textheight] \startalignment[middle] \startlines {\bfd Der Titel} \blank[line] {\bf De Untertitel} \stoplines \stopalignment \stopstandardmakeup \stoptext You don’t need the lines environment because with the blank you get two separate lines and the \strut is a bad idea because you get at the top a extra line with the command. \startstandardmakeup[doublesided=no,align=middle,page=yes] \godown[.25\textheight] {\bfd Der Titel} \blank[line] {\bf De Untertitel} \vfill \stopstandardmakeup 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 : http://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] processing style inside verbatim in XML
Hello, Is there any simple way to typeset the following example properly in ConTeXt? I have an example of text that has to obey lines and spaces, but I would like to apply some color to make it more readable. The attachment contains an example of HTML which displays fine in my browser, and it should look similar with ConTeXt. I have problems with literal typesetting of span class=... (that should have applied style instead), but maybe I only have wrong settings in my parser. When I use \xmlsetfunction{main}{pre}{lxml.displayverbatim}, then I cannot color the numbers. When I use, according to Wolfgang's suggestion, \startxmlsetups pre \setuplines[style=mono,space=yes] \startlines \xmlflush{#1} \stoplines \stopxmlsetups then all the spaces are eaten up by XML parser (or somewhere else), so that I don't get the desired result. Any ideas about this? I'm also sending a self-contained example with \setuplines which doesn't really work in the desired way. Thank you very much, Mojca . h y p h e n a t i o n . - 1n a 1t i o 2i o h e2n h e n5a t h e n a4 h y3p h n2a t o2n - . h y3p h e2n5a4t2i o2n. hyp.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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] MetaFun: Confusion with `function()` and `xyscaled`
Could someone please explain to me how `xyscaled` works in this case please. I though `xyscaled (αcm, ζcm)` would set the object/path to a width of α cm and a height of ζ cm. IIRC, xysized does that. (I am usually confused between ..sized and ..scaled, but one of them scales to the given dimensions). 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___