From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: Verbatim LaTeX inside delimiters in HTML export with jsMath? Date: Thu, 01 Jul 2010 09:18:50 +0200 Message-ID: <4C2C415A.5030608@christianmoe.com> References: <520586D5-F7A3-49DB-ACA8-A7542D1EAE06@gmail.com> <4C19CD7D.7050409@christianmoe.com> <5DBE101F-986F-4944-A067-39A467365878@gmail.com> <4C1B514F.6070702@christianmoe.com> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=41475 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUE2z-0004Kq-9O for emacs-orgmode@gnu.org; Thu, 01 Jul 2010 03:19:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUE2x-0005C5-Qy for emacs-orgmode@gnu.org; Thu, 01 Jul 2010 03:18:57 -0400 Received: from mars.hitrost.net ([91.185.193.39]:18555) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUE2x-00057z-CV for emacs-orgmode@gnu.org; Thu, 01 Jul 2010 03:18:55 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org Hi, Carsten, Sorry it took me so long to get back to you. The patch does exactly what I hoped for: Allows one to set an option to get LaTeX math passed verbatim into HTML for jsMath to process, while keeping the use of the ^:t TeX:t options. I've tested it on various documents. I noticed the following behavior: A comment line starting with "#" immediately before a \begin{equation} environment is passed verbatim as well. I don't think it counts as a bug, since there should probably be a blank line before \begin anyway. I can now scrap the workaround I thought up last weekend, which involved a preprocessing hook to put = signs or #+BEGIN_EXAMPLE blocks around anything found by org-latex-regexps, and a postprocessing hook to get rid of
 tags in the HTML output. It worked, if inelegantly, but I 
think it makes better sense to have the LaTeX:verbatim option built in.

Thanks!

I'll see about updating the Worg page -- but I'm a Git novice and will 
be on a 56K modem for a bit, so it won't happen immediately.

Yours,
Christian






Carsten Dominik wrote:
> For John Wiegley: John, please do not yet apply the attached patch...
> 
> Hi Christian,
> 
> I am trying to get back to this issue.
> 
> I am attaching a patch, please apply it to your setup and then try
> 
> #+OPTIONS: ^:t TeX:t LaTeX:verbatim
> 
> if that works, can I then ask you to update 
> http://orgmode.org/worg/org-tutorials/org-jsmath.php ?
> 
> Thanks!
> 
> - Carsten
> 
> 
> 
> On Jun 18, 2010, at 12:58 PM, Christian Moe wrote:
> 
>> Hi, Carsten,
>>
>> Thanks for taking a look.
>>
>> Your example should be output exactly the same as it is currently with 
>> the =LaTeX:nil= option, i. e. verbatim:
>>
>> 

>> \begin{equation} >> a=b >> \end{equation} >>

>> >> - and this minimal example could be interpreted by jsMath without any >> changes in Org-mode export, since it happens to contain no >> sub/superscripts or entities. >> >> What I'd like is for >> >> \begin{equation} >> \e=mc^2 >> \end{equation} >> >> to be output equally verbatim as >> >>

>> \begin{equation} >> e=mc^2 >> \end{equation} >>

>> >> *even when =^:t= is on*, so I could freely write e.g. m^2 in the text >> and get it superscripted, but not get >> >>

>> \begin{equation} >> e=mc2 >> \end{equation} >>

>> >> In other words, to have my cake and eat it, too. I hope it's clearer now. >> >> Yours, >> Christian >> >> >> Carsten Dominik wrote: >> > Hi Christian, >> > >> > how should, in this case, a literal LaTeX environment like >> > >> > \begin{equation} >> > a=b >> > \end{equation} >> > >> > be handled? >> > >> > - Carsten >> > >> > On Jun 17, 2010, at 9:23 AM, Christian Moe wrote: >> > >> >> Hi, >> >> >> >> To display LaTeX math in Org html export with lovely jsMath, it >> must be >> >> exported verbatim with >> >> >> >> #+OPTIONS: ^:nil TeX:nil >> >> >> >> so one cannot use lazy superscripts/subscripts or Org entities in the >> >> rest of the text. >> >> >> >> Is there a simple way to turn these options on, but protect LaTeX >> where >> >> it appears *inside math delimiters* so it's exported verbatim? I.e. >> >> inside $...$, $$...$$, \( ... \), \[ ... \], \begin ... \end ? >> >> >> >> I ask because I'm keeping a note file with much text and only a few >> >> equations, but with frequent reference to e.g. CO_2 and m^2. It's >> >> possible to always write $CO_2$ and $m^2$, but less readable, and >> >> irksome when you've got used to an easier way. An inline formula can >> >> be protected by surrounding it with verbatim markup, =$...$=, but then >> >> it's only good for jsMath, not for LaTeX export. >> >> >> >> Yours, >> >> Christian >> >> >> >> _______________________________________________ >> >> Emacs-orgmode mailing list >> >> Please use `Reply All' to send replies to the list. >> >> Emacs-orgmode@gnu.org >> >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> > >> > - Carsten >> > >> > >> > >> > >> >> >> -- >> >> Christian Moe >> E-mail: mail@christianmoe.com >> Website: http://christianmoe.com >> >> >> >> Carsten Dominik wrote: >>> Hi Christian, >>> how should, in this case, a literal LaTeX environment like >>> \begin{equation} >>> a=b >>> \end{equation} >>> be handled? >>> - Carsten >>> On Jun 17, 2010, at 9:23 AM, Christian Moe wrote: >>>> Hi, >>>> >>>> To display LaTeX math in Org html export with lovely jsMath, it must be >>>> exported verbatim with >>>> >>>> #+OPTIONS: ^:nil TeX:nil >>>> >>>> so one cannot use lazy superscripts/subscripts or Org entities in >>>> the rest of the text. >>>> >>>> Is there a simple way to turn these options on, but protect LaTeX where >>>> it appears *inside math delimiters* so it's exported verbatim? I.e. >>>> inside $...$, $$...$$, \( ... \), \[ ... \], \begin ... \end ? >>>> >>>> I ask because I'm keeping a note file with much text and only a few >>>> equations, but with frequent reference to e.g. CO_2 and m^2. It's >>>> possible to always write $CO_2$ and $m^2$, but less readable, and >>>> irksome when you've got used to an easier way. An inline formula can >>>> be protected by surrounding it with verbatim markup, =$...$=, but >>>> then it's only good for jsMath, not for LaTeX export. >>>> >>>> Yours, >>>> Christian >>>> >>>> _______________________________________________ >>>> Emacs-orgmode mailing list >>>> Please use `Reply All' to send replies to the list. >>>> Emacs-orgmode@gnu.org >>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> - Carsten >> >> >