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

>From 8753024dca47d906e73f7963293b2174ae0f37fe Mon Sep 17 00:00:00 2001
From: rasmus <ras...@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

>From 6c2139cc4275a426cedfbe548290b3c3f1b836a6 Mon Sep 17 00:00:00 2001
From: rasmus <ras...@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

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

Reply via email to