emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* permanent LaTeX preview
@ 2011-09-29 16:57 Alexander Vorobiev
  2011-09-29 17:21 ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Vorobiev @ 2011-09-29 16:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Is it possible to stop rendered (with C-c C-x C-l) formulas from
reverting back to LaTeX source in case of:

1. Pressing C-c C-x C-l to render a formula in other part of the
document. All other formulas revert to LaTeX code in that case.
2. Pressing C-c C-c to, for instance, evaluate some babel block. In
this particular case it looks like I need to reassign the C-c C-c
keybinding used to remove the images, but I don't know which function
is called to achieve that.

In the both cases the images get replaced by the LaTeX source. What I
want is to keep the images at all times, and revert only an image I
want to edit LaTeX code for.

Thanks
Alex

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

* Re: permanent LaTeX preview
  2011-09-29 16:57 permanent LaTeX preview Alexander Vorobiev
@ 2011-09-29 17:21 ` Nick Dokos
  2011-09-29 18:37   ` Rasmus
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2011-09-29 17:21 UTC (permalink / raw)
  To: Alexander Vorobiev; +Cc: nicholas.dokos, emacs-orgmode

Alexander Vorobiev <alexander.vorobiev@gmail.com> wrote:

> Hi,
> 
> Is it possible to stop rendered (with C-c C-x C-l) formulas from
> reverting back to LaTeX source in case of:
> 
> 1. Pressing C-c C-x C-l to render a formula in other part of the
> document. All other formulas revert to LaTeX code in that case.
> 2. Pressing C-c C-c to, for instance, evaluate some babel block. In
> this particular case it looks like I need to reassign the C-c C-c
> keybinding used to remove the images, but I don't know which function
> is called to achieve that.
> 
> In the both cases the images get replaced by the LaTeX source. What I
> want is to keep the images at all times, and revert only an image I
> want to edit LaTeX code for.
> 

I don't think either is possible with the current code. 

Re. item 1: You can selectively render formulas by limiting the region
to a subtree, so it should be possible to do what you want by adding a
couple of functions and coming up with a decent user interface.

Re. item 2: this is done unconditionally in the function
org-ctrl-c-ctrl-c (in file lisp/org.el) and although I don't know the
reason, there probably is one and it's probably important[fn:1], so you
should proceed with caution. If you want to experiment, I'd suggest you
start by commenting out the >>>>> marked line <<<<< below in
org-ctrl-c-ctrl-c and testing extensively to see what breaks:

,----
| ...
| - If the cursor is on a code block, evaluate it.  The variable
|   `org-confirm-babel-evaluate' can be used to control prompting
|   before code block evaluation, by default every code block
|   evaluation requires confirmation.  Code block evaluation can be
|   inhibited by setting `org-babel-no-eval-on-ctrl-c-ctrl-c'."
|   (interactive "P")
|   (let  ((org-enable-table-editor t))
|     (cond
|      ((or (and (boundp 'org-clock-overlays) org-clock-overlays)
| 	  org-occur-highlights
| 	  org-latex-fragment-image-overlays)
|       (and (boundp 'org-clock-overlays) (org-clock-remove-overlays))
|       (org-remove-occur-highlights)
| >>>>> (org-remove-latex-fragment-image-overlays) <<<<<
|       (message "Temporary highlights/overlays removed from current buffer"))
| ...
`----

Cheers,
Nick

Footnotes:

[fn:1] I suspect that it's a necessary precondition for some of the
       *many* things that this function does, but I don't know for sure.

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

* Re: permanent LaTeX preview
  2011-09-29 17:21 ` Nick Dokos
@ 2011-09-29 18:37   ` Rasmus
  2011-09-29 19:12     ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Rasmus @ 2011-09-29 18:37 UTC (permalink / raw)
  To: emacs-orgmode



>> 1. Pressing C-c C-x C-l to render a formula in other part of the
>> document. All other formulas revert to LaTeX code in that case.
>> 2. Pressing C-c C-c to, for instance, evaluate some babel block. In
>> this particular case it looks like I need to reassign the C-c C-c
>> keybinding used to remove the images, but I don't know which function
>> is called to achieve that.
>
> I don't think either is possible with the current code. 

Would it be possible to use the more sophisticated Preview LaTeX of
AUCTeX? IMO it has a nicer way of dealing with previews.

–Rasmus 

-- 
Sent from my Emacs

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

* Re: permanent LaTeX preview
  2011-09-29 18:37   ` Rasmus
@ 2011-09-29 19:12     ` Nick Dokos
  2011-09-29 19:25       ` Rasmus
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2011-09-29 19:12 UTC (permalink / raw)
  To: Rasmus; +Cc: nicholas.dokos, emacs-orgmode

Rasmus <rasmus@gmx.us> wrote:

> 
> 
> >> 1. Pressing C-c C-x C-l to render a formula in other part of the
> >> document. All other formulas revert to LaTeX code in that case.
> >> 2. Pressing C-c C-c to, for instance, evaluate some babel block. In
> >> this particular case it looks like I need to reassign the C-c C-c
> >> keybinding used to remove the images, but I don't know which function
> >> is called to achieve that.
> >
> > I don't think either is possible with the current code. 
> 
> Would it be possible to use the more sophisticated Preview LaTeX of
> AUCTeX? IMO it has a nicer way of dealing with previews.
> 

Do you mean: "replace the org preview mechanism with the preview-latex
preview mechanism"? or "turn on auctex mode/preview-latex in addition to
org-mode in the org file"? or perhaps "export to latex and then use
preview-latex on the latex file"?

In either of the first two cases, my answer is "I don't know". IIRC,
there was some discussion of the former in this list a long time
ago. The second one sound easier (there are a couple of different ways
to turn on multiple major modes - see
e.g. http://www.emacswiki.org/emacs/MultipleModes) but I don't know how
conflicts between them are managed (and I imagine there will be plenty
of those), or what other problems might arise; it might be worth trying
though.

The third one is not as convenient as the other two might be, but it
exists *now* and does not require anything extra: bird in the hand and
all that.

Cheers,
Nick

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

* Re: permanent LaTeX preview
  2011-09-29 19:12     ` Nick Dokos
@ 2011-09-29 19:25       ` Rasmus
  0 siblings, 0 replies; 5+ messages in thread
From: Rasmus @ 2011-09-29 19:25 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> Do you mean: "replace the org preview mechanism with the preview-latex
> preview mechanism"? or "turn on auctex mode/preview-latex in addition to
> org-mode in the org file"? or perhaps "export to latex and then use
> preview-latex on the latex file"?

Either (i) or (ii), I guess.  I just checked.  It seems preview-latex
needs a tex file to work as it call filename.tex.  Of course, a file
could be generated upon request.  I don't know whether one could weave
them back together afterwards. 

Which I mostly miss from preview-latex is the possibility to `walk into'
generated pictures, and to easily regenerate stuff.

–Rasmus

-- 
Sent from my Emacs

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

end of thread, other threads:[~2011-09-29 19:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 16:57 permanent LaTeX preview Alexander Vorobiev
2011-09-29 17:21 ` Nick Dokos
2011-09-29 18:37   ` Rasmus
2011-09-29 19:12     ` Nick Dokos
2011-09-29 19:25       ` Rasmus

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).