Re: [NTG-context] How to check if buffer or block has content
That's great, I wikified a Note for testing if a buffer exists or has content (using the \getbuffer[…] approach for the moment). If I was asked, I'd opt for \doifelseemptybuffer (doifemptyelse?) since one could think of similar commands that test for empty "objects". Is there an option for testing blocks? (I actually use blocks quite frequently …) I just realized they are probably handled very differently during the typesetting. Basically I would just need to test if during the first run any of \beginBLOCK … \endBLOCK was invoked (but if one gets a test for some content in-between that's even better). As an alternative solution, is there a way to add content to buffers? Unfortunately, I can't use \getbuffer[first,second], but \startbuffer[first][add=yes] … \stopbuffer would be nice. Thanks! Benjamin > On Aug 2, 2021, at 17:17, ntg-context-requ...@ntg.nl wrote: > > \starttext > > \startbuffer[test] > test > \stopbuffer > > \doifelsebuffer{test} {YES} {NOP} > > \permanent\protected\def\doifelsebuffercontent#1% > {\doifelse{\luaexpr{(string.strip(buffers.getcontent("#1")) ~= "" and > "yes")}}{yes}} > > \startbuffer[test] > \stopbuffer > > \doifelsebuffercontent{test} {YES} {NOP} > > \startbuffer[test] > > \stopbuffer > > \doifelsebuffercontent{test} {YES} {NOP} > > \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to check if buffer or block has content
Hans Hagen via ntg-context schrieb am 02.08.2021 um 17:17: On 8/2/2021 4:43 PM, Aditya Mahajan via ntg-context wrote: On Mon, 2 Aug 2021, Benjamin Buchmuller via ntg-context wrote: Hi, How can I check if a buffer or block has content (or is empty) before a \useblocks or \getbuffer statement? I would like to typeset a headline only if the buffer/block has been used in a particular section and want to avoid headlines with empty sections. There may be more efficient ways to do it (since buffers are stored at the lua end), but you can always do \doiftextelse(\getbuffer[...]} to test it buffer creates any output. indeed you know there is a way ... \starttext \startbuffer[test] test \stopbuffer \doifelsebuffer{test} {YES} {NOP} \permanent\protected\def\doifelsebuffercontent#1% {\doifelse{\luaexpr{(string.strip(buffers.getcontent("#1")) ~= "" and "yes")}}{yes}} \startbuffer[test] \stopbuffer \doifelsebuffercontent{test} {YES} {NOP} \startbuffer[test] \stopbuffer \doifelsebuffercontent{test} {YES} {NOP} \stoptext if we can agree on a proper name then i can add a (more efficient) \doifelse... To follow the existing commands we can use \doifelsebufferempty \doifelsebuffersomething \doifelsebuffernothing or (we already have \xmldoif... and \btxdoif...) \bufferdoifelseempty \bufferdoifelsesomething \bufferdoifelsenothing Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to check if buffer or block has content
Hans van der Meer via ntg-context schrieb am 02.08.2021 um 18:21: And in pathological cases where even this does not work (as I encountered a few days ago): \setbox\scratchbox=\vboxx{content}\ifdim\wd\scratchbox>\zeropoint .. \else .. \fi This is how \doiftext works but it uses a \hbox. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to check if buffer or block has content
And in pathological cases where even this does not work (as I encountered a few days ago): \setbox\scratchbox=\vboxx{content}\ifdim\wd\scratchbox>\zeropoint .. \else .. \fi dr. Hans van der Meer > On 2 Aug 2021, at 17:17, Hans Hagen via ntg-context > wrote: > > On 8/2/2021 4:43 PM, Aditya Mahajan via ntg-context wrote: >> On Mon, 2 Aug 2021, Benjamin Buchmuller via ntg-context wrote: >>> Hi, >>> >>> How can I check if a buffer or block has content (or is empty) before a >>> \useblocks or \getbuffer statement? >>> >>> I would like to typeset a headline only if the buffer/block has been used >>> in a particular section and want to avoid headlines with empty sections. >> There may be more efficient ways to do it (since buffers are stored at the >> lua end), but you can always do \doiftextelse(\getbuffer[...]} to test it >> buffer creates any output. > indeed you know there is a way ... > > \starttext > > \startbuffer[test] > test > \stopbuffer > > \doifelsebuffer{test} {YES} {NOP} > > \permanent\protected\def\doifelsebuffercontent#1% > {\doifelse{\luaexpr{(string.strip(buffers.getcontent("#1")) ~= "" and > "yes")}}{yes}} > > \startbuffer[test] > \stopbuffer > > \doifelsebuffercontent{test} {YES} {NOP} > > \startbuffer[test] > > \stopbuffer > > \doifelsebuffercontent{test} {YES} {NOP} > > \stoptext > > if we can agree on a proper name then i can add a (more efficient) > \doifelse... > > Hans > > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > - > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] using a red frame as an overlay
On 8/2/2021 1:38 PM, Jeong Dal via ntg-context wrote: Hi, I used red frame which is in the metafun manual for long time. But it is not working now. Here is a MWE and a part of the log file. What should I change in the definitions? just update I am using "ConTeXt ver: 2021.07.10 21:51 LMTX fmt: 2021.7.12 int: english/english”. (some argument issue already resolved as side effect of stacking support) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to check if buffer or block has content
On 8/2/2021 4:43 PM, Aditya Mahajan via ntg-context wrote: On Mon, 2 Aug 2021, Benjamin Buchmuller via ntg-context wrote: Hi, How can I check if a buffer or block has content (or is empty) before a \useblocks or \getbuffer statement? I would like to typeset a headline only if the buffer/block has been used in a particular section and want to avoid headlines with empty sections. There may be more efficient ways to do it (since buffers are stored at the lua end), but you can always do \doiftextelse(\getbuffer[...]} to test it buffer creates any output. indeed you know there is a way ... \starttext \startbuffer[test] test \stopbuffer \doifelsebuffer{test} {YES} {NOP} \permanent\protected\def\doifelsebuffercontent#1% {\doifelse{\luaexpr{(string.strip(buffers.getcontent("#1")) ~= "" and "yes")}}{yes}} \startbuffer[test] \stopbuffer \doifelsebuffercontent{test} {YES} {NOP} \startbuffer[test] \stopbuffer \doifelsebuffercontent{test} {YES} {NOP} \stoptext if we can agree on a proper name then i can add a (more efficient) \doifelse... Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to check if buffer or block has content
On Mon, 2 Aug 2021, Benjamin Buchmuller via ntg-context wrote: > Hi, > > How can I check if a buffer or block has content (or is empty) before a > \useblocks or \getbuffer statement? > > I would like to typeset a headline only if the buffer/block has been used in > a particular section and want to avoid headlines with empty sections. There may be more efficient ways to do it (since buffers are stored at the lua end), but you can always do \doiftextelse(\getbuffer[...]} to test it buffer creates any output. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] How to check if buffer or block has content
Hi, How can I check if a buffer or block has content (or is empty) before a \useblocks or \getbuffer statement? I would like to typeset a headline only if the buffer/block has been used in a particular section and want to avoid headlines with empty sections. Thanks! Benjamin ___ 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] using a red frame as an overlay
Hi, I used red frame which is in the metafun manual for long time. But it is not working now. Here is a MWE and a part of the log file. What should I change in the definitions? I am using "ConTeXt ver: 2021.07.10 21:51 LMTX fmt: 2021.7.12 int: english/english”. framed Text with title %%% \startuseMPgraphic{redFrame} picture p ; numeric o ; path a, b ; pair c ; p := textext.rt(\MPstring{FrameText}) ; o := BodyFontSize ; a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; p := p shifted (2o,OverlayHeight-ypart center p) ; drawoptions (withpen pencircle scaled 1pt withcolor .625red) ; b := a superellipsed .95 ; %fill b withcolor .85white ; draw b ; b := (boundingbox p) superellipsed .95 ; fill b withcolor .85white ; %.425green;%. draw b ; draw p withcolor black ; setbounds currentpicture to a ; \stopuseMPgraphic \defineoverlay[rFrame][\useMPgraphic{redFrame}] \defineframedtext[rfText] [frame=off, background=rFrame, offset=\bodyfontsize, width=\textwidth, before=\blank, after=\blank] \def\StartFrame{\blank\startrfText} \def\StopFrame {\stoprfText\blank} \starttext \StartFrame This is a test for the frame. This is a test for the frame. This is a test for the frame. This is a test for the frame. This is a test for the frame. This is a test for the frame. \StopFrame \stoptext \starttext log file: fonts > 'fallback modern-designsize rm 12pt' is loaded tex error > tex error on line 41 in file /Users/graph/Library/Mobile Documents/com~apple~CloudDocs/texMain/test.tex: Use of \meta_usempgraphic_nop doesn't match its definition } \executedefinedoverlay #1#2->\bgroup \setlayoutcomponentattribute {\v!overlay :#1}\setbox \scratchbox \hbox \layoutcomponentboxattribute {\the \everyoverlay #2} \boxxoffset \scratchbox -.5\dimexpr \wd \scratchbox -\d_framed_target_wd \relax \boxyoffset \scratchbox -.5\dimex \pack_framed_process_background_indeed_internal #1->\bgroup \setbox \b_framed_extra \hpack \bgroup \ifzeropt \framedbackgroundoffset \else \kern -\framedbackgroundoffset \fi \hbox \bgroup #1 \egroup \egroup \wd \b_framed_extra \zeropoint \ht \b_framed_extra \framedbackgroundheight \dp \b_framed_ext \m_framed_background ...background \endcsname \expandafter \pack_framed_process_background_indeed_internal \lastnamedcs \orelse \ifcsname \??overlay \m_framed_background \endcsname \expandafter \pack_framed_process_background_indeed_external \lastnamedcs \fi \pack_framed_process_backgrounds #1,#2->\edef \m_framed_background {#1}\ifx \m_framed_background \s!unknown \else \pack_framed_process_background \expandafter \pack_framed_process_backgrounds \fi #2 \p_framed_component ...s\let \foregroundbox \pack_framed_background_box_content \hpack \layoutcomponentboxattribute to \framedbackgroundwidth \bgroup \the \everybackgroundbox \expandafter \pack_framed_process_backgrounds \p_framed_background ,\s!unknown ,\relax \box ... ... \StopFrame 31 32 \starttext 33 34 \StartFrame 35 This is a test for the frame. 36 This is a test for the frame. 37 This is a test for the frame. 38 This is a test for the frame. 39 This is a test for the frame. 40 This is a test for the frame. 41 >> \StopFrame 42 43 \stoptext 44 If you say, e.g., '\def\a1{...}', then you must always put '1' after '\a', since control sequence names are made up of letters only. The macro here has not been followed by the required stuff, so I'm ignoring it. mtx-context | fatal error: return code: 256___ 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] Strange new behaviour of the mailing list
Hi, > On 31 Jul 2021, at 15:56, Henning Hraban Ramm via ntg-context > wrote: > > > Ah, I didn’t recognize you mean this. > > Since the mail goes through the mailing list software, the sender must not be > the original sender any more – ntg.nl is not allowed to send emails for a > different domain. Many securely configured mail servers reject “faked” sender > addresses, as they should. Look up DANE etc. Which is exactly why that setting was changed. So yes, the change is on purpose. Best wishes, Taco — Taco Hoekwater E: t...@bittext.nl genderfluid (all pronouns) ___ 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] placefigure, usetikzlibrary and readfile
On 8/1/2021 10:27 PM, Jigé via ntg-context wrote: Hello all. It seems that \usetikzlibrary is sometimes read, sometimes not, and I don't understand why. Rationale: I would like, using one file, to use it to produce a picture, as with LaTeX's Standalone class, but to be able to include it in a calling document as well, for better management of fonts, etc. Thus this is most convenient. I have everything in the main document and I can quickly reuse any figure elsewhere. What I did: I use \readfile in a main ConTeXt file document.tex to include the file included.tex . The file included.tex should contain *just* the TikZ picture and what is needed to compile it "standalone". The issue: It seems I can call the file with the TikZ picture description multiple times, with \readfile, from within the very same \placefigure. However, if I call it by using two successive \placefigure commands, the \usetikzlibrary[blabla] in the included file doesn't seem to be recognised. E.g. with the provided example below, the key "right angle" is not understood, as if \usetikzlibrary[angles] was not there. One workaround would be to use \usetikzlibrary[allTheLibrariesISupposeMightEverBeNeeded] in the calling file. But I don't like it. I would rather have only the TikZ libraries relevant to some picture included in the corresponding file. I'm quite startled by the fact that : > \placefigure[here][]{This is a figure}{ >\readfile{included}{}{File not found.} >\readfile{included}{}{File not found.} > } compiles but > \placefigure[here][]{This is a figure}{ >\readfile{included}{}{File not found.} > } > \placefigure[here][]{This is a figure}{ >\readfile{included}{}{File not found.} > } does not. modules are loaded only once so you just have to call it in the main document (more efficient than reloading each time anyway) loading some module inside a figure is actually problemantic because you can end up with a mix of global and local definitions depending on how a module is set up (and tikz being pretty large it might be that at some point you can expect problems, apart from loading taking time) you can try to do \input {m-tikz.mlxl} or whatever but don't expect much help when there is an isseu due to multiple loading of tikz if there's a lot of extra tikz stuff then you can put that in a privane module or environment (these are also loaded once) and load that one if you use the project structure you can actually share environments and again these are then loaded once Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___