From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/38961 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: {{ double braces }} Date: Wed, 6 Feb 2008 02:01:31 -0500 (EST) Message-ID: References: <1DC0E56D-487C-41CB-941E-FC98B0597B36@st.estfiles.de> <20080123204948.GA10128@gaston.couberia.bzh> <20080123215013.GC11445@gaston.couberia.bzh> <111CFD7B-669B-4044-901A-0291DD898978@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1202281373 21235 80.91.229.12 (6 Feb 2008 07:02:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Feb 2008 07:02:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Feb 06 08:03:14 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JMeJM-0004TA-UL for gctc-ntg-context-518@m.gmane.org; Wed, 06 Feb 2008 08:03:12 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 02A8D1FB71; Wed, 6 Feb 2008 08:02:44 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25337-05-4; Wed, 6 Feb 2008 08:02:03 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AC3871FB4E; Wed, 6 Feb 2008 08:02:03 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DE5961FB3C for ; Wed, 6 Feb 2008 08:02:01 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11508-01-4 for ; Wed, 6 Feb 2008 08:01:29 +0100 (CET) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by ronja.ntg.nl (Postfix) with ESMTP id 0B05B1FB4E for ; Wed, 6 Feb 2008 08:01:27 +0100 (CET) Original-Received: FROM adi-laptop.local (c-68-40-40-75.hsd1.mi.comcast.net [68.40.40.75]) BY hellskitchen.mr.itd.umich.edu ID 47A95B45.5E53.31608 ; 6 Feb 2008 02:01:25 -0500 X-X-Sender: adityam@adi-laptop In-Reply-To: User-Agent: Alpine 1.00 (DEB 882 2007-12-20) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:38961 Archived-At: Hi Thomas, Sorry for the delay in the reply, I was travelling last week. On Sat, 26 Jan 2008, Thomas A. Schmitz wrote: > > On Jan 24, 2008, at 12:19 AM, Aditya Mahajan wrote: > >> Another option is Gema >> (also has a lua library gelhttp://gema.sourceforge.net/new/ >> gel.shtml). You can define regions and matching nested braces quite >> easily. >> >> 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? Nested patterns is something where gema really excels. Here is a gema script to convert \footnote{{something}} to \footnote{something} :\\footnote\W\{\{\}\}=\\footnote\{$1\} matchbrace:\{#\}=\{#\} matchbrace:\\=\\$1 Save it as footnote.gema and then run gema -f footnote.gema tex-file > output-file It handles these expressions correctly: \footnote{{This $\frac{a}{b^{c+d}}$ is a strange footnote}} \footnote{{This $\frac{a}{b^{c+d}}$ is a strange footnote with multiple {nested {expressions}}}} \footnote{{This $\frac{\left[\frac {a}{b}\right\}}{c}$ is a strange footnote}} It is much easier to write than regular expressions. Unfortunately, gema expressions can be as hard as regular expressions to read. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________