emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Inline LaTeX fragments in emacs buffer
@ 2012-05-12 22:20 Dov Grobgeld
  2012-05-12 22:46 ` Daimrod
  0 siblings, 1 reply; 7+ messages in thread
From: Dov Grobgeld @ 2012-05-12 22:20 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

Is there any way of getting org-mode to display inline LaTeX fragments in
the emacs buffer? E.g. I would like to be able to type:

The size of the hypotenuse is $\sqrt{a^2+b^2}$

and then the buffer immediately shows:

The size of the hypotenuse is √a²+b²

where √a²+b² is a png image rendered via dvipng.

I assume a toggle would switch between either seeing the formula or seeing
the source of the formula, just like for the display of inline images.
Also, pressing a backspace when the cursor is at the end of the formula
should erase the trailing $ sign, and turn off image display of the
formula, just like for [[links][name]].

Has anything like this been implemented?

Thanks!
Dov

[-- Attachment #2: Type: text/html, Size: 909 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inline LaTeX fragments in emacs buffer
  2012-05-12 22:20 Inline LaTeX fragments in emacs buffer Dov Grobgeld
@ 2012-05-12 22:46 ` Daimrod
  2012-05-13 17:55   ` Darlan Cavalcante Moreira
  0 siblings, 1 reply; 7+ messages in thread
From: Daimrod @ 2012-05-12 22:46 UTC (permalink / raw)
  To: emacs-orgmode

Dov Grobgeld <dov.grobgeld@gmail.com> writes:

> Is there any way of getting org-mode to display inline LaTeX fragments
> in the emacs buffer? E.g. I would like to be able to type:
>
> The size of the hypotenuse is $\sqrt{a^2+b^2}$ 
>
> and then the buffer immediately shows:
>
> The size of the hypotenuse is √a²+b²
>
> where √a²+b² is a png image rendered via dvipng. 
>
> I assume a toggle would switch between either seeing the formula or
> seeing the source of the formula, just like for the display of inline
> images. Also, pressing a backspace when the cursor is at the end of
> the formula should erase the trailing $ sign, and turn off image
> display of the formula, just like for [[links][name]].
>
> Has anything like this been implemented?
>
> Thanks!
> Dov

Yes, you can produce a preview image with C-c C-x C-l.

See
(info "(org) Previewing LaTeX fragments")
and
(info "(org) Embedded LaTeX")

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inline LaTeX fragments in emacs buffer
  2012-05-12 22:46 ` Daimrod
@ 2012-05-13 17:55   ` Darlan Cavalcante Moreira
  2012-05-14 14:47     ` Dov Grobgeld
  0 siblings, 1 reply; 7+ messages in thread
From: Darlan Cavalcante Moreira @ 2012-05-13 17:55 UTC (permalink / raw)
  To: Daimrod; +Cc: emacs-orgmode


org-preview-latex-fragment is really great but what is even better is that
it also works outside org-mode! This makes my life a lot easier.

I set "C-c P" as a global key-binding for org-preview-latex-fragment and
"C-c p" to org-ctrl-c-ctrl-c. Then I can preview equations all equations in
ANY buffer with "C-u C-u C-c P". It's great to write equations in comments
of some programming buffer (no matter which programming language) and being
able to render the equations right there.

--
Darlan

At Sun, 13 May 2012 00:46:51 +0200,
Daimrod <daimrod@gmail.com> wrote:
> 
> Dov Grobgeld <dov.grobgeld@gmail.com> writes:
> 
> > Is there any way of getting org-mode to display inline LaTeX fragments
> > in the emacs buffer? E.g. I would like to be able to type:
> >
> > The size of the hypotenuse is $\sqrt{a^2+b^2}$ 
> >
> > and then the buffer immediately shows:
> >
> > The size of the hypotenuse is √a²+b²
> >
> > where √a²+b² is a png image rendered via dvipng. 
> >
> > I assume a toggle would switch between either seeing the formula or
> > seeing the source of the formula, just like for the display of inline
> > images. Also, pressing a backspace when the cursor is at the end of
> > the formula should erase the trailing $ sign, and turn off image
> > display of the formula, just like for [[links][name]].
> >
> > Has anything like this been implemented?
> >
> > Thanks!
> > Dov
> 
> Yes, you can produce a preview image with C-c C-x C-l.
> 
> See
> (info "(org) Previewing LaTeX fragments")
> and
> (info "(org) Embedded LaTeX")
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inline LaTeX fragments in emacs buffer
  2012-05-13 17:55   ` Darlan Cavalcante Moreira
@ 2012-05-14 14:47     ` Dov Grobgeld
  2012-05-14 14:52       ` Dov Grobgeld
  0 siblings, 1 reply; 7+ messages in thread
From: Dov Grobgeld @ 2012-05-14 14:47 UTC (permalink / raw)
  To: Darlan Cavalcante Moreira; +Cc: Daimrod, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2267 bytes --]

Thanks for the help. It makes my coursera ml-class notes easier to read.

One issue I had when I tried exporting to HTML with the dvnpng option the
following equation:

\[
J(\theta) = - \frac{1}{m} \left[\sum_{i=1} ^m y^{(i)} \log
h_\theta(x^{(i)})+(1-y^{(i)})\log(1-h_\theta(x^{(i)}))\right]
          + \frac{\lambda}{2m}\sum_{j=1} ^n \theta_j ^2
\]

in the png output I got the following trailing text:ORG-LIST-END-MARKER .
Is this a known bug?

Regards,
Dov

On Sun, May 13, 2012 at 8:55 PM, Darlan Cavalcante Moreira <
darcamo@gmail.com> wrote:

>
> org-preview-latex-fragment is really great but what is even better is that
> it also works outside org-mode! This makes my life a lot easier.
>
> I set "C-c P" as a global key-binding for org-preview-latex-fragment and
> "C-c p" to org-ctrl-c-ctrl-c. Then I can preview equations all equations in
> ANY buffer with "C-u C-u C-c P". It's great to write equations in comments
> of some programming buffer (no matter which programming language) and being
> able to render the equations right there.
>
> --
> Darlan
>
> At Sun, 13 May 2012 00:46:51 +0200,
> Daimrod <daimrod@gmail.com> wrote:
> >
> > Dov Grobgeld <dov.grobgeld@gmail.com> writes:
> >
> > > Is there any way of getting org-mode to display inline LaTeX fragments
> > > in the emacs buffer? E.g. I would like to be able to type:
> > >
> > > The size of the hypotenuse is $\sqrt{a^2+b^2}$
> > >
> > > and then the buffer immediately shows:
> > >
> > > The size of the hypotenuse is √a²+b²
> > >
> > > where √a²+b² is a png image rendered via dvipng.
> > >
> > > I assume a toggle would switch between either seeing the formula or
> > > seeing the source of the formula, just like for the display of inline
> > > images. Also, pressing a backspace when the cursor is at the end of
> > > the formula should erase the trailing $ sign, and turn off image
> > > display of the formula, just like for [[links][name]].
> > >
> > > Has anything like this been implemented?
> > >
> > > Thanks!
> > > Dov
> >
> > Yes, you can produce a preview image with C-c C-x C-l.
> >
> > See
> > (info "(org) Previewing LaTeX fragments")
> > and
> > (info "(org) Embedded LaTeX")
> >
> >
> >
>
>

[-- Attachment #2: Type: text/html, Size: 3113 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inline LaTeX fragments in emacs buffer
  2012-05-14 14:47     ` Dov Grobgeld
@ 2012-05-14 14:52       ` Dov Grobgeld
  2012-05-14 17:22         ` Darlan Cavalcante Moreira
  2012-05-15 18:54         ` Nicolas Goaziou
  0 siblings, 2 replies; 7+ messages in thread
From: Dov Grobgeld @ 2012-05-14 14:52 UTC (permalink / raw)
  To: Darlan Cavalcante Moreira; +Cc: Daimrod, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

I got it. Org-mode erroneously interpreted the + sign on the second row as
a list token. Rearranging the latex text so that it does not start with -
or + is a workaround.

On Mon, May 14, 2012 at 5:47 PM, Dov Grobgeld <dov.grobgeld@gmail.com>wrote:

> Thanks for the help. It makes my coursera ml-class notes easier to read.
>
> One issue I had when I tried exporting to HTML with the dvnpng option the
> following equation:
>
> \[
> J(\theta) = - \frac{1}{m} \left[\sum_{i=1} ^m y^{(i)} \log
> h_\theta(x^{(i)})+(1-y^{(i)})\log(1-h_\theta(x^{(i)}))\right]
>           + \frac{\lambda}{2m}\sum_{j=1} ^n \theta_j ^2
> \]
>
> in the png output I got the following trailing text:ORG-LIST-END-MARKER .
> Is this a known bug?
>
> Regards,
> Dov
>
> On Sun, May 13, 2012 at 8:55 PM, Darlan Cavalcante Moreira <
> darcamo@gmail.com> wrote:
>
>>
>> org-preview-latex-fragment is really great but what is even better is that
>> it also works outside org-mode! This makes my life a lot easier.
>>
>> I set "C-c P" as a global key-binding for org-preview-latex-fragment and
>> "C-c p" to org-ctrl-c-ctrl-c. Then I can preview equations all equations
>> in
>> ANY buffer with "C-u C-u C-c P". It's great to write equations in comments
>> of some programming buffer (no matter which programming language) and
>> being
>> able to render the equations right there.
>>
>> --
>> Darlan
>>
>> At Sun, 13 May 2012 00:46:51 +0200,
>> Daimrod <daimrod@gmail.com> wrote:
>> >
>> > Dov Grobgeld <dov.grobgeld@gmail.com> writes:
>> >
>> > > Is there any way of getting org-mode to display inline LaTeX fragments
>> > > in the emacs buffer? E.g. I would like to be able to type:
>> > >
>> > > The size of the hypotenuse is $\sqrt{a^2+b^2}$
>> > >
>> > > and then the buffer immediately shows:
>> > >
>> > > The size of the hypotenuse is √a²+b²
>> > >
>> > > where √a²+b² is a png image rendered via dvipng.
>> > >
>> > > I assume a toggle would switch between either seeing the formula or
>> > > seeing the source of the formula, just like for the display of inline
>> > > images. Also, pressing a backspace when the cursor is at the end of
>> > > the formula should erase the trailing $ sign, and turn off image
>> > > display of the formula, just like for [[links][name]].
>> > >
>> > > Has anything like this been implemented?
>> > >
>> > > Thanks!
>> > > Dov
>> >
>> > Yes, you can produce a preview image with C-c C-x C-l.
>> >
>> > See
>> > (info "(org) Previewing LaTeX fragments")
>> > and
>> > (info "(org) Embedded LaTeX")
>> >
>> >
>> >
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 3741 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inline LaTeX fragments in emacs buffer
  2012-05-14 14:52       ` Dov Grobgeld
@ 2012-05-14 17:22         ` Darlan Cavalcante Moreira
  2012-05-15 18:54         ` Nicolas Goaziou
  1 sibling, 0 replies; 7+ messages in thread
From: Darlan Cavalcante Moreira @ 2012-05-14 17:22 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: Daimrod, emacs-orgmode


I don't think breaking the equation into multiple lines is supported by
org. It may work but it is not guaranteed. I write the whole equation as a
single line and I don't have any problems, besides the equation being
harder to read and modify later.

Ps: I have the same use case scenario: writing notes with equations when I
watch the classes of the coursera courses. I also write the relevant
equation in a comment in the MATLAB/Octave when implementing the
programming exercises.

--
Darlan

At Mon, 14 May 2012 17:52:11 +0300,
Dov Grobgeld <dov.grobgeld@gmail.com> wrote:
> 
> I got it. Org-mode erroneously interpreted the + sign on the second row as
> a list token. Rearranging the latex text so that it does not start with -
> or + is a workaround.
> 
> On Mon, May 14, 2012 at 5:47 PM, Dov Grobgeld <dov.grobgeld@gmail.com>wrote:
> 
> > Thanks for the help. It makes my coursera ml-class notes easier to read.
> >
> > One issue I had when I tried exporting to HTML with the dvnpng option the
> > following equation:
> >
> > \[
> > J(\theta) = - \frac{1}{m} \left[\sum_{i=1} ^m y^{(i)} \log
> > h_\theta(x^{(i)})+(1-y^{(i)})\log(1-h_\theta(x^{(i)}))\right]
> >           + \frac{\lambda}{2m}\sum_{j=1} ^n \theta_j ^2
> > \]
> >
> > in the png output I got the following trailing text:ORG-LIST-END-MARKER .
> > Is this a known bug?
> >
> > Regards,
> > Dov
> >
> > On Sun, May 13, 2012 at 8:55 PM, Darlan Cavalcante Moreira <
> > darcamo@gmail.com> wrote:
> >
> >>
> >> org-preview-latex-fragment is really great but what is even better is that
> >> it also works outside org-mode! This makes my life a lot easier.
> >>
> >> I set "C-c P" as a global key-binding for org-preview-latex-fragment and
> >> "C-c p" to org-ctrl-c-ctrl-c. Then I can preview equations all equations
> >> in
> >> ANY buffer with "C-u C-u C-c P". It's great to write equations in comments
> >> of some programming buffer (no matter which programming language) and
> >> being
> >> able to render the equations right there.
> >>
> >> --
> >> Darlan
> >>
> >> At Sun, 13 May 2012 00:46:51 +0200,
> >> Daimrod <daimrod@gmail.com> wrote:
> >> >
> >> > Dov Grobgeld <dov.grobgeld@gmail.com> writes:
> >> >
> >> > > Is there any way of getting org-mode to display inline LaTeX fragments
> >> > > in the emacs buffer? E.g. I would like to be able to type:
> >> > >
> >> > > The size of the hypotenuse is $\sqrt{a^2+b^2}$
> >> > >
> >> > > and then the buffer immediately shows:
> >> > >
> >> > > The size of the hypotenuse is √a²+b²
> >> > >
> >> > > where √a²+b² is a png image rendered via dvipng.
> >> > >
> >> > > I assume a toggle would switch between either seeing the formula or
> >> > > seeing the source of the formula, just like for the display of inline
> >> > > images. Also, pressing a backspace when the cursor is at the end of
> >> > > the formula should erase the trailing $ sign, and turn off image
> >> > > display of the formula, just like for [[links][name]].
> >> > >
> >> > > Has anything like this been implemented?
> >> > >
> >> > > Thanks!
> >> > > Dov
> >> >
> >> > Yes, you can produce a preview image with C-c C-x C-l.
> >> >
> >> > See
> >> > (info "(org) Previewing LaTeX fragments")
> >> > and
> >> > (info "(org) Embedded LaTeX")
> >> >
> >> >
> >> >
> >>
> >>
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Inline LaTeX fragments in emacs buffer
  2012-05-14 14:52       ` Dov Grobgeld
  2012-05-14 17:22         ` Darlan Cavalcante Moreira
@ 2012-05-15 18:54         ` Nicolas Goaziou
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2012-05-15 18:54 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: Daimrod, emacs-orgmode

Hello,

Dov Grobgeld <dov.grobgeld@gmail.com> writes:

> I got it. Org-mode erroneously interpreted the + sign on the second row as
> a list token. Rearranging the latex text so that it does not start with -
> or + is a workaround.

Actually, it's not erroneous. Plain lists in Org mode have precedence
over paragraphs. It may be surprising sometimes but it would be the same
if you had:

\[
some equation
* This would be an headline
some other equation
\]


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-15 18:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-12 22:20 Inline LaTeX fragments in emacs buffer Dov Grobgeld
2012-05-12 22:46 ` Daimrod
2012-05-13 17:55   ` Darlan Cavalcante Moreira
2012-05-14 14:47     ` Dov Grobgeld
2012-05-14 14:52       ` Dov Grobgeld
2012-05-14 17:22         ` Darlan Cavalcante Moreira
2012-05-15 18:54         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).