From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: {{ double braces }}
Date: Wed, 6 Feb 2008 02:01:31 -0500 (EST) [thread overview]
Message-ID: <alpine.DEB.1.00.0802060154590.31051@nqv-yncgbc> (raw)
In-Reply-To: <BBB23F93-4FBB-4921-8039-EC4B1A49A061@uni-bonn.de>
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 <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
>
> 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\{\{<matchbrace>\}\}=\\footnote\{$1\}
matchbrace:\{#\}=\{#\}
matchbrace:\\<Y1>=\\$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
___________________________________________________________________________________
next prev parent reply other threads:[~2008-02-06 7:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 14:45 Steffen Wolfrum
2008-01-21 15:02 ` Mikael Persson
2008-01-21 15:53 ` Steffen Wolfrum
2008-01-23 20:49 ` Peter Münster
2008-01-23 21:50 ` Peter Münster
2008-01-23 22:17 ` Thomas A. Schmitz
2008-01-23 23:19 ` Aditya Mahajan
2008-01-26 10:11 ` Thomas A. Schmitz
2008-02-06 7:01 ` Aditya Mahajan [this message]
2008-02-06 9:11 ` Steffen Wolfrum
2008-02-06 16:36 ` Aditya Mahajan
2008-02-06 19:20 ` Hans van der Meer
2008-02-06 20:01 ` Steffen Wolfrum
2008-02-06 20:16 ` Hans van der Meer
2008-02-06 20:17 ` Otared Kavian
2008-02-12 15:09 ` Thomas A. Schmitz
2008-02-12 15:15 ` Hans Hagen
2008-02-12 17:39 ` Aditya Mahajan
2008-02-13 8:39 ` Taco Hoekwater
2008-02-13 9:31 ` luigi scarso
2008-02-13 10:21 ` Taco Hoekwater
2008-02-13 10:38 ` luigi scarso
2008-01-26 10:52 ` Taco Hoekwater
2008-01-26 11:41 ` Taco Hoekwater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.00.0802060154590.31051@nqv-yncgbc \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).