emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: LaTeX preview
Date: Thu, 24 Jan 2013 14:07:48 +0100	[thread overview]
Message-ID: <87pq0uloez.fsf@casa.home> (raw)
In-Reply-To: <87obgvvnlj.fsf@casa.home> (daimrod@gmail.com's message of "Fri, 11 Jan 2013 14:46:48 +0100")


[-- 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 --]

  parent reply	other threads:[~2013-01-24 13:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-02-14  8:17       ` Bastien
2013-02-14 13:03         ` Evan Misshula
2013-02-14 16:56           ` Daimrod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pq0uloez.fsf@casa.home \
    --to=daimrod@gmail.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).