[NTG-context] een soort multi-\not?
Beste contexers, In math-mode krijg je een streep door een letter met behulp van* \no*t. De streep gaat echter altijd maar door één letter. Ik wil bijvoorbeeld het getal 10 doorstrepen of het getal 100. Hoe kan ik dit het beste doen? Liesbeth van der Plas -- liesbethvanderp...@gmail.com www.liesbethvanderplas.nl www.wiskunde-interactief.nl www.bonrekenhulp.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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] lua questions
Thomas A. Schmitz wrote: Hi all, this is a bit OT and should probably go to a lua list, but since some people here are very proficient in lua and I feel less embarrassed about noob questions here... I have a half-functioning python script to convert entries from a classics database into the bibtex format. I want to rewrite it in lua and make it more functional. Three little problems/questions: 1. I found a script to convert Roman numerals via lpeg here: http://lua-users.org/wiki/LpegRecipes but it uses the syntax lpeg.Ca which my lpeg doesn't recognize and which I can't find in the lpeg manual. According to a talk by Roberto Ierusalimschy, lpeg.Ca(patt) - accumulates the nested captures. (http://www.inf.puc-rio.br/~roberto/lpeg/slides-lpeg-workshop2008.pdf) Is this obsolete, has it been replaced by anything? here is a variant that implements a function (and does not use the env trick) do local add = function (x,y) return x+y end local P,Ca,Cc= lpeg.P,lpeg.Ca,lpeg.Cc local symbols = { I=1,V=5,X=10,L=50,C=100,D=500,M=1000,IV=4,IX=9,XL=40,CD=400,CM=900} local adders = { } for s,n in pairs(symbols) do adders[s] = P(s)*Cc(n)/add end local MS = adders.M^0 local CS = (adders.D*adders.C^(-4)+adders.CD+adders.CM+adders.C^(-4))^(-1) local XS = (adders.L*adders.X^(-4)+adders.XL+adders.X^(-4))^(-1) local IS = (adders.V*adders.I^(-4)+adders.IX+adders.IV+adders.I^(-4))^(-1) local p = Ca(Cc(0)*MS*CS*XS*IS) function string:romantonumber() return p:match(self:upper()) end end print(string.romantonumber(MMIX)) print(string.romantonumber(MMIIIX)) just run such script using mtxrun --script yourscript.lua as luatex (texlua) has the latest lpeg built in) 2. How can I check if a string begins with a class of words (Der |Die |Das |The |An ) etc. and strip these words from the string? I do it with a compiled regexp in python, but Programming in lua has this to say: Unlike some other systems, in Lua a modifier can only be applied to a character class; there is no way to group patterns under a modifier. For instance, there is no pattern that matches an optional word (unless the word has only one letter). Usually you can circumvent this limitation using some of the advanced techniques that we will see later. I haven't found these techniques yet. local stripped = { Der, Die, Das } local p = lpeg.P(false) for k, v in ipairs(stripped) do p = p + lpeg.P(v) end local w = p * local stripper = lpeg.Cs(((w/) + lpeg.C(1))^0) lpeg.print(stripper) str = Germans somehow always talk about Der Thomas and Der Hans print(stripper:match(str)) 3. How can I compare strings with utf8 characters? My naive approach if string.find(record, Résumé) doesn't appear to work (while the same method does work if the string has only ASCII characters). since lua is 8 bit clean utf should just work - 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 - ___ 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] lua questions
On Jan 23, 2009, at 12:13 PM, Hans Hagen wrote: here is a variant that implements a function (and does not use the env trick) do local add = function (x,y) return x+y end local P,Ca,Cc= lpeg.P,lpeg.Ca,lpeg.Cc local symbols = { I=1,V=5,X=10,L=50,C=100,D=500,M=1000,IV=4,IX=9,XL=40,CD=400,CM=900} local adders = { } for s,n in pairs(symbols) do adders[s] = P(s)*Cc(n)/add end local MS = adders.M^0 local CS = (adders.D*adders.C^(-4)+adders.CD+adders.CM +adders.C^(-4))^(-1) local XS = (adders.L*adders.X^(-4)+adders.XL+adders.X^(-4))^(-1) local IS = (adders.V*adders.I^(-4)+adders.IX+adders.IV +adders.I^(-4))^(-1) local p = Ca(Cc(0)*MS*CS*XS*IS) function string:romantonumber() return p:match(self:upper()) end end print(string.romantonumber(MMIX)) print(string.romantonumber(MMIIIX)) just run such script using mtxrun --script yourscript.lua as luatex (texlua) has the latest lpeg built in) Brilliant! This one does work when I use it with luatex (not with my system lua though, even though I have the latest released version of lpeg 0.9 installed. Bizarre... 2. How can I check if a string begins with a class of words (Der | Die |Das |The |An ) etc. and strip these words from the string? I do it with a compiled regexp in python, but Programming in lua has this to say: Unlike some other systems, in Lua a modifier can only be applied to a character class; there is no way to group patterns under a modifier. For instance, there is no pattern that matches an optional word (unless the word has only one letter). Usually you can circumvent this limitation using some of the advanced techniques that we will see later. I haven't found these techniques yet. local stripped = { Der, Die, Das } local p = lpeg.P(false) for k, v in ipairs(stripped) do p = p + lpeg.P(v) end local w = p * local stripper = lpeg.Cs(((w/) + lpeg.C(1))^0) lpeg.print(stripper) str = Germans somehow always talk about Der Thomas and Der Hans print(stripper:match(str)) Brilliant again! I can run with that, looks great! And who doesn't want a local stripper in his code? 3. How can I compare strings with utf8 characters? My naive approach if string.find(record, Résumé) doesn't appear to work (while the same method does work if the string has only ASCII characters). since lua is 8 bit clean utf should just work OK, then the problem must be somewhere else. I'll investigate. Thanks a lot, and best wishes 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 ___
[NTG-context] Questions about (start)itemize
I started making lists and sublists. In the first startitemize I use an 8 in the setup, because I want squared bullets. For my sublists I use 5, because I want to use circles there. Is there a way not to have to put it everywhere? (When I change to a triangle, I do not want to change it everywhere.) Is there a way to keep items automatically together? At a certain point I started a new sublist. But only the first came on the page and the rest on the next. Because I am printing on A7, it will happen moren often. What is the meaning of KA and KR in the setup. I see a difference, but I do not understand it. -- Cecil Westerhof ___ 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] New wiki
Is the google search going to be moved to the new wiki? I found it to be an invaluable tool. Bart ___ 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] Questions about (start)itemize
Hi Cecil \setupitemgroup [itemize] [1] [symbol=8] \setupitemgroup [itemize] [2] [symbol=5] KA en KR: looking at the table in the manual it would be that itemize uses small caps. Willi On Jan 23, 2009, at 2:44 PM, Cecil Westerhof wrote: I started making lists and sublists. In the first startitemize I use an 8 in the setup, because I want squared bullets. For my sublists I use 5, because I want to use circles there. Is there a way not to have to put it everywhere? (When I change to a triangle, I do not want to change it everywhere.) Is there a way to keep items automatically together? At a certain point I started a new sublist. But only the first came on the page and the rest on the next. Because I am printing on A7, it will happen moren often. What is the meaning of KA and KR in the setup. I see a difference, but I do not understand it. -- Cecil Westerhof __ _ 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] Questions about (start)itemize
2009/1/23 Willi Egger w.eg...@boede.nl: \setupitemgroup [itemize] [1] [symbol=8] \setupitemgroup [itemize] [2] [symbol=5] Works. KA en KR: looking at the table in the manual it would be that itemize uses small caps. I think you are right. -- Cecil Westerhof ___ 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] Latest Notepad++ package for ConTeXt
Dear gang, I have uploaded the latest version of the ConTeXt support package for Notepad++. http://wiki.contextgarden.net/Image:Npp_ConTeXt-Uni.zip It has been updated to 5.1.4, the latest stable version. There are now two versions of Notepad++: ANSI and Unicode. The ANSI version is mostly a legacy version, which supports Win95/98/ME. Unicode Npp supports Unicode path names etc., and is the main release. Most to all important plugins have been ported to Unicode Npp; this and future versions of this package for ConTeXt will only support Unicode Npp from now on. Old plugins will not work with Unicode Npp, so be sure to remove them before installing the latest Npp. See https://sourceforge.net/forum/message.php?msg_id=5503888 for more details. NppExec console plugin is essential for this package. It is installed by default by the Npp installer. This support package includes a redundant NppExec plugin -- in case you forgot to install it ;-) -- as well as the Explorer plugin and the XBrackets plugin -- not included in the main distro. XBrackets provides bracket autocompletion and is configurable. Directory structure has changed a bit: Npp now stores some config settings in Application Data\Notepad++\plugins\config that used to be stored in eg Program Files\Notepad++\plugins\Config the startstop module has been moved to texmf-project. Most of its features are or soon will be made obsolete in mkiv. The run commands are now all linked to scripts. Shortcuts are in the Macros menu, and you by F6 you can open the scripts console and editor. This way it's easier to edit the commands as well as to keep up with changes in the way ConTeXt does things etc. All reference to aleph is gone, luatex is its successor. Update ConTeXt is almost certainly obsolete; I never use it anyway. Feel free to send me an updated script for inclusion. I have never used XeTeX, the XeTeX related scripts may need adjustment. Please send me any comments, suggestions, or improvements! Best wishes Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shi`i Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 ___ 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 ___