From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/29801 Path: news.gmane.org!not-for-mail From: Sanjoy Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: regexp for matching entire footnotes Date: Sun, 30 Jul 2006 13:27:51 +0100 Message-ID: References: <8D7F3353-7D39-460A-9688-07E83AD19192@st.estfiles.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154262490 2700 80.91.229.2 (30 Jul 2006 12:28:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 Jul 2006 12:28:10 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Jul 30 14:28:08 2006 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 ciao.gmane.org with esmtp (Exim 4.43) id 1G7AOr-0002fh-Uf for gctc-ntg-context-518@m.gmane.org; Sun, 30 Jul 2006 14:28:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4F4A31FEBF; Sun, 30 Jul 2006 14:28:05 +0200 (CEST) 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 06694-05; Sun, 30 Jul 2006 14:28:00 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E72191FEBA; Sun, 30 Jul 2006 14:27:59 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AACAD1FEBA for ; Sun, 30 Jul 2006 14:27:56 +0200 (CEST) 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 06741-03-3 for ; Sun, 30 Jul 2006 14:27:53 +0200 (CEST) Original-Received: from mraos.ra.phy.cam.ac.uk (mraos.ra.phy.cam.ac.uk [131.111.48.8]) by ronja.ntg.nl (Postfix) with SMTP id 308DC1FEAD for ; Sun, 30 Jul 2006 14:27:53 +0200 (CEST) Original-Received: from skye.ra.phy.cam.ac.uk ([131.111.48.158] ident=mail) by mraos.ra.phy.cam.ac.uk with esmtp (Exim 4.43) id 1G7AOd-0001Jq-LK; Sun, 30 Jul 2006 13:27:51 +0100 Original-Received: from sanjoy by skye.ra.phy.cam.ac.uk with local (Exim 3.36 #1) id 1G7AOd-0007aH-00; Sun, 30 Jul 2006 13:27:51 +0100 Original-To: mailing list for ConTeXt users In-Reply-To: Your message of "Sun, 30 Jul 2006 07:45:49 +0200." <8D7F3353-7D39-460A-9688-07E83AD19192@st.estfiles.de> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 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:29801 Archived-At: > I have to find (highlight) footnotes with the entire footnote being > marked/highlighted. The problems are the (potentially) nested pairs > of curled brackets (like for \index, \emphasize etc etc) ... I'm not sure what you mean by marking or highlighting the footnote. Do you mean in the printed document, or in the source file so that you can find and change them in some way? > Constructing a regexp for this is far beyond what I can write, In the Chomsky hierarchy of grammars, regular languages, which are recognized by regexps, are below context-free grammars (CFGs). Compared to regular languages, CFGs add a stack. And you need a stack to parse nested delimiters, otherwise you can't tell whether a closing brace closes the first opening brace. So no regexp can do what you hope for. You could: 1. Use emacs (or your favorite editor) to substitute \myfootnote for \footnote, and do some ConTeXt setup magic to make \myfootnote be just like \footnote except that it highlights. 2. Use Emacs, which can find balanced braces, to make a keyboard macro (start defining it with "C-x ("). Then: a. search for \footnote. Now the point will be between the 'e' and the opening '{'. b. C-@ to set the mark. c. C-M-f ("alt-ctrl-f" to run 'forward-sexp') to move to the closing brace. Now you'll have highlighted the {...} stuff of the \footnote. d. C-x ) to end the keyboard macro definition. Then you can use C-x e to go to and highlight the next footnote material. But I'm not sure either is what you're trying to do? -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.