From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: Re: example filter for code blocks? Date: Thu, 26 Sep 2013 11:04:01 +0200 Message-ID: <20130926110401.5f021372@aga-netbook> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP7Ua-0008T6-8x for emacs-orgmode@gnu.org; Thu, 26 Sep 2013 05:04:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VP7UR-0006fE-GV for emacs-orgmode@gnu.org; Thu, 26 Sep 2013 05:04:12 -0400 Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:47519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP7UR-0006f3-1i for emacs-orgmode@gnu.org; Thu, 26 Sep 2013 05:04:03 -0400 Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 780CD4AC41 for ; Thu, 26 Sep 2013 11:04:02 +0200 (CEST) Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GsCQOVa1irC6 for ; Thu, 26 Sep 2013 11:04:02 +0200 (CEST) Received: from aga-netbook (99-52.echostar.pl [213.156.99.52]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 581FB4AC40 for ; Thu, 26 Sep 2013 11:04:02 +0200 (CEST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Dnia 2013-09-25, o godz. 20:03:10 John Kitchin napisa=C5=82(a): > Hi everyone, >=20 > I have an idea for putting links in a pdf that would open python code > blocks in an editor. To do that, I need to modify what happens when an > org-file is published to latex. >=20 > Essentially I want it to do exactly what it already does in terms of > running pygments, and making nicely formatted and syntax highlighted > code blocks and output. >=20 > After that though, I want to tangle the code block to a file in a > directory, and insert a new link after the rendered code block. I > would prefer not to have to put :tangle headings in each code block > because there are many (e.g. hundreds) of them in course notes. It > would be sufficient if they were just sequentially numbered as > dir/1.py, dir/2.py, etc... and it is fine if these get overwritten on > each export. >=20 > the link that would go after the code block in the latex export would > be something like: > \LaunchPython{dir/1.py}{Open code} >=20 > Then clicking on it would open dir/1.py in whatever editor your > system is configured for. \LaunchPython is a newcommand I have > defined that works already. >=20 > It seems like the new export engine should make this easy to do, but > I am not sure where to start. Could anyone point me to a starting > place? Thanks! I'm not 100% sure, but I think you can do this (maybe more easily, maybe not) on the LaTeX side. Check out the etoolbox package, look at the patching commands and remember that \begin{foo} ... \end{foo} translate (more or less) into something like \begingroup\foo ... \endfoo\endgroup, so patching \endfoo might be the way to go. > John hth --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University