Re: [NTG-context] How can I remove a blank leading line from a buffer
On 13/08/18 15:18, Rik Kabel wrote: %% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph % Ignore first \par \def\par{\let\par\normalpar} \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \stopmode %% -- %% Rik Kabel ___ 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] How can I remove a blank leading line from a buffer
On Sun, 12 Aug 2018, Rik Kabel wrote: %% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \stopmode Perhaps \ignorespaces might work, but I often find that the conceptually simplest solution is to post-process the buffer at the lua end. See http://wiki.contextgarden.net/Programming_in_LuaTeX#Manipulating_verbatim_text for an example. 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 can I remove a blank leading line from a buffer
%% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \stopmode %% -- %% Rik Kabel ___ 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] referencing a footnote (and getting the right number)
> On 12. Aug 2018, at 17:38, Pablo Rodriguez wrote: > > Hi Robert, > > the reference command in notes is \in (for both MkII and MkIV), such as in: > >\starttext >\dorecurse{30}{\footnote{Footnote}} >\footnote[uvu-avu]{These two suffixes […]} >\dorecurse{30}{\footnote{Footnote}} >… >\footnote{See n.~\in[uvu-avu].} >\stoptext Aha. I didn’t find that in contextref.pdf (2013 edition). But it works! What does disturb me, however, is that I have this one chapter where the wrong note number is indicated (note 19 is referred to as note '18'), and I do not know why. Could it be that this is because earlier in the chapter I have also used \setupnote [localnote] [location=none] … \startlocalfootnotes[conversion=characters,n=0] … \placenotes [localnote] \stoplocalfootnotes and that this somehow interferes with the referencing of other footnotes? That is the only difference I see between this chapter and the others. Robert ___ 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] referencing a footnote
> On 12. Aug 2018, at 17:52, Pablo Rodriguez wrote: > > Sorry, Robert, I almost forgot it. > > If you reset the footnote numbers in each chapter, I’d rather suggest > something similar to: > > \footnote{See n.~\in[uvu-avu] on p.~\at[uvu-avu].} > > Since footnote numbers aren’t unique, consider providing the page or the > chapter number. Of course. :-) Robert ___ 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] referencing a footnote
On 08/12/2018 05:38 PM, Pablo Rodriguez wrote: >> On 08/12/2018 04:34 PM, Robert Zydenbos wrote: >> [..] >> … >> \footnote[uvu-avu]{These two suffixes […]} >> … >> \footnote{See n.~\note[uvu-avu].} >> … > > Hi Robert, > > the reference command in notes is \in (for both MkII and MkIV), such > as in: [...] Sorry, Robert, I almost forgot it. If you reset the footnote numbers in each chapter, I’d rather suggest something similar to: \footnote{See n.~\in[uvu-avu] on p.~\at[uvu-avu].} Since footnote numbers aren’t unique, consider providing the page or the chapter number. Pablo -- http://www.ousia.tk ___ 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] referencing a footnote
On 08/12/2018 04:34 PM, Robert Zydenbos wrote: > Another footnote question for the experts. I want to refer to a note > from within another, later note. I thought I could do this in > the following way: > > … > \footnote[uvu-avu]{These two suffixes […]} > … > \footnote{See n.~\note[uvu-avu].} > … Hi Robert, the reference command in notes is \in (for both MkII and MkIV), such as in: \starttext \dorecurse{30}{\footnote{Footnote}} \footnote[uvu-avu]{These two suffixes […]} \dorecurse{30}{\footnote{Footnote}} … \footnote{See n.~\in[uvu-avu].} \stoptext I hope it helps, Pablo -- http://www.ousia.tk ___ 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] integer displayed as .0 float in Lua-5.3
On Sat, Aug 11, 2018 at 11:29:41AM +0200, Pablo Rodriguez wrote: > I realize that the fault is mine, but with backwards compatibility I > meant that the same operation (10 + "10") gives different results with > different Lua versions. It doesn’t, it returns 10 in both cases. The difference is in the behaviour of the print function. Try print(10.0) in Lua 5.2 and 5.3: the former prints 10, the latter 10.0. That is consistent with the part of the specification you quote in another email: in Lua >= 5.3, a number with a decimal point in it is always interpreted as a float. If the number to be printed is the result of some computation, however (instead of lexical analysis), a choice needs to be made: that is where the change occurred, since in Lua 5.2 print displayed the shortest possible representation, while in Lua 5.3 it chose to interpret the number as a float. It’s a reasonable choice and breaking compatibility for an elementary function such a print is to be expected when such a change in the language occurred; even desirable, in my opinion. Best, Arthur ___ 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] referencing a footnote
Another footnote question for the experts. I want to refer to a note from within another, later note. I thought I could do this in the following way: … \footnote[uvu-avu]{These two suffixes […] … \footnote{See n.~\note[uvu-avu].} … But I get this result: There are two things wrong: (1) I want to get a result that looks like “See n. 18.”, with a number that is not superscript. (This happens when I try such referencing in other notes as well as in the main text.) (2) The number is wrong: it is footnote #19, not 18. I *could* work around this problem by totally different means – but I would much prefer to reference notes more or less in the manner I tried above. What could I improve in my code? Robert___ 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] integer displayed as .0 float in Lua-5.3
On 8/11/2018 11:33 AM, Pablo Rodriguez wrote: On 08/09/2018 10:20 PM, Hans Åberg wrote: On 9 Aug 2018, at 21:20, Pablo Rodriguez wrote: [...] My background is in humanities and I don’t understand the exponent for being a float ("10²" contains an exponent [https://www.m-w.com/dictionary/exponent], but I would say is an integer in all possible worlds [or all the worlds I know ]). It may refer to a floating point number syntax as in C++ [1], where the three cases top there say that there must be a point '.' preceded or followed by at least one digit, or at least one digit followed by an exponent starting with 'e' or 'E'. Many thanks for your explanation, Hans. I thought there should be some kind of restriction when referring to the exponent, but this is why technical explanations aren’t always very clear. I mean, they have too many restrictions attached to them. small numbers can get expresses in nEm notation instead of 0.0... which can also bite you (in context we intercept this when needed) 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 ___