emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: [bug?][patch] Org LaTeX Fragments
Date: Wed, 11 Sep 2013 12:19:01 +0200	[thread overview]
Message-ID: <87d2ofu0dm.fsf@gmx.us> (raw)

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

Hi,

I don't know if this is a bug or a feature, but consider the following
test file:

#+BEGIN_SRC Org
#+TITLE: Fails when exporting
#+TITLE: Fails when exporting

* Instructions							   :noexport:

  1. Start =emacs -q=
  2. <<p2>> Run \src_emacs-lisp{(org-preview-latex-fragment)}
     - WORKS
  3. <<p3>> Run \src_emacs-lisp{(org-latex-export-to-pdf)} =./test.pdf=
     - FAILS

  [[p2]] works when [[p3]] fails because `org-format-latex-header`
  loads =amsmath=, but Org LaTeX export doesn't.  Why I don't know.

  *Proposal: Replace amstext with amsmath.*

* test
\begin{align}
x \mathcal{ABC}
\end{align}
#+END_SRC


The first patch adds amsmath as a dependency which fixes the above
bug.  According to my TeXLive it seems amstext is distributed with
amsmath, so I don't think that's an issue.  Increased load time?
Well, maybe.  I didn't test.

Will amstext be missed?  No, it's loaded by amsmath, currently line 120

     \RequirePackage{amstext}[1995/01/25]

The second patch removes the dependency on eucal.  Eucal provides an
alternative font for the mathcal macro.  Unless someone believes it's
better than the standard font, e.g. for small fonts, there is little
point in requiring it IMO.

We could also replace color with xcolor, which is the better
alternative, but I don't think it matters in this case and hence I
haven't provided a patch for that. 

–Rasmus


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-amsmath-as-a-global-LaTeX-dependency.patch --]
[-- Type: text/x-diff, Size: 1740 bytes --]

From 8753024dca47d906e73f7963293b2174ae0f37fe Mon Sep 17 00:00:00 2001
From: rasmus <rasmus@gmx.us>
Date: Wed, 11 Sep 2013 11:53:47 +0200
Subject: [PATCH 1/2] Add amsmath as a global LaTeX dependency

* org.el (org-format-latex-header): Remove amsmath.
(org-latex-default-packages-alist): Remove amstext and add amsmath.

This increases consistency between LaTeX exports and LaTeX preview
snippets.
---
 lisp/org.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 59a22a2..e8f25e9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3780,7 +3780,6 @@ images at the same place."
 
 (defcustom org-format-latex-header "\\documentclass{article}
 \\usepackage[usenames]{color}
-\\usepackage{amsmath}
 \\usepackage[mathscr]{eucal}
 \[PACKAGES]
 \[DEFAULT-PACKAGES]
@@ -3832,11 +3831,11 @@ header, or they will be appended."
     (""     "float"     nil)
     (""     "wrapfig"   nil)
     ("normalem" "ulem"  t)
+    (""     "amsmath"   t)
     (""     "textcomp"  t)
     (""     "marvosym"  t)
     (""     "wasysym"   t)
     (""     "amssymb"   t)
-    (""     "amstext"   nil)
     (""     "hyperref"  nil)
     "\\tolerance=1000")
   "Alist of default packages to be inserted in the header.
@@ -3848,7 +3847,7 @@ The packages in this list are needed by one part or another of
 Org mode to function properly:
 
 - inputenc, fontenc:  for basic font and character selection
-- amstext: for subscript and superscript
+- amsmath: for subscript and superscript and math environments
 - textcomp, marvosymb, wasysym, amssymb: for various symbols used
   for interpreting the entities in `org-entities'.  You can skip
   some of these packages if you don't use any of their symbols.
-- 
1.8.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Remove-depedency-on-eucal-for-LaTeX-fragments-genera.patch --]
[-- Type: text/x-diff, Size: 787 bytes --]

From 6c2139cc4275a426cedfbe548290b3c3f1b836a6 Mon Sep 17 00:00:00 2001
From: rasmus <rasmus@gmx.us>
Date: Wed, 11 Sep 2013 11:58:08 +0200
Subject: [PATCH 2/2] Remove depedency on eucal for LaTeX fragments generation.

* org.el (org-format-latex-header): Remove eucal.

With amsmath loaded eucal (basically) only provides an alternative
typeface to \mathcal{.}
---
 lisp/org.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index e8f25e9..997e740 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3780,7 +3780,6 @@ images at the same place."
 
 (defcustom org-format-latex-header "\\documentclass{article}
 \\usepackage[usenames]{color}
-\\usepackage[mathscr]{eucal}
 \[PACKAGES]
 \[DEFAULT-PACKAGES]
 \\pagestyle{empty}             % do not remove
-- 
1.8.4


[-- Attachment #4: Type: text/plain, Size: 67 bytes --]


--
There are known knowns; there are things we know that we know.

             reply	other threads:[~2013-09-11 10:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 10:19 Rasmus [this message]
2013-09-11 13:18 ` [bug?][patch] Org LaTeX Fragments Nicolas Goaziou
2013-09-11 15:22   ` Rasmus
2013-09-12 15:07     ` Nicolas Goaziou

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=87d2ofu0dm.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --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).