emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX preview
@ 2013-01-11 10:35 Daimrod
  2013-01-11 12:20 ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Daimrod @ 2013-01-11 10:35 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

Is there an #+STARTUP parameter to automatically display LaTeX
fragments?

If not, where do I have to look to add it?

-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: LaTeX preview
  2013-01-11 10:35 LaTeX preview Daimrod
@ 2013-01-11 12:20 ` Bastien
  2013-01-11 13:46   ` Daimrod
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-01-11 12:20 UTC (permalink / raw)
  To: Daimrod; +Cc: emacs-orgmode

Hi Daimrod,

Daimrod <daimrod@gmail.com> writes:

> Is there an #+STARTUP parameter to automatically display LaTeX
> fragments?

Nope, sorry.

-- 
 Bastien

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

* Re: LaTeX preview
  2013-01-11 12:20 ` Bastien
@ 2013-01-11 13:46   ` Daimrod
  2013-01-11 16:23     ` Bastien
  2013-01-24 13:07     ` Daimrod
  0 siblings, 2 replies; 10+ messages in thread
From: Daimrod @ 2013-01-11 13:46 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 300 bytes --]

Bastien <bzg@altern.org> writes:

> Hi Daimrod,
>
> Daimrod <daimrod@gmail.com> writes:
>
>> Is there an #+STARTUP parameter to automatically display LaTeX
>> fragments?
>
> Nope, sorry.

Here is a patch to add `org-startup-with-latex-preview'. It should work
like `org-startup-with-inline-images'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: org-startup-with-latex-preview.patch --]
[-- Type: text/x-diff, Size: 2320 bytes --]

diff --git a/doc/org.texi b/doc/org.texi
index 030eaf8..a13d565 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -9752,6 +9752,19 @@ some aspects of the preview.  In particular, the @code{:scale} (and for HTML
 export, @code{:html-scale}) property can be used to adjust the size of the
 preview images.
 
+@vindex org-startup-with-latex-preview
+You can turn on the previewing of all @LaTeX{} fragments of a file with
+
+@example
+#+STARTUP: latexpreview
+@end example
+
+To disable it, simply use
+
+@example
+#+STARTUP: nolatexpreview
+@end example
+
 @node CDLaTeX mode,  , Previewing @LaTeX{} fragments, Embedded @LaTeX{}
 @subsection Using CD@LaTeX{} to enter math
 @cindex CD@LaTeX{}
diff --git a/lisp/org.el b/lisp/org.el
index effb231..2e7f3a4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -580,6 +580,16 @@ the following lines anywhere in the buffer:
   :version "24.1"
   :type 'boolean)
 
+(defcustom org-startup-with-latex-preview nil
+  "Non-nil means preview LaTeX fragments when loading a new Org file.
+
+This can also be configured on a per-file basis by adding one of
+the followinglines anywhere in the buffer:
+   #+STARTUP: latexpreview
+   #+STARTUP: nolatexpreview"
+  :group 'org-startup
+  :type 'boolean)
+
 (defcustom org-insert-mode-line-in-empty-file nil
   "Non-nil means insert the first line setting Org-mode in empty files.
 When the function `org-mode' is called interactively in an empty file, this
@@ -4509,6 +4519,8 @@ After a match, the following groups carry important information:
     ("noalign" org-startup-align-all-tables nil)
     ("inlineimages" org-startup-with-inline-images t)
     ("noinlineimages" org-startup-with-inline-images nil)
+    ("latexpreview" org-startup-with-latex-preview t)
+    ("nolatexpreview" org-startup-with-latex-preview nil)
     ("customtime" org-display-custom-times t)
     ("logdone" org-log-done time)
     ("lognotedone" org-log-done note)
@@ -5154,6 +5166,8 @@ The following commands are available:
 	(set-buffer-modified-p bmp)))
     (when org-startup-with-inline-images
       (org-display-inline-images))
+    (when org-startup-with-latex-preview
+      (org-preview-latex-fragment))
     (when org-startup-indented
       (require 'org-indent)
       (org-indent-mode 1))

[-- Attachment #1.3: Type: text/plain, Size: 21 bytes --]


-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: LaTeX preview
  2013-01-11 13:46   ` Daimrod
@ 2013-01-11 16:23     ` Bastien
  2013-01-11 16:47       ` Daimrod
  2013-01-24 13:07     ` Daimrod
  1 sibling, 1 reply; 10+ messages in thread
From: Bastien @ 2013-01-11 16:23 UTC (permalink / raw)
  To: Daimrod; +Cc: emacs-orgmode

Hi,

Daimrod <daimrod@gmail.com> writes:

> Here is a patch to add `org-startup-with-latex-preview'. It should work
> like `org-startup-with-inline-images'.

Thanks for the patch.  Did you already sign a FSF copyright assignment
or do you plan to sign one?

  http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

I cannot apply/accept the patch otherwise :(

Thanks,

-- 
 Bastien

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

* Re: LaTeX preview
  2013-01-11 16:23     ` Bastien
@ 2013-01-11 16:47       ` Daimrod
  2013-01-11 16:53         ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Daimrod @ 2013-01-11 16:47 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

Bastien <bzg@altern.org> writes:

> Hi,
>
> Daimrod <daimrod@gmail.com> writes:
>
>> Here is a patch to add `org-startup-with-latex-preview'. It should work
>> like `org-startup-with-inline-images'.
>
> Thanks for the patch.  Did you already sign a FSF copyright assignment
> or do you plan to sign one?
>
>   http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt
>
> I cannot apply/accept the patch otherwise :(
>
> Thanks,

I've sent a request. I will tell you when it's done, I hope this won't take
too much time.

-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: LaTeX preview
  2013-01-11 16:47       ` Daimrod
@ 2013-01-11 16:53         ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2013-01-11 16:53 UTC (permalink / raw)
  To: Daimrod; +Cc: emacs-orgmode

Daimrod <daimrod@gmail.com> writes:

> I've sent a request. I will tell you when it's done, I hope this won't take
> too much time.

Thanks!!

-- 
 Bastien

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

* Re: LaTeX preview
  2013-01-11 13:46   ` Daimrod
  2013-01-11 16:23     ` Bastien
@ 2013-01-24 13:07     ` Daimrod
  2013-02-14  8:17       ` Bastien
  1 sibling, 1 reply; 10+ messages in thread
From: Daimrod @ 2013-01-24 13:07 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 388 bytes --]

Daimrod <daimrod@gmail.com> writes:

> Bastien <bzg@altern.org> writes:
>
>> Hi Daimrod,
>>
>> Daimrod <daimrod@gmail.com> writes:
>>
>>> Is there an #+STARTUP parameter to automatically display LaTeX
>>> fragments?
>>
>> Nope, sorry.
>
> Here is a patch to add `org-startup-with-latex-preview'. It should work
> like `org-startup-with-inline-images'.

Here is a better formatted patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-a-new-startup-keyword-to-preview-LaTeX-fragments.patch --]
[-- Type: text/x-diff, Size: 6389 bytes --]

From 63cd29b1d5b0c5758870a14ac3257e69d4560925 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@gmail.com>
Date: Thu, 24 Jan 2013 14:02:00 +0100
Subject: [PATCH] Add a new startup keyword to preview LaTeX fragments

* doc/org.texi (Previewing @LaTeX{} fragments): Document the startup
  keywords which can be used to preview or not LaTeX fragments.
(Summary of in-buffer settings): Improve formatting and add an entry
for the variable `org-startup-with-latex-preview'.

* org.el (org-mode, org-startup-options,
  org-startup-with-inline-images): Add the variable
  `org-startup-with-latex-preview' which can be used to preview LaTeX
  fragments on startup. This variable is set to `nil' by default.
---
 doc/org.texi |   32 ++++++++++++++++++++++++++++++++
 lisp/org.el  |   14 ++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/doc/org.texi b/doc/org.texi
index 37c7ac5..43a89ca 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -9758,6 +9758,19 @@ some aspects of the preview.  In particular, the @code{:scale} (and for HTML
 export, @code{:html-scale}) property can be used to adjust the size of the
 preview images.
 
+@vindex org-startup-with-latex-preview
+You can turn on the previewing of all @LaTeX{} fragments in a file with
+
+@example
+#+STARTUP: latexpreview
+@end example
+
+To disable it, simply use
+
+@example
+#+STARTUP: nolatexpreview
+@end example
+
 @node CDLaTeX mode,  , Previewing @LaTeX{} fragments, Embedded @LaTeX{}
 @subsection Using CD@LaTeX{} to enter math
 @cindex CD@LaTeX{}
@@ -14955,6 +14968,18 @@ inlineimages   @r{show inline images}
 noinlineimages @r{don't show inline images on startup}
 @end example
 
+@vindex org-startup-with-latex-preview
+When visiting a file, @LaTeX{} fragments can be converted to images
+automatically.  The variable @code{org-startup-with-latex-preview} which
+controls this behavior, is set to @code{nil} by default to avoid delays on
+startup.
+@cindex @code{latexpreview}, STARTUP keyword
+@cindex @code{nolatexpreview}, STARTUP keyword
+@example
+latexpreview   @r{preview @LaTeX{} fragments}
+nolatexpreview @r{don't preview @LaTeX{} fragments}
+@end example
+
 @vindex org-log-done
 @vindex org-log-note-clock-out
 @vindex org-log-repeat
@@ -15005,6 +15030,7 @@ nologdrawer         @r{store log outside of drawer}
 logstatesreversed   @r{reverse the order of states notes}
 nologstatesreversed @r{do not reverse the order of states notes}
 @end example
+
 @vindex org-hide-leading-stars
 @vindex org-odd-levels-only
 Here are the options for hiding leading stars in outline headings, and for
@@ -15023,6 +15049,7 @@ noindent   @r{no virtual indentation according to outline level}
 odd        @r{allow only odd outline levels (1,3,...)}
 oddeven    @r{allow all outline levels}
 @end example
+
 @vindex org-put-time-stamp-overlays
 @vindex org-time-stamp-overlay-formats
 To turn on custom format overlays over timestamps (variables
@@ -15032,6 +15059,7 @@ To turn on custom format overlays over timestamps (variables
 @example
 customtime @r{overlay custom time format}
 @end example
+
 @vindex constants-unit-system
 The following options influence the table spreadsheet (variable
 @code{constants-unit-system}).
@@ -15041,6 +15069,7 @@ The following options influence the table spreadsheet (variable
 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
 constSI    @r{@file{constants.el} should use the SI unit system}
 @end example
+
 @vindex org-footnote-define-inline
 @vindex org-footnote-auto-label
 @vindex org-footnote-auto-adjust
@@ -15067,6 +15096,7 @@ fnplain     @r{create @code{[1]}-like labels automatically}
 fnadjust    @r{automatically renumber and sort footnotes}
 nofnadjust  @r{do not renumber and sort automatically}
 @end example
+
 @cindex org-hide-block-startup
 To hide blocks on startup, use these keywords.  The corresponding variable is
 @code{org-hide-block-startup}.
@@ -15076,6 +15106,7 @@ To hide blocks on startup, use these keywords.  The corresponding variable is
 hideblocks   @r{Hide all begin/end blocks on startup}
 nohideblocks @r{Do not hide blocks on startup}
 @end example
+
 @cindex org-pretty-entities
 The display of entities as UTF-8 characters is governed by the variable
 @code{org-pretty-entities} and the keywords
@@ -15085,6 +15116,7 @@ The display of entities as UTF-8 characters is governed by the variable
 entitiespretty  @r{Show entities as UTF-8 characters where possible}
 entitiesplain   @r{Leave entities plain}
 @end example
+
 @item #+TAGS:  TAG1(c1) TAG2(c2)
 @vindex org-tag-alist
 These lines (several such lines are allowed) specify the valid tags in
diff --git a/lisp/org.el b/lisp/org.el
index 45842d5..731e116 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -582,6 +582,16 @@ the following lines anywhere in the buffer:
   :version "24.1"
   :type 'boolean)
 
+(defcustom org-startup-with-latex-preview nil
+  "Non-nil means preview LaTeX fragments when loading a new Org file.
+
+This can also be configured on a per-file basis by adding one of
+the followinglines anywhere in the buffer:
+   #+STARTUP: latexpreview
+   #+STARTUP: nolatexpreview"
+  :group 'org-startup
+  :type 'boolean)
+
 (defcustom org-insert-mode-line-in-empty-file nil
   "Non-nil means insert the first line setting Org-mode in empty files.
 When the function `org-mode' is called interactively in an empty file, this
@@ -4511,6 +4521,8 @@ After a match, the following groups carry important information:
     ("noalign" org-startup-align-all-tables nil)
     ("inlineimages" org-startup-with-inline-images t)
     ("noinlineimages" org-startup-with-inline-images nil)
+    ("latexpreview" org-startup-with-latex-preview t)
+    ("nolatexpreview" org-startup-with-latex-preview nil)
     ("customtime" org-display-custom-times t)
     ("logdone" org-log-done time)
     ("lognotedone" org-log-done note)
@@ -5156,6 +5168,8 @@ The following commands are available:
 	(set-buffer-modified-p bmp)))
     (when org-startup-with-inline-images
       (org-display-inline-images))
+    (when org-startup-with-latex-preview
+      (org-preview-latex-fragment))
     (when org-startup-indented
       (require 'org-indent)
       (org-indent-mode 1))
-- 
1.7.10.4


[-- Attachment #1.3: Type: text/plain, Size: 21 bytes --]


-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: LaTeX preview
  2013-01-24 13:07     ` Daimrod
@ 2013-02-14  8:17       ` Bastien
  2013-02-14 13:03         ` Evan Misshula
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-02-14  8:17 UTC (permalink / raw)
  To: Daimrod; +Cc: emacs-orgmode

Hi Greg,

Daimrod <daimrod@gmail.com> writes:

> Here is a better formatted patch:

I applied this change, thanks a lot!

-- 
 Bastien

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

* Re: LaTeX preview
  2013-02-14  8:17       ` Bastien
@ 2013-02-14 13:03         ` Evan Misshula
  2013-02-14 16:56           ` Daimrod
  0 siblings, 1 reply; 10+ messages in thread
From: Evan Misshula @ 2013-02-14 13:03 UTC (permalink / raw)
  To: Bastien; +Cc: Daimrod, emacs-orgmode

+1 This is great,  I wanted to do something but did not know how.  I
am going to look at the patch.   If you have an interest in explaining
to an interested Noob what you did.  I would be grateful.

Best,
Evan

On Thu, Feb 14, 2013 at 3:17 AM, Bastien <bzg@altern.org> wrote:
> Hi Greg,
>
> Daimrod <daimrod@gmail.com> writes:
>
>> Here is a better formatted patch:
>
> I applied this change, thanks a lot!
>
> --
>  Bastien
>



-- 
Evan Misshula
Doctoral Student (Criminal Justice)
CUNY John Jay
"Let us reform our schools, and we shall find little reform needed in
our prisons."
       John Ruskin, Unto This Last, essay 2 (1862)
       English critic, essayist, & reformer (1819 - 1900)

"Instruction does much, but encouragement does everything." Johann
Wolfgang Von Goethe
www.snrg-nyc.org

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

* Re: LaTeX preview
  2013-02-14 13:03         ` Evan Misshula
@ 2013-02-14 16:56           ` Daimrod
  0 siblings, 0 replies; 10+ messages in thread
From: Daimrod @ 2013-02-14 16:56 UTC (permalink / raw)
  To: Evan Misshula; +Cc: Bastien, emacs-orgmode

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

Evan Misshula <evanmisshula@gmail.com> writes:

> +1 This is great,  I wanted to do something but did not know how.  I
> am going to look at the patch.

I'm glad to know other people like it too :)

> If you have an interest in explaining to an interested Noob what you
> did. I would be grateful.

Sure,

I knew I wanted something like the inlineimages STARTUP keywords. So,
I've searched in the source all references to inlineimages.

M-x moccur-grep RET inlineimages RET

I've found:
a custom variable: `org-startup-with-line-images'
an entry in `org-startup-options'

Then I've searched for `org-startup-with-inline-images' and found:
> (when org-startup-with-inline-images
>       (org-display-inline-images))

Then, I've searched the name of the function which toggled the latex
preview. C-h a latex RET then C-s preview in the *Apropos* buffer.

At this point I had everything and I just needed to copy what was done
for inlineimages and adapt it for latexpreview.

> Best,
> Evan

-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

end of thread, other threads:[~2013-02-14 16:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 10:35 LaTeX preview Daimrod
2013-01-11 12:20 ` Bastien
2013-01-11 13:46   ` Daimrod
2013-01-11 16:23     ` Bastien
2013-01-11 16:47       ` Daimrod
2013-01-11 16:53         ` Bastien
2013-01-24 13:07     ` Daimrod
2013-02-14  8:17       ` Bastien
2013-02-14 13:03         ` Evan Misshula
2013-02-14 16:56           ` Daimrod

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