Re: [NTG-context] {{ double braces }}
On Jan 24, 2008, at 12:19 AM, Aditya Mahajan wrote: Another option is Gema http://gema.sourceforge.net/new/index.shtml (also has a lua library gelhttp://gema.sourceforge.net/new/ gel.shtml). You can define regions and matching nested braces quite easily. Aditya Hi Aditya, I remember I had a look at gema before but couldn't really find out what was special about it and would warrant further attention. I also haven't seen anything about nested braces etc. (which would be great for processing TeX files but is a major pain in the back with regexs). You seem to know more about it: could you give an example of how it's possible to have nested braces in a gema pattern? Thomas ___ 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 ___
Re: [NTG-context] {{ double braces }}
Thomas A. Schmitz wrote: You could also use a nice scripting language like ... lua!! lua has support for balanced strings, so no nesting trickery is needed, see http://www.lua.org/pil/20.2.html (scroll to the bottom of the page). Or you could try and nag Hans into giving a nice tutorial on the lua lpeg library at Bohinj! :-) Even in bare lua, it is very easy to match balanced braces: local data = \\footnote{x{y}z} local match = \\footnote%s%b{} local i = 0 while true do i,j = string.find(data, match, i+1) if i == nil then break end print(string.sub(data, i, j)) end with lpeg, the code looks a bit harder, but is still short and relatively shortforward: local matchtable = { TEXT, SP = lpeg.S \n\t^0, BODY = lpeg.P{ { * ((1 - lpeg.S{}) + lpeg.V(1))^0 * } }, FOOTNOTE = lpeg.P\\footnote * lpeg.VSP * lpeg.VBODY / print, TEXT = (lpeg.VFOOTNOTE + 1)^0 * -1, } lpeg.match(matchtable, data) Best wishes, Taco ___ 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 ___
Re: [NTG-context] {{ double braces }}
Taco Hoekwater wrote: with lpeg, the code looks a bit harder, but is still short and relatively shortforward: Here is a smarter lpeg that takes care of embedded \{ as well: local P, S, V = lpeg.P, lpeg.S, lpeg.V local matchtable = { TEXT, TEXT = (V(FOOTNOTE) + 1)^0 * -1, SP = S( \n\t)^0, BODY = {*(P(\\{)+P(\\})+(1 - S({}))+V(BODY))^0*}, FOOTNOTE = \\footnote * V(SP) * V(BODY) / print, } lpeg.match(matchtable, data) Quick explanation: the symbol + is alternation, * is concatenation, - is exclusion, ^ is a repeat modifier, and P() match strings, numbers match bytes, S() matches byte sets. the matchtable describes the input data. In there, matchtable[1] points to the top rule, which is TEXT. The other key-value pairs in the table say roughly this: TEXT = an optional sequence [^0] of either footnote items [V(FOOTNOTE)] or non-footnote bytes [1], until the end of the data is reached [-1] FOOTNOTE = the string '\footnote', followed by optional space, followed by the footnote body. SP = zero or more occurrences of a space, tab, or newline byte BODY = a left brace, followed by an optional sequence of four possible things: 1. the string \{ [P(\\{)] 2. the string \} [P(\\})] 3. a byte that is not { nor } [(1 - S({}))] 4. a recursively included braced body [V(BODY)], followed by a right brace. The [/print] runs the print() command on each successful FOOTNOTE match. Best wishes, Taco ___ 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 ___
[NTG-context] Declare new math operators
Hi, Is there a way in ConTeXt to define new math operators as with \DeclareMathOperators of AMSlatex? Thanks for your answers, Morgan ___ 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 ___
Re: [NTG-context] Declare new math operators
[EMAIL PROTECTED] wrote: Hi, Is there a way in ConTeXt to define new math operators as with \DeclareMathOperators of AMSlatex? If I understand correctly, you want to use this command: \definemathcommand [det] [limop] {\mfunction{det}} Best wishes, Taco ___ 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 ___
Re: [NTG-context] Declare new math operators
Selon Taco Hoekwater [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Hi, Is there a way in ConTeXt to define new math operators as with \DeclareMathOperators of AMSlatex? If I understand correctly, you want to use this command: \definemathcommand [det] [limop] {\mfunction{det}} Best wishes, Taco Yes, precisely. Thank you! And sorry I didn't see the page on the wiki earlier. ___ 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 ___ ___ 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 ___
Re: [NTG-context] [OT] The ISO 32000 Standard (DIS)
On Thu, Dec 06, 2007 at 08:53:54PM +0100, luigi scarso wrote: On Dec 6, 2007 9:08 AM, Arthur Reutenauer [EMAIL PROTECTED] wrote: On Thu, Dec 06, 2007 at 02:45:09AM +0100, luigi scarso wrote: Adobe has received word that the Ballot for approval of PDF 1.7 to become the ISO 32000 Standard (DIS) has passed by a vote of 13::1. I wonder if I should feel ashamed for the vote of my delegation? ;-) well , yes or no ? Heh, heh ... http://blogs.adobe.com/insidepdf/2008/01/now_unanimous.html :-) ___ 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 ___
[NTG-context] t-lilypond, placement of oversized lines.
Greetings all, In tinkering around with the lilypond module, oversized lines of notation do not get adjusted into the left margin as this bit of code seems to be trying to achieve: --- %D %D TODO: Get the relevant dimension directly from lilypond, %D to place the instrument name into the left margin for %D short snippets as well. %D If we are not in the middle of some text, we have to check %D whether lilypond created an image that is wider than requested: %D It places the instrument names in the left margin. %D \ifvmode \getfiguredimensions[\lily!filename.pdf]% \leavevmode% \newdimen\FigWidth \FigWidth=\figurewidth \ifdim\FigWidth\localhsize \!!dimena=\localhsize \advance\!!dimena by-\FigWidth \noindent\hskip\!!dimena \fi \fi \externalfigure[\lily!img]% \egroup% }% --- This includes lines which have an instrument name, as mentioned in the comments, and also includes piano notation, which has a special bracket on the left joining the two staffs. Can anyone help me out here? Best, David ___ 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 ___
Re: [NTG-context] t-lilypond, placement of oversized lines.
On Jan 27, 2008, at 1:32 AM, David Wooten wrote: This includes lines which have an instrument name, as mentioned in the comments, and also includes piano notation, which has a special bracket on the left joining the two staffs. Can anyone help me out here? Best, David No, I can't help, but I may have bad news for you: I played some with the lilypond module myself and found out that lilypond itself may be the culprit. lilypond can produce eps figures; that's the only way the output is cropped to just the figure and doesn't produce an entire page. Unfortunately, in my experiments, the bounding box which lilypond uses is always a bit too small, the elements you describe are always cut off at the left margin. You can try that by creating a standalone .ly file and running lilypond with the --backend=eps option on it, and you'll see the effect. I have tried with a number of options to modify this behavior of lilypond, but haven't had any success. Since lilypond is pretty broken on Os X 10.5 at the moment, I have given up for the time being. Thomas ___ 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 ___