From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Sinayoko Subject: equation numbering in html and latex export Date: Tue, 14 Jun 2011 07:48:43 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWQjB-00018L-7s for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 06:20:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWQjA-00016h-4O for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 06:20:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:58680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWQj9-000167-NK for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 06:20:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QWQj8-0000Yh-Ds for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 12:20:06 +0200 Received: from cpc4-cmbg3-0-0-cust826.5-4.cable.virginmedia.com ([86.14.227.59]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2011 12:20:06 +0200 Received: from s.sinayoko by cpc4-cmbg3-0-0-cust826.5-4.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2011 12:20:06 +0200 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 Dear list, I've been trying to write short scientific reports that I can export to both LaTeX and HTML. So far I've managed to figure out how to include equations, images, references, and how to include labels and cross reference between all these things. The only problem I have is that I can't get numbered equations in both LaTeX and HTML. Using the snippet below, I'm able to get a numbered equation in HTML but not in LaTeX. I've put loadFiles: ["extensions/eqn-number.js"], in jsMath/easy/load.js. If I replace the $$ by \begin{equation} and \end{equation}, I get a numbered equation in LaTeX but not in HTML. How can I get numbered equations in both HTML and LaTeX? Thanks, Sam ------- #+TITLE: A simple equation #+STYLE: #+OPTIONS: LaTeX:verbatim * A simple equation This is to test writing equations with org-mode. Hopefully MathJax is going to be used. $$ \label{eq:1} x_{1,2} = \frac{-b \pm \sqrt{\Delta}}{2a} $$ Equation \ref{eq:1} gives the roots of a polynomial of order 2. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: equation numbering in html and latex export Date: Thu, 16 Jun 2011 08:53:24 +0100 Message-ID: <87pqme43gr.fsf@ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QX85G-0006IV-7X for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 04:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QX855-0001bL-0l for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 04:37:49 -0400 Received: from vscani-b2.ucl.ac.uk ([144.82.108.135]:44211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QX854-0001aY-57 for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 04:37:38 -0400 In-Reply-To: (Samuel Sinayoko's message of "Tue, 14 Jun 2011 07:48:43 +0100") 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: Samuel Sinayoko Cc: emacs-orgmode@gnu.org Samuel Sinayoko writes: > Dear list, > > I've been trying to write short scientific reports that I can export to > both LaTeX and HTML. So far I've managed to figure out how to include > equations, images, references, and how to include labels and cross > reference between all these things. > > The only problem I have is that I can't get numbered equations in both > LaTeX and HTML. Using the snippet below, I'm able to get a numbered > equation in HTML but not in LaTeX. I've put > loadFiles: ["extensions/eqn-number.js"], > in jsMath/easy/load.js. If I replace the $$ by > \begin{equation} and \end{equation}, I get a numbered equation in LaTeX > but not in HTML. > > How can I get numbered equations in both HTML and LaTeX? I can't help you wish HTML unfortunately but I can summarise the issue in LaTeX. With the standard document class (article say), equations can be either "displayed" or "inline". Only displayed equations are numbered and then only if you use =equation= (or =align=, =eqnarray=, etc). $$ ... $$ is equivalent to \[ ... \] which is essentially equivalent to the unnumbered version of \begin{equation} (aka \begin{equation*}). The trick would be to get the HTML exporter to apply the same processing to \begin{equation} ... \end{equation} as it does to $$ ... $$, I guess? -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.399.g01eb) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Sinayoko Subject: Re: equation numbering in html and latex export Date: Thu, 16 Jun 2011 12:46:59 +0100 Message-ID: References: <87pqme43gr.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXCnv-0006yf-5E for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 09:40:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXCno-0007WG-12 for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 09:40:14 -0400 Received: from lo.gmane.org ([80.91.229.12]:39718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXCnl-0007TU-Rf for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 09:40:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QXB5J-0006qb-Lx for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 13:50:05 +0200 Received: from sal.eng.cam.ac.uk ([129.169.126.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2011 13:50:05 +0200 Received: from s.sinayoko by sal.eng.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2011 13:50:05 +0200 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 Thanks Eric. I think you're right. It would make sense to use \begin{equation} \end{equation} with HTML export to number equations. I've put a minimal example below showing what is happening. -- #+TITLE: Equation numbering #+STYLE: * Numbered in HTML export / Not numbered in LaTeX Equation is numbered and can be referenced in HTML export. Equation is *not* numbered in LaTeX export. $$ \label{eq:1} y = ax + b $$ Equation \ref{eq:1} is a polynomial of order 1. * Not numbered in HTML / Numbered in LaTeX Equation is not numbered but can be referenced in HTML export. Equation is numbered in LaTeX export. \begin{equation} \label{eq:1} y = ax + b \end{equation} Equation \ref{eq:1} is not numbered but can be referenced in HTML export. It is numbered in LaTeX export. -- I also think the right behaviour would be to have a numbered equation in the second case in both HTML and LaTeX, and an unnumbered equation in the first case in both HTML and LaTeX. Does everyone agree? I'd be happy to try and change the behaviour of the HTML export if someone can point me in the right direction. Cheers, Sam From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: equation numbering in html and latex export Date: Thu, 16 Jun 2011 11:37:47 -0300 Message-ID: <4dfa153f.22baec0a.3ba3.4b71@mx.google.com> References: <87pqme43gr.fsf@ucl.ac.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXDhq-0005fg-MM for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 10:38:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXDhk-0005EV-3O for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 10:38:02 -0400 Received: from mail-yi0-f41.google.com ([209.85.218.41]:40112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXDhi-0005E3-Fj for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 10:37:54 -0400 Received: by yia13 with SMTP id 13so1131215yia.0 for ; Thu, 16 Jun 2011 07:37:53 -0700 (PDT) In-Reply-To: <87pqme43gr.fsf@ucl.ac.uk> 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: Samuel Sinayoko , emacs-orgmode@gnu.org Using the org-special-blocks library org-mode will recognize blocks in the form : #+begin_something : bla bla bla : #+end_something Then you could write : #+begin_equation : y=ax+b : #+end_equation in org-mode. It would be translated to : \begin{equation} : y=ax+b : \end{equation} in latex and :
: y=ax+b :
in html. Can mathjax be configured to process anything inside
? If not, maybe the #+begin_equation should be a built-in block in org-mode, also with a fast template (maybe " wrote: > > Samuel Sinayoko writes: > > > Dear list, > > > > I've been trying to write short scientific reports that I can export to > > both LaTeX and HTML. So far I've managed to figure out how to include > > equations, images, references, and how to include labels and cross > > reference between all these things. > > > > The only problem I have is that I can't get numbered equations in both > > LaTeX and HTML. Using the snippet below, I'm able to get a numbered > > equation in HTML but not in LaTeX. I've put > > loadFiles: ["extensions/eqn-number.js"], > > in jsMath/easy/load.js. If I replace the $$ by > > \begin{equation} and \end{equation}, I get a numbered equation in LaTeX > > but not in HTML. > > > > How can I get numbered equations in both HTML and LaTeX? > > I can't help you wish HTML unfortunately but I can summarise the issue > in LaTeX. > > With the standard document class (article say), equations can be either > "displayed" or "inline". Only displayed equations are numbered and then > only if you use =equation= (or =align=, =eqnarray=, etc). $$ ... $$ is > equivalent to \[ ... \] which is essentially equivalent to the > unnumbered version of \begin{equation} (aka \begin{equation*}). > > The trick would be to get the HTML exporter to apply the same processing > to \begin{equation} ... \end{equation} as it does to $$ ... $$, I guess? > -- > : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 > : using Org-mode version 7.5 (release_7.5.399.g01eb) > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Sinayoko Subject: Re: equation numbering in html and latex export Date: Thu, 16 Jun 2011 11:36:16 +0100 Message-ID: <4DF9DCA0.9020200@cam.ac.uk> References: <87pqme43gr.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXCaG-0003Hy-OL for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 09:26:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXCaA-0003jj-Kb for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 09:26:08 -0400 Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141]:39270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXCa9-0003im-KH for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 09:26:01 -0400 Received: from sal.eng.cam.ac.uk ([129.169.126.133]:57551) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:465) with esmtpsa (PLAIN:ss2059) (TLSv1:DHE-RSA-CAMELLIA256-SHA:256) id 1QX9vt-0000sK-Pv (Exim 4.72) for emacs-orgmode@gnu.org (return-path ); Thu, 16 Jun 2011 11:36:17 +0100 In-Reply-To: <87pqme43gr.fsf@ucl.ac.uk> 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 Thanks Eric. I think you're right. It would make sense to use \begin{equation} \end{equation} with HTML export to number equations. I've put a minimal example below showing what is happening. -- #+TITLE: Equation numbering #+STYLE: * Numbered in HTML export / Not numbered in LaTeX Equation is numbered and can be referenced in HTML export. Equation is *not* numbered in LaTeX export. $$ \label{eq:1} y = ax + b $$ Equation \ref{eq:1} is a polynomial of order 1. * Not numbered in HTML / Numbered in LaTeX Equation is not numbered but can be referenced in HTML export. Equation is numbered in LaTeX export. \begin{equation} \label{eq:1} y = ax + b \end{equation} Equation \ref{eq:1} is not numbered but can be referenced in HTML export. It is numbered in LaTeX export. -- I also think the right behaviour would be to have a numbered equation in the second case in both HTML and LaTeX, and an unnumbered equation in the first case in both HTML and LaTeX. Does everyone agree? I'd be happy to try and change the behaviour of the HTML export if someone can point me in the right direction. Cheers, Sam On 16/06/11 08:53, Eric S Fraga wrote: > Samuel Sinayoko writes: > > >> Dear list, >> >> I've been trying to write short scientific reports that I can export to >> both LaTeX and HTML. So far I've managed to figure out how to include >> equations, images, references, and how to include labels and cross >> reference between all these things. >> >> The only problem I have is that I can't get numbered equations in both >> LaTeX and HTML. Using the snippet below, I'm able to get a numbered >> equation in HTML but not in LaTeX. I've put >> loadFiles: ["extensions/eqn-number.js"], >> in jsMath/easy/load.js. If I replace the $$ by >> \begin{equation} and \end{equation}, I get a numbered equation in LaTeX >> but not in HTML. >> >> How can I get numbered equations in both HTML and LaTeX? >> > I can't help you wish HTML unfortunately but I can summarise the issue > in LaTeX. > > With the standard document class (article say), equations can be either > "displayed" or "inline". Only displayed equations are numbered and then > only if you use =equation= (or =align=, =eqnarray=, etc). $$ ... $$ is > equivalent to \[ ... \] which is essentially equivalent to the > unnumbered version of \begin{equation} (aka \begin{equation*}). > > The trick would be to get the HTML exporter to apply the same processing > to \begin{equation} ... \end{equation} as it does to $$ ... $$, I guess? > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Sinayoko Subject: Re: equation numbering in html and latex export Date: Thu, 16 Jun 2011 16:39:59 +0100 Message-ID: <4DFA23CF.2060105@cam.ac.uk> References: <87pqme43gr.fsf@ucl.ac.uk> <4dfa153f.22baec0a.3ba3.4b71@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXEfr-0004om-J7 for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 11:40:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXEfo-0001gq-Rw for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 11:40:03 -0400 Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141]:35938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXEfo-0001gJ-3S for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 11:40:00 -0400 In-Reply-To: <4dfa153f.22baec0a.3ba3.4b71@mx.google.com> 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: Darlan Cavalcante Moreira Cc: "emacs-orgmode@gnu.org" , "Sinayoko S." Unfortunately this is not what jsMath expects. We get this in the html file (see attached files for full source) ---

This is what we want $$ \label{eq:1} y = ax + b $$

This is what we get

\label{eq:1} y = ax + b

-- What we need to do is to replace \begin{equation} ... \end{equation} with $$ ... $$ in the HTML export. Any idea of how to do this? Sam On 16/06/11 15:37, Darlan Cavalcante Moreira wrote: > Using the org-special-blocks library org-mode will recognize blocks in the > form > : #+begin_something > : bla bla bla > : #+end_something > > Then you could write > : #+begin_equation > : y=ax+b > : #+end_equation > in org-mode. It would be translated to > : \begin{equation} > : y=ax+b > : \end{equation} > in latex and > :
> : y=ax+b > :
> in html. > > Can mathjax be configured to process anything inside
? > > If not, maybe the #+begin_equation should be a built-in block in org-mode, > also with a fast template (maybe " > -- > Darlan Cavalcante > > At Thu, 16 Jun 2011 08:53:24 +0100, > Eric S Fraga wrote: > >> Samuel Sinayoko writes: >> >> >>> Dear list, >>> >>> I've been trying to write short scientific reports that I can export to >>> both LaTeX and HTML. So far I've managed to figure out how to include >>> equations, images, references, and how to include labels and cross >>> reference between all these things. >>> >>> The only problem I have is that I can't get numbered equations in both >>> LaTeX and HTML. Using the snippet below, I'm able to get a numbered >>> equation in HTML but not in LaTeX. I've put >>> loadFiles: ["extensions/eqn-number.js"], >>> in jsMath/easy/load.js. If I replace the $$ by >>> \begin{equation} and \end{equation}, I get a numbered equation in LaTeX >>> but not in HTML. >>> >>> How can I get numbered equations in both HTML and LaTeX? >>> >> I can't help you wish HTML unfortunately but I can summarise the issue >> in LaTeX. >> >> With the standard document class (article say), equations can be either >> "displayed" or "inline". Only displayed equations are numbered and then >> only if you use =equation= (or =align=, =eqnarray=, etc). $$ ... $$ is >> equivalent to \[ ... \] which is essentially equivalent to the >> unnumbered version of \begin{equation} (aka \begin{equation*}). >> >> The trick would be to get the HTML exporter to apply the same processing >> to \begin{equation} ... \end{equation} as it does to $$ ... $$, I guess? >> -- >> : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 >> : using Org-mode version 7.5 (release_7.5.399.g01eb) >> >>