* ox-latex: default packages cleaning
@ 2015-07-07 14:53 Rasmus
2015-07-07 15:48 ` Eric S Fraga
` (4 more replies)
0 siblings, 5 replies; 31+ messages in thread
From: Rasmus @ 2015-07-07 14:53 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 5262 bytes --]
Hi,
We could do some cleaning of org-default-package-alist before Org 8.3.
* tolerance
Why is "\\tolerance=1000" part of org-default-package-alist? Is this
value good for all languages? If we keep it, it should be configurable.
But people who explicitly wants this behavior can probably add it
themselves.
If it's a means to archive "high-quality" paragraphs, maybe microtype is
probably the 'proper' fix...
* Fixltx2e
This packages is depreciated with TL2015 cf. LaTeX News 22. We can use
\RequirePackage[current]{latexrelease} but there's no point in that....
AFAIK latexrelease only useful for backwards compatibility.
* marvosym¹
This is used for
("EUR" "\\EUR{}" nil "€" "EUR" "EUR" "€")
("EURdig" "\\EURdig{}" nil "€" "EUR" "EUR" "€")
("EURhv" "\\EURhv{}" nil "€" "EUR" "EUR" "€")
("EURcr" "\\EURcr{}" nil "€" "EUR" "EUR" "€")
("EURtm" "\\EURtm{}" nil "€" "EUR" "EUR" "€")
We could either call \\texteuro{} or use eurosym. IMO, if people wants
something more sophisticated than \texteuro (which depends on the current
font) can load marvosym or eurosym.
* Wasysym²
Wasysym is used for a couple of smileys.
("smiley" "\\smiley{}" nil "☺" ":-)" ":-)" "☺")
("blacksmile" "\\blacksmiley{}" nil "☻" ":-)" ":-)" "☻")
("sad" "\\frownie{}" nil "☹" ":-(" ":-(" "☹")
I don't know why these smileys are blessed when '😱' and '😺' are not.
Ideally, you'd just use unicode smileys, but this requires {xe,lua}tex.
So for now we can could use \(\ddot\smile\) and \(\ddot\frown\) and shave
off the extra dependency. Put perhaps it's better to just let people
choose themselves which smiley command they will want to use in which case
we could also just remove wasysym.
Rasmus
Footnotes:
¹ (defun rasmus-next-marvosym ()
"find marvosym symbols"
(interactive)
(let (case-fold-search)
(search-forward-regexp
(format "\\\\%s\\>" (regexp-opt (mapcar 'symbol-name '(Pickup Letter Mobilefone Telefon fax FAX Faxmachine Email Lightning EmailCT Beam Bearing LooseBearing FixedBearing LeftTorque RightTorque Lineload MVArrowDown OktoSteel HexaSteel SquareSteel RectSteel CircSteel SquarePipe RectPipe CircPipe LSteel RoundedLSteel TSteel RoundedTSteel TTsteel RoundedTTSteel FlatSteel Valve Industry Coffeecup LeftScissors CuttingLine RightScissors Football Bicycle Info ClockLogo CutRight CutLineine CutLeft Wheelchair Gentsroom Ladiesroom Checkedbox CrossedBox HollowBox PointingHand WritingHand MineSign Recycling PackingWaste WashCotton WashSynthetics WashWool HandWash NoWash Tumbler NoTumbler NoChemicalCleaning Bleech NoBleech CleaningA CleaningP CleaningPP CleaningF CleaningFF IroningI IroningII IroningIII NoIroning AtNinetyFive ShortNinetyFive AtSixty ShortSixty ShortFifty AtForty ShortForty SpecialForty ShortThirty EUR EURdig EURhv EURcr EURtm Ecommerce Shilling Denarius Pfund EyesDollar Florin EurDig EurHv EurCr EurTm EstimatedSign Deleatur Ecommerce Denarius EUR EURdig Stopsign CESign Estatically Explosionsafe Laserbeam Biohazard Radioactivity BSEFree RewindToIndex RewindToStart Rewind Forward ForwardToEnd ForwardToIndex MoveUp MoveDown ToTop ToBottom ComputerMouse SerialInterface Keyboard SerialPort ParallelPort Printer MVZero MVOne MVTwo MVThree MVFour MVFive MVSix MVSeven MVEight MVNine MVLeftBracket MVRightBracket MVComma MVPeriod MVMinus MVPlus MVDivision MVMultiplication Conclusion Equivalence barOver BarOver arrowOver ArrowOver StrikingThrough MultiplicationDot LessOrEqual LargerOrEqual AngleSign Corresponds Congruent NotCongruent Divides DividesNot Female Male Hermaphrodite Neutral FEMALE MALE HERMAPHRODITE FemaleFemale MaleMale FemaleMale Sun Moon Mercury Venus Mars Jupiter Saturn Uranus Neptune Pluto Earth Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Capricorn Aquarius Pisces YinYang MVRightArrow MVAt BOLogo BOLogoL BALogoP Mundus Cross CeltCross Ankh Heart CircledA Bouquet Frowny Smiley PeaceDove Bat WomanFace ManFace))))
nil t)))
² (defun rasmus-next-wasy ()
"next wasysym symbol"
(interactive)
(let (case-fold-search)
(search-forward-regexp
(format "\\\\%s\\>"
(regexp-opt
(mapcar 'symbol-name
'(male female currency phone recorder clock lightning pointer RIGHTarrow LEFTarrow UParrow DOWNarrow diameter invdiameter varangle wasylozenge kreuz smiley frownie blacksmiley sun checked bell ataribox cent permil brokenvert wasytherefore Bowtie agemO AC HF VHF photon gluon Square XBox CheckedBox hexagon varhexagon pentagon octagon hexstar varhexstar davidsstar eighthnote quarternote u2669 halfnote fullnote twonotes CIRCLE Leftcircle LEFTCIRCLE Rightcircle RIGHTCIRCLE LEFTcircle RIGHTcircle leftturn rightturn dh DH thorn Thorn openo inve vernal ascnode descnode fullmoon newmoon leftmoon rightmoon astrosun mercury venus earth mars jupiter saturn uranus neptune pluto aries taurus gemini cancer leo virgo libra scorpio sagittarius capricornus aquarius pisces conjunction opposition APLstar APLlog APLbox APLup))))
nil t)))
--
Tack, ni svenska vakttorn. Med plutonium tvingar vi dansken på knä!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Remove-default-LaTeX-tolerance.patch --]
[-- Type: text/x-diff, Size: 804 bytes --]
From da2a2b3fc5b182eb791f86abdd6ada3b62b0c9fe Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 7 Jul 2015 16:08:13 +0200
Subject: [PATCH 1/7] org.el: Remove default LaTeX tolerance
* org.el (org-latex-default-packages-alist): Remove fixed tolerance.
---
lisp/org.el | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 085b763..d6e8ada 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4084,8 +4084,7 @@ header, or they will be appended."
("" "wasysym" t)
("" "amssymb" t)
("" "capt-of" nil)
- ("" "hyperref" nil)
- "\\tolerance=1000")
+ ("" "hyperref" nil))
"Alist of default packages to be inserted in the header.
Change this only if one of the packages here causes an
--
2.4.5
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-org.el-Remove-fixltx2e-LaTeX-dependency.patch --]
[-- Type: text/x-diff, Size: 1066 bytes --]
From c29c6a7357a737f5165d577e6cc609ed7eb0f7a1 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 7 Jul 2015 16:09:08 +0200
Subject: [PATCH 2/7] org.el: Remove fixltx2e LaTeX dependency
* org.el (org-latex-default-packages-alist): Remove fixltx2e.
---
lisp/org.el | 2 --
1 file changed, 2 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index d6e8ada..db29e8d 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4071,7 +4071,6 @@ header, or they will be appended."
(defcustom org-latex-default-packages-alist
'(("AUTO" "inputenc" t)
("T1" "fontenc" t)
- ("" "fixltx2e" nil)
("" "graphicx" t)
("" "grffile" t)
("" "longtable" nil)
@@ -4094,7 +4093,6 @@ 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
-- fixltx2e: Important patches of LaTeX itself
- graphicx: for including images
- grffile: allow periods and spaces in graphics file names
- longtable: For multipage tables
--
2.4.5
[-- Attachment #4: 0003-org.el-Remove-marvosym-LaTeX-dependency.patch --]
[-- Type: text/x-diff, Size: 2221 bytes --]
From e4f9dac2c2b117abf152e91d0498a8d61536d6d2 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 7 Jul 2015 16:14:39 +0200
Subject: [PATCH 3/7] org.el: Remove marvosym LaTeX dependency
* org.el (org-latex-default-packages-alist): Remove marvosym.
* org-entities.el (org-entities): \EUR is now replaced with
\texteuro. Remove EURdig, EURhv, EURcr, EURtm.
---
lisp/org-entities.el | 6 +-----
lisp/org.el | 3 +--
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/lisp/org-entities.el b/lisp/org-entities.el
index 732b989..4e94fa4 100644
--- a/lisp/org-entities.el
+++ b/lisp/org-entities.el
@@ -296,11 +296,7 @@ packages to be loaded, add these packages to `org-latex-packages-alist'."
("pound" "\\pounds{}" nil "£" "pound" "£" "£")
("yen" "\\textyen{}" nil "¥" "yen" "¥" "¥")
("euro" "\\texteuro{}" nil "€" "EUR" "EUR" "€")
- ("EUR" "\\EUR{}" nil "€" "EUR" "EUR" "€")
- ("EURdig" "\\EURdig{}" nil "€" "EUR" "EUR" "€")
- ("EURhv" "\\EURhv{}" nil "€" "EUR" "EUR" "€")
- ("EURcr" "\\EURcr{}" nil "€" "EUR" "EUR" "€")
- ("EURtm" "\\EURtm{}" nil "€" "EUR" "EUR" "€")
+ ("EUR" "\\texteuro{}" nil "€" "EUR" "EUR" "€")
"** Property Marks"
("copy" "\\textcopyright{}" nil "©" "(c)" "©" "©")
diff --git a/lisp/org.el b/lisp/org.el
index db29e8d..508ace7 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4079,7 +4079,6 @@ header, or they will be appended."
("normalem" "ulem" t)
("" "amsmath" t)
("" "textcomp" t)
- ("" "marvosym" t)
("" "wasysym" t)
("" "amssymb" t)
("" "capt-of" nil)
@@ -4100,7 +4099,7 @@ Org mode to function properly:
- rotating: for sideways figures and tables
- ulem: for underline and strike-through
- amsmath: for subscript and superscript and math environments
-- textcomp, marvosymb, wasysym, amssymb: for various symbols used
+- textcomp, 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.
- capt-of: for captions outside of floats
--
2.4.5
[-- Attachment #5: 0004-org.el-Remove-wasysym-LaTeX-dependency.patch --]
[-- Type: text/x-diff, Size: 2007 bytes --]
From 2459224bbe5912082e382f4f015a42eca15c3e12 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 7 Jul 2015 16:19:54 +0200
Subject: [PATCH 4/7] org.el: Remove wasysym LaTeX dependency
---
lisp/org-entities.el | 6 +++---
lisp/org.el | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/lisp/org-entities.el b/lisp/org-entities.el
index 4e94fa4..8813ac3 100644
--- a/lisp/org-entities.el
+++ b/lisp/org-entities.el
@@ -495,9 +495,9 @@ packages to be loaded, add these packages to `org-latex-packages-alist'."
"** Smilies"
("smile" "\\smile" t "⌣" ":-)" ":-)" "⌣")
("frown" "\\frown" t "⌢" ":-(" ":-(" "⌢")
- ("smiley" "\\smiley{}" nil "☺" ":-)" ":-)" "☺")
- ("blacksmile" "\\blacksmiley{}" nil "☻" ":-)" ":-)" "☻")
- ("sad" "\\frownie{}" nil "☹" ":-(" ":-(" "☹")
+ ("smiley" "\\ddot\\smile" t "☺" ":-)" ":-)" "☺")
+ ("blacksmile" "\\ddot\\smile" t "☻" ":-)" ":-)" "☻")
+ ("sad" "\\ddot\\frown" t "☹" ":-(" ":-(" "☹")
"** Suits"
("clubs" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣")
diff --git a/lisp/org.el b/lisp/org.el
index 508ace7..f10ccf9 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4079,7 +4079,6 @@ header, or they will be appended."
("normalem" "ulem" t)
("" "amsmath" t)
("" "textcomp" t)
- ("" "wasysym" t)
("" "amssymb" t)
("" "capt-of" nil)
("" "hyperref" nil))
@@ -4099,7 +4098,7 @@ Org mode to function properly:
- rotating: for sideways figures and tables
- ulem: for underline and strike-through
- amsmath: for subscript and superscript and math environments
-- textcomp, wasysym, amssymb: for various symbols used
+- textcomp, 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.
- capt-of: for captions outside of floats
--
2.4.5
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-Update-ORG-NEWS-with-resepect-to-package-removals.patch --]
[-- Type: text/x-diff, Size: 1113 bytes --]
From 88f85d8230f9c6ce01dd23777e0588ced610bfe6 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 7 Jul 2015 16:26:02 +0200
Subject: [PATCH 5/7] Update ORG-NEWS with resepect to package removals
---
etc/ORG-NEWS | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 4a4a9d8..c605670 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -429,8 +429,10 @@ when ~org-link-search-must-match-exact-headline~ is not nil.
*** ~org-latex-hyperref-template~, ~org-latex-title-command~ formatting
New formatting keys are supported. See the respective docstrings.
Note, ~org-latex-hyperref-template~ has a new default value.
-*** ~float.sty~ has been removed from ~org-latex-default-packages-alist~
-If you require this package add it to ~org-latex-packages-alist~.
+*** ~float, wasysym, marvosym, fixltx2e~ are removed from ~org-latex-default-packages-alist~
+If you require any of these package add them to your preamble via
+~org-latex-packages-alist~. Org also uses default LaTeX ~\tolerance~
+now.
* Version 8.2
** Incompatible changes
--
2.4.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 14:53 ox-latex: default packages cleaning Rasmus
@ 2015-07-07 15:48 ` Eric S Fraga
2015-07-07 19:35 ` Suvayu Ali
` (3 subsequent siblings)
4 siblings, 0 replies; 31+ messages in thread
From: Eric S Fraga @ 2015-07-07 15:48 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
On Tuesday, 7 Jul 2015 at 16:53, Rasmus wrote:
> Hi,
>
> We could do some cleaning of org-default-package-alist before Org 8.3.
Rasmus,
I'm happy with all of your suggested removals.
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1260-gcedef7
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 14:53 ox-latex: default packages cleaning Rasmus
2015-07-07 15:48 ` Eric S Fraga
@ 2015-07-07 19:35 ` Suvayu Ali
2015-07-07 20:05 ` Rasmus
` (3 more replies)
2015-07-10 11:25 ` Robert Klein
` (2 subsequent siblings)
4 siblings, 4 replies; 31+ messages in thread
From: Suvayu Ali @ 2015-07-07 19:35 UTC (permalink / raw
To: emacs-orgmode
Hi Rasmus,
On Tue, Jul 07, 2015 at 04:53:35PM +0200, Rasmus wrote:
>
> If it's a means to archive "high-quality" paragraphs, maybe microtype is
> probably the 'proper' fix...
I would like to second microtype. In fact as far as I know, now a days
it is recommended to load that for almost all documents with significant
text on TeX.SX.
I would also suggest removing inputenc. At the moment, it is loaded
with the AUTO option. AFAIK, this is redundant since most recent
(meaning for quite a few years) TeX engines already use the encoding of
the file if nothing is specified.
The next one would be fontenc, now it is loaded with T1. I'm not sure
if this is needed. Maybe LaTeX experts like Marcin or Fabrice could
comment.
> * Fixltx2e
>
> This packages is depreciated with TL2015 cf. LaTeX News 22. We can use
> \RequirePackage[current]{latexrelease} but there's no point in that....
> AFAIK latexrelease only useful for backwards compatibility.
Didn't know about this. Thank you. I would vote for dropping it.
> * marvosym¹
> * Wasysym²
Agreed. On top of this, wasysym also interferes with integral symbols
from amsmath[1].
We could also take this opportunity to provide users an easy way to
switch between TeX engines. I have been using XeLaTeX with Org and
outside for quite a few years now. Originally what used to be very
hacky, is now simply replacing a couple of packages in the header and
calling xelatex instead of pdflatex. And the list of packages is pretty
much identical for LuaLaTeX. This is what I would use:
\usepackage{fontspec}
\usepackage{microtype}
\usepackage{polyglossia} % instead of babel
% of course this should be something appropriate for the buffer
\setdefaultlanguage[variant=british]{english}
So an option like tex-engine:xelatex or tex-engine:lualatex adds the
above to the default packages and the right binaries. Just an idea.
Cheers,
Footnotes:
[1] At least that's what comments in my setup tell me :-p:
https://github.com/suvayu/.emacs.d/blob/master/org-mode-config.el#L136
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 19:35 ` Suvayu Ali
@ 2015-07-07 20:05 ` Rasmus
2015-07-07 20:52 ` Suvayu Ali
2015-07-08 12:53 ` Rasmus
` (2 subsequent siblings)
3 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-07 20:05 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> I would like to second microtype. In fact as far as I know, now a days
> it is recommended to load that for almost all documents with significant
> text on TeX.SX.
It's easy enough to add and we should keep the default minimal. Though
microtype is certainly a package I would not mind imposing on people.
> I would also suggest removing inputenc. At the moment, it is loaded
> with the AUTO option. AFAIK, this is redundant since most recent
> (meaning for quite a few years) TeX engines already use the encoding of
> the file if nothing is specified.
I think you might be right, but I haven't looked into it.
> The next one would be fontenc, now it is loaded with T1. I'm not sure
> if this is needed. Maybe LaTeX experts like Marcin or Fabrice could
> comment.
I thought it was needed for some symbols, but it seems it might not be.
>> * marvosym¹
>> * Wasysym²
>
> Agreed. On top of this, wasysym also interferes with integral symbols
> from amsmath[1].
No, the manual notes it has comparability with amsmath build it. It
installs them under \varint and friends.
> We could also take this opportunity to provide users an easy way to
> switch between TeX engines.
It's already pretty easy. I bind org-latex-pdf-process to the desired
engine via latexmk in my file. I also wrap fontenc and inputenc in
\ifpdftex\else\fi or whatever. In any case, betterᵀᴹ support for xelatex
would be nice.
> \usepackage{polyglossia} % instead of babel
You can use babel with xelatex.
Rasmus
--
A clever person solves a problem. A wise person avoids it
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 20:05 ` Rasmus
@ 2015-07-07 20:52 ` Suvayu Ali
2015-07-07 21:07 ` Rasmus
0 siblings, 1 reply; 31+ messages in thread
From: Suvayu Ali @ 2015-07-07 20:52 UTC (permalink / raw
To: emacs-orgmode
On Tue, Jul 07, 2015 at 10:05:06PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>
> > \usepackage{polyglossia} % instead of babel
>
> You can use babel with xelatex.
Yes, but polyglossia is recommended. In the interest of minimal work on
the part of Org, this could just be ignored. I don't think we add babel
anyway, or do we?
Cheers,
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 20:52 ` Suvayu Ali
@ 2015-07-07 21:07 ` Rasmus
0 siblings, 0 replies; 31+ messages in thread
From: Rasmus @ 2015-07-07 21:07 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Yes, but polyglossia is recommended. In the interest of minimal work on
> the part of Org, this could just be ignored. I don't think we add babel
> anyway, or do we?
I thought we did, but we don't. Anyway, babel works across different tex
backends which is nice feature. That was the point.
--
Dung makes an excellent fertilizer
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 19:35 ` Suvayu Ali
2015-07-07 20:05 ` Rasmus
@ 2015-07-08 12:53 ` Rasmus
2015-07-08 13:43 ` Suvayu Ali
2015-07-08 15:41 ` Suvayu Ali
2015-07-08 12:54 ` Rasmus
2015-07-14 22:31 ` Marcin Borkowski
3 siblings, 2 replies; 31+ messages in thread
From: Rasmus @ 2015-07-08 12:53 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> We could also take this opportunity to provide users an easy way to
> switch between TeX engines.
These two patches goes some of the way towards what you want.
org-latex-pdf-process would also have to patched as well, though.
Test document:
#+title: test xetex
#+language: en
#+options: tex-variant:xetex
* header
#+BEGIN_SRC emacs-lisp
(add-to-list 'org-latex-packages-alist
'("AUTO, french" "polyglossia" nil (luatex xetex)))
#+END_SRC
Result (node the missing inputenc and fontenc):
\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{french}
\author{Rasmus}
\date{\textit{<2015-07-07 mar>}}
\title{test xetex}
\hypersetup{
pdfauthor={Rasmus},
pdftitle={test xetex},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 25.0.50.1 (Org mode 8.3beta)},
pdflang={English}}
\begin{document}
\maketitle
\tableofcontents
\section{add polyglossia}
\label{sec:orgheadline1}
\begin{verbatim}
(add-to-list 'org-latex-packages-alist
'("AUTO, french" "polyglossia" nil (luatex xetex)))
\end{verbatim}
\end{document}
Rasmus
--
However beautiful the theory, you should occasionally look at the evidence
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0008-ox-latex-Add-polyglossia-support.patch --]
[-- Type: text/x-diff, Size: 3517 bytes --]
From df91d417df3223c0698e56be219f8f1a303ce566 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Wed, 8 Jul 2015 14:12:21 +0200
Subject: [PATCH 8/9] ox-latex: Add polyglossia support
* ox-latex.el (org-latex-guess-polyglossia-language): New function.
(org-latex-template): Apply new function.
---
lisp/ox-latex.el | 61 ++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 51 insertions(+), 10 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ff42843..058d7f8 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1195,6 +1195,45 @@ Return the new header."
", ")
t nil header 1)))))
+(defun org-latex-guess-polyglossia-language (header info)
+ "Set the Polyglossia language according to the LANGUAGE keyword.
+
+HEADER is the LaTeX header string. INFO is the plist used as
+a communication channel.
+
+Insertion of guessed language only happens when the Polyglossia
+package has been explicitly loaded.
+
+The argument to Polyglossia may be \"AUTO\" which is then
+replaced with the language of the document or
+`org-export-default-language'. Note, the language is really set
+using \setdefaultlanguage and not as an option to the package.
+
+Return the new header."
+ (let ((language-code (plist-get info :language)))
+ ;; If no language is set or Polyglossia is not loaded, return
+ ;; HEADER as-is.
+ (if (or (not (stringp language-code))
+ (not (string-match "\\\\usepackage\\[?\\(.*?\\)?\\]?{polyglossia}" header)))
+ header
+ (let* ((language (cdr (assoc language-code
+ org-latex-babel-language-alist)))
+ (options (or (org-string-nw-p (match-string 1 header)) "AUTO"))
+ (languages (save-match-data
+ (org-split-string
+ (replace-regexp-in-string
+ "AUTO" (if (string-match-p language options) "" language)
+ options t)
+ ",[ \t]*")))
+ (main-language-set (string-match-p "\\\\setmainlanguage{.*?}" header)))
+ (replace-match
+ (concat "\\usepackage{polyglossia}\n"
+ (when (and languages (not main-language-set))
+ (format "\\setmainlanguage{%s}" (pop languages)))
+ (when languages
+ (format "\n\\setotherlanguage{%s}\n" (mapconcat 'identity languages ", "))))
+ t t header 0)))))
+
(defun org-latex--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
@@ -1349,16 +1388,18 @@ holding export options."
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
- (org-latex-guess-babel-language
- (org-latex-guess-inputenc
- (org-element-normalize-string
- (org-splice-latex-header
- document-class-string
- org-latex-default-packages-alist
- org-latex-packages-alist nil
- (concat (org-element-normalize-string
- (plist-get info :latex-header))
- (plist-get info :latex-header-extra)))))
+ (org-latex-guess-polyglossia-language
+ (org-latex-guess-babel-language
+ (org-latex-guess-inputenc
+ (org-element-normalize-string
+ (org-splice-latex-header
+ document-class-string
+ org-latex-default-packages-alist
+ org-latex-packages-alist nil
+ (concat (org-element-normalize-string
+ (plist-get info :latex-header))
+ (plist-get info :latex-header-extra)))))
+ info)
info)))
;; Possibly limit depth for headline numbering.
(let ((sec-num (plist-get info :section-numbers)))
--
2.4.5
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0009-ox-latex-Support-TeX-variants.patch --]
[-- Type: text/x-diff, Size: 3356 bytes --]
From 54bcf8f1ae26c91fa856b64071dca65d3f31e1f2 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Wed, 8 Jul 2015 14:44:56 +0200
Subject: [PATCH 9/9] ox-latex: Support TeX variants
* org.el (org-latex-default-packages-alist): Only use inputenc
and fontenc in pdftex.
* ox-latex.el (latex): Add :latex-tex-variant.
(org-latex-tex-variant): New defcustom.
(org-latex--remove-packages): New function.
(org-latex-template): Use new function.
---
lisp/org.el | 4 ++--
lisp/ox-latex.el | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index f10ccf9..3324138 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4069,8 +4069,8 @@ header, or they will be appended."
(default-value var)))
(defcustom org-latex-default-packages-alist
- '(("AUTO" "inputenc" t)
- ("T1" "fontenc" t)
+ '(("AUTO" "inputenc" t pdftex)
+ ("T1" "fontenc" t pdftex)
("" "graphicx" t)
("" "grffile" t)
("" "longtable" nil)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 058d7f8..e7337e1 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -144,6 +144,7 @@
(:latex-text-markup-alist nil nil org-latex-text-markup-alist)
(:latex-title-command nil nil org-latex-title-command)
(:latex-toc-command nil nil org-latex-toc-command)
+ (:latex-tex-variant nil "tex-variant" org-latex-tex-variant)
;; Redefine regular options.
(:date "DATE" nil "\\today" parse)))
@@ -305,6 +306,16 @@ references."
:version "25.1"
:package-version '(Org . "8.3"))
+(defcustom org-latex-tex-variant 'pdftex
+ "Tex variant to use."
+ :group 'org-export-latex
+ :type '(choice
+ (cons :tag "pdfTeX" pdftex)
+ (cons :tag "XeTeX" xetex)
+ (cons :tag "luaTeX" luatex))
+ :version "25.1"
+ :package-version '(Org . "8.3"))
+
;;;; Preamble
(defcustom org-latex-default-class "article"
@@ -1234,6 +1245,24 @@ Return the new header."
(format "\n\\setotherlanguage{%s}\n" (mapconcat 'identity languages ", "))))
t t header 0)))))
+(defun org-latex--remove-packages (pkg-alist info)
+ "Remove packages based on the current TeX variant.
+
+If the fourth argument of an element is set in pkg-alist, and it
+is not a member of the tex variant of the document, the packages
+is removed. See also `org-latex-tex-variant'.
+
+Return modified pkg-alist."
+ (delq nil
+ (mapcar (lambda (pkg)
+ (unless (and (listp pkg)
+ (let ((third (nth 3 pkg)))
+ (and third
+ (not (member (plist-get info :latex-tex-variant)
+ (if (listp third) third (list third)))))))
+ pkg))
+ pkg-alist)))
+
(defun org-latex--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
@@ -1394,8 +1423,9 @@ holding export options."
(org-element-normalize-string
(org-splice-latex-header
document-class-string
- org-latex-default-packages-alist
- org-latex-packages-alist nil
+ (org-latex--remove-packages org-latex-default-packages-alist info)
+ (org-latex--remove-packages org-latex-packages-alist info)
+ nil
(concat (org-element-normalize-string
(plist-get info :latex-header))
(plist-get info :latex-header-extra)))))
--
2.4.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 19:35 ` Suvayu Ali
2015-07-07 20:05 ` Rasmus
2015-07-08 12:53 ` Rasmus
@ 2015-07-08 12:54 ` Rasmus
2015-07-08 13:44 ` Suvayu Ali
2015-07-14 22:31 ` Marcin Borkowski
3 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-08 12:54 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> I would also suggest removing inputenc. At the moment, it is loaded
> with the AUTO option. AFAIK, this is redundant since most recent
> (meaning for quite a few years) TeX engines already use the encoding of
> the file if nothing is specified.
A colleague of mine were missing her umlaut today cause she hadn't loaded
inputenc with utf8. So I guess removing inputenc is premature.
Rasmus
--
. . . The proofs are technical in nature and provides no real understanding
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 12:53 ` Rasmus
@ 2015-07-08 13:43 ` Suvayu Ali
2015-07-08 13:53 ` Rasmus
2015-07-08 15:41 ` Suvayu Ali
1 sibling, 1 reply; 31+ messages in thread
From: Suvayu Ali @ 2015-07-08 13:43 UTC (permalink / raw
To: emacs-orgmode
On Wed, Jul 08, 2015 at 02:53:46PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>
> > We could also take this opportunity to provide users an easy way to
> > switch between TeX engines.
>
> These two patches goes some of the way towards what you want.
> org-latex-pdf-process would also have to patched as well, though.
[...chomp...chomp...chomp...]
> From 54bcf8f1ae26c91fa856b64071dca65d3f31e1f2 Mon Sep 17 00:00:00 2001
> From: Rasmus <rasmus@gmx.us>
> Date: Wed, 8 Jul 2015 14:44:56 +0200
> Subject: [PATCH 9/9] ox-latex: Support TeX variants
This one fails to apply for me. I'm on
c76fef6 org-clock: Add `untilnow' time block
Cheers,
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 12:54 ` Rasmus
@ 2015-07-08 13:44 ` Suvayu Ali
0 siblings, 0 replies; 31+ messages in thread
From: Suvayu Ali @ 2015-07-08 13:44 UTC (permalink / raw
To: emacs-orgmode
On Wed, Jul 08, 2015 at 02:54:41PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>
> > I would also suggest removing inputenc. At the moment, it is loaded
> > with the AUTO option. AFAIK, this is redundant since most recent
> > (meaning for quite a few years) TeX engines already use the encoding of
> > the file if nothing is specified.
>
> A colleague of mine were missing her umlaut today cause she hadn't loaded
> inputenc with utf8. So I guess removing inputenc is premature.
Interesting, I'll keep this in mind.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 13:43 ` Suvayu Ali
@ 2015-07-08 13:53 ` Rasmus
2015-07-08 14:09 ` Suvayu Ali
0 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-08 13:53 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> From 54bcf8f1ae26c91fa856b64071dca65d3f31e1f2 Mon Sep 17 00:00:00 2001
>> From: Rasmus <rasmus@gmx.us>
>> Date: Wed, 8 Jul 2015 14:44:56 +0200
>> Subject: [PATCH 9/9] ox-latex: Support TeX variants
>
> This one fails to apply for me. I'm on
You probably need the other patches posted in OP due to changes in
org-latex-default-packages-alist.
--
Tack, ni svenska vakttorn. Med plutonium tvingar vi dansken på knä!
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 13:53 ` Rasmus
@ 2015-07-08 14:09 ` Suvayu Ali
2015-07-08 14:26 ` Rasmus
0 siblings, 1 reply; 31+ messages in thread
From: Suvayu Ali @ 2015-07-08 14:09 UTC (permalink / raw
To: emacs-orgmode
On Wed, Jul 08, 2015 at 03:53:32PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>
> >> From 54bcf8f1ae26c91fa856b64071dca65d3f31e1f2 Mon Sep 17 00:00:00 2001
> >> From: Rasmus <rasmus@gmx.us>
> >> Date: Wed, 8 Jul 2015 14:44:56 +0200
> >> Subject: [PATCH 9/9] ox-latex: Support TeX variants
> >
> > This one fails to apply for me. I'm on
>
> You probably need the other patches posted in OP due to changes in
> org-latex-default-packages-alist.
Indeed, and it works very nicely!
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 14:09 ` Suvayu Ali
@ 2015-07-08 14:26 ` Rasmus
2015-07-08 14:55 ` Suvayu Ali
0 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-08 14:26 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Indeed, and it works very nicely!
Let me know when you find bugs.
I'm trying to think of an elegant way to map from a tex-variant to a
command. Perhaps change the variant names to the latex variants and input
that. E.g. if using plain commands, "pdflatex" is changed to replaced
with "xelatex". texi2dvi uses "LATEX=xelatex texi2dvi". With latexmk you
can use -pdflatex=xelatex. Rubber: no clue and it's not part of TL...
Rasmus
--
And when I’m finished thinking, I have to die a lot
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 14:26 ` Rasmus
@ 2015-07-08 14:55 ` Suvayu Ali
0 siblings, 0 replies; 31+ messages in thread
From: Suvayu Ali @ 2015-07-08 14:55 UTC (permalink / raw
To: emacs-orgmode
On Wed, Jul 08, 2015 at 04:26:56PM +0200, Rasmus wrote:
>
> I'm trying to think of an elegant way to map from a tex-variant to a
> command. Perhaps change the variant names to the latex variants and input
> that.
I think that would be a good way to go.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 12:53 ` Rasmus
2015-07-08 13:43 ` Suvayu Ali
@ 2015-07-08 15:41 ` Suvayu Ali
2015-07-08 16:06 ` Rasmus
2015-07-08 18:35 ` Rasmus
1 sibling, 2 replies; 31+ messages in thread
From: Suvayu Ali @ 2015-07-08 15:41 UTC (permalink / raw
To: emacs-orgmode
Hi Rasmus,
On Wed, Jul 08, 2015 at 02:53:46PM +0200, Rasmus wrote:
>
> +(defun org-latex-guess-polyglossia-language (header info)
> + "Set the Polyglossia language according to the LANGUAGE keyword.
I'm in two-minds about this. On the one had it is a nice thing, but on
the other hand, it prevents the more fine grained control offered by
polyglossia. For example, I used this in my setup before:
\setdefaultlanguage[variant=british]{english}
I don't see an easy way of passing the optional argument. But on the
other hand
\setmainlanguage{english}
is plain, simple, and works in most (almost all) cases. I'm thinking
whether to leave the babel/polyglossia features entirely up to the user.
That said, I like the feature very much. For people who write in
multiple languages, if they load polyglossia, it should "just work" for
all their documents. Which is great!
WDYT? What do others think?
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 15:41 ` Suvayu Ali
@ 2015-07-08 16:06 ` Rasmus
2015-07-08 18:35 ` Rasmus
1 sibling, 0 replies; 31+ messages in thread
From: Rasmus @ 2015-07-08 16:06 UTC (permalink / raw
To: emacs-orgmode
Hi,
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> +(defun org-latex-guess-polyglossia-language (header info)
>> + "Set the Polyglossia language according to the LANGUAGE keyword.
>
> I'm in two-minds about this. On the one had it is a nice thing, but on
> the other hand, it prevents the more fine grained control offered by
> polyglossia. For example, I used this in my setup before:
>
> \setdefaultlanguage[variant=british]{english}
It's a shame that Polyglossia is so much different from babel.... For
babel we translate en-gb to "british" which is a valid babel language.
But your example shows that org-latex-babel-language-alist does not work
for polyglossia. Which means that somebody has to come up with a mapping
from language codes (en-gb) to (language . variant) pairs (your example).
Also, some mechanism needs to be in place to convey random options like
spelling={new, old} for German... Unless polyglossia options can be set
afterwards via latex_headers.
> I don't see an easy way of passing the optional argument. But on the
> other hand
>
> \setmainlanguage{english}
>
> is plain, simple, and works in most (almost all) cases.
The only limitation here is whether somebody wants to contribute
org-latex-polyglossia-language-alist (≡ go through the manual and map all
pairs). Conveying language-specific options in Org is what I worry about.
Rasmus
--
ツ
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 15:41 ` Suvayu Ali
2015-07-08 16:06 ` Rasmus
@ 2015-07-08 18:35 ` Rasmus
2015-07-16 8:29 ` Suvayu Ali
1 sibling, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-08 18:35 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2025 bytes --]
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> +(defun org-latex-guess-polyglossia-language (header info)
>> + "Set the Polyglossia language according to the LANGUAGE keyword.
>
> I'm in two-minds about this. On the one had it is a nice thing, but on
> the other hand, it prevents the more fine grained control offered by
> polyglossia. For example, I used this in my setup before:
>
> \setdefaultlanguage[variant=british]{english}
The attached supports Polyglossia better. Note, the last loaded language
is the main one (as babel). Perhaps org-latex-variant-file-string should
be less annoying (not a file-variable).
Test file:
#+title: test xetex
#+language: en-gb
#+latex_variant: xelatex
* header
add polyglossia
#+BEGIN_SRC emacs-lisp
(add-to-list 'org-latex-packages-alist
'("AUTO, french" "polyglossia" nil ("lualatex" "xelatex")))
#+END_SRC
Output:
% -*- LaTeX-command: xelatex -*-
% Created 2015-07-08 mié 20:32
\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{polyglossia}
\setmainlanguage{french}
\setotherlanguage[variant=uk]{english}
\author{Rasmus}
\date{\today}
\title{test xetex}
\hypersetup{
pdfauthor={Rasmus},
pdftitle={test xetex},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 25.0.50.1 (Org mode 8.3beta)},
pdflang={British}}
\begin{document}
\maketitle
\tableofcontents
\section{add polyglossia}
\label{sec:orgheadline1}
\begin{verbatim}
(add-to-list 'org-latex-packages-alist
'("AUTO, french" "polyglossia" nil ("lualatex" "xelatex")))
\end{verbatim}
\end{document}
--
Dung makes an excellent fertilizer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0009-ox-latex-Support-TeX-variants.patch --]
[-- Type: text/x-diff, Size: 10531 bytes --]
From 96dcb2ab15ddfce1f95560f49076187508b2ef43 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Wed, 8 Jul 2015 14:44:56 +0200
Subject: [PATCH 09/10] ox-latex: Support TeX variants
* org.el (org-latex-default-packages-alist): Only use inputenc
and fontenc in pdftex.
* ox-latex.el (latex): Add :latex-tex-variant.
(org-latex-variant): New defcustom.
(org-latex-variants): New defconst.
(org-latex--remove-packages): New function.
(org-latex-template): Use new function.
(org-latex-pdf-process): Update to use %latex shorthand.
(org-latex-compile): Check and use intended compiler.
Suggested-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98921>
---
lisp/org.el | 4 +-
lisp/ox-latex.el | 133 ++++++++++++++++++++++++++++++++++++-------------------
2 files changed, 89 insertions(+), 48 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index f10ccf9..2721646 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4069,8 +4069,8 @@ header, or they will be appended."
(default-value var)))
(defcustom org-latex-default-packages-alist
- '(("AUTO" "inputenc" t)
- ("T1" "fontenc" t)
+ '(("AUTO" "inputenc" t ("pdflatex"))
+ ("T1" "fontenc" t ("pdflatex"))
("" "graphicx" t)
("" "grffile" t)
("" "longtable" nil)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 0851066..8c1cd9f 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -144,6 +144,7 @@
(:latex-text-markup-alist nil nil org-latex-text-markup-alist)
(:latex-title-command nil nil org-latex-title-command)
(:latex-toc-command nil nil org-latex-toc-command)
+ (:latex-variant "LATEX_VARIANT" nil org-latex-variant)
;; Redefine regular options.
(:date "DATE" nil "\\today" parse)))
@@ -395,6 +396,28 @@ references."
:version "25.1"
:package-version '(Org . "8.3"))
+(defcustom org-latex-variant "pdflatex"
+ "Tex variant to use."
+ :group 'org-export-latex
+ :type '(choice
+ (cons :tag "pdfLaTeX" "pdflatex")
+ (cons :tag "XeLaTeX" "xelatex")
+ (cons :tag "luaLaTeX" "lualatex"))
+ :version "25.1"
+ :package-version '(Org . "8.3"))
+
+(defcustom org-latex-variant-file-string "%% -*- LaTeX-command: %s -*-\n"
+ "Variant format-string written to file.
+Default value is a local variable for AUCTeX."
+ :group 'org-export-latex
+ :type 'string
+ :version "25.1"
+ :package-version '(Org . "8.3")
+ )
+
+(defconst org-latex-variants '("pdflatex" "xelatex" "lualatex")
+ "Known LaTeX variants.")
+
;;;; Preamble
(defcustom org-latex-default-class "article"
@@ -1032,14 +1055,15 @@ during latex export it will output
;;;; Compilation
(defcustom org-latex-pdf-process
- '("pdflatex -interaction nonstopmode -output-directory %o %f"
- "pdflatex -interaction nonstopmode -output-directory %o %f"
- "pdflatex -interaction nonstopmode -output-directory %o %f")
+ '("%latex -interaction nonstopmode -output-directory %o %f"
+ "%latex -interaction nonstopmode -output-directory %o %f"
+ "%latex -interaction nonstopmode -output-directory %o %f")
"Commands to process a LaTeX file to a PDF file.
This is a list of strings, each of them will be given to the
shell as a command. %f in the command will be replaced by the
full file name, %b by the file base name (i.e. without directory
-and extension parts) and %o by the base directory of the file.
+and extension parts), %o by the base directory of the file,
+and %latex is the latex variant (see `org-latex-variant').
The reason why this is a list is that it usually takes several
runs of `pdflatex', maybe mixed with a call to `bibtex'. Org
@@ -1047,18 +1071,8 @@ does not have a clever mechanism to detect which of these
commands have to be run to get to a stable result, and it also
does not do any error checking.
-By default, Org uses 3 runs of `pdflatex' to do the processing.
-If you have texi2dvi on your system and if that does not cause
-the infamous egrep/locale bug:
-
- http://lists.gnu.org/archive/html/bug-texinfo/2010-03/msg00031.html
-
-then `texi2dvi' is the superior choice as it automates the LaTeX
-build process by calling the \"correct\" combinations of
-auxiliary programs. Org does offer `texi2dvi' as one of the
-customize options. Alternatively, `rubber' and `latexmk' also
-provide similar functionality. The latter supports `biber' out
-of the box.
+Consider a smart LaTeX compiler such as `texi2dvi' or `latexmk',
+which calls the \"correct\" combinations of auxiliary programs.
Alternatively, this may be a Lisp function that does the
processing, so you could use this to apply the machinery of
@@ -1068,36 +1082,24 @@ file name as its single argument."
:type '(choice
(repeat :tag "Shell command sequence"
(string :tag "Shell command"))
- (const :tag "2 runs of pdflatex"
- ("pdflatex -interaction nonstopmode -output-directory %o %f"
- "pdflatex -interaction nonstopmode -output-directory %o %f"))
- (const :tag "3 runs of pdflatex"
- ("pdflatex -interaction nonstopmode -output-directory %o %f"
- "pdflatex -interaction nonstopmode -output-directory %o %f"
- "pdflatex -interaction nonstopmode -output-directory %o %f"))
- (const :tag "pdflatex,bibtex,pdflatex,pdflatex"
- ("pdflatex -interaction nonstopmode -output-directory %o %f"
- "bibtex %b"
- "pdflatex -interaction nonstopmode -output-directory %o %f"
- "pdflatex -interaction nonstopmode -output-directory %o %f"))
- (const :tag "2 runs of xelatex"
- ("xelatex -interaction nonstopmode -output-directory %o %f"
- "xelatex -interaction nonstopmode -output-directory %o %f"))
- (const :tag "3 runs of xelatex"
- ("xelatex -interaction nonstopmode -output-directory %o %f"
- "xelatex -interaction nonstopmode -output-directory %o %f"
- "xelatex -interaction nonstopmode -output-directory %o %f"))
- (const :tag "xelatex,bibtex,xelatex,xelatex"
- ("xelatex -interaction nonstopmode -output-directory %o %f"
+ (const :tag "2 runs of latex"
+ ("%latex -interaction nonstopmode -output-directory %o %f"
+ "%latex -interaction nonstopmode -output-directory %o %f"))
+ (const :tag "3 runs of latex"
+ ("%latex -interaction nonstopmode -output-directory %o %f"
+ "%latex -interaction nonstopmode -output-directory %o %f"
+ "%latex -interaction nonstopmode -output-directory %o %f"))
+ (const :tag "latex,bibtex,latex,latex"
+ ("%latex -interaction nonstopmode -output-directory %o %f"
"bibtex %b"
- "xelatex -interaction nonstopmode -output-directory %o %f"
- "xelatex -interaction nonstopmode -output-directory %o %f"))
+ "%latex -interaction nonstopmode -output-directory %o %f"
+ "%latex -interaction nonstopmode -output-directory %o %f"))
(const :tag "texi2dvi"
- ("texi2dvi -p -b -V %f"))
+ ("LATEX=%latex texi2dvi -p -b -V %f"))
(const :tag "rubber"
("rubber -d --into %o %f"))
(const :tag "latexmk"
- ("latexmk -g -pdf %f"))
+ ("latexmk -g -pdflatex=%latex %f"))
(function)))
(defcustom org-latex-logfiles-extensions
@@ -1337,6 +1339,29 @@ Return the new header."
(if (listp lang) (nth 1 lang) lang))))))))
t t header 0)))))
+(defun org-latex--remove-packages (pkg-alist info)
+ "Remove packages based on the current TeX variant.
+
+If the fourth argument of an element is set in pkg-alist, and it
+is not a member of the tex variant of the document, the packages
+is removed. See also `org-latex-variant'.
+
+Return modified pkg-alist."
+ (let ((variant (org-trim (or (plist-get info :latex-variant) ""))))
+ (if (member-ignore-case variant org-latex-variants)
+ (delq nil
+ (mapcar (lambda (pkg)
+ (unless
+ (and (listp pkg)
+ (let ((third (nth 3 pkg)))
+ (and third
+ (not (member-ignore-case
+ variant
+ (if (listp third) third (list third)))))))
+ pkg))
+ pkg-alist))
+ pkg-alist)))
+
(defun org-latex--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
@@ -1476,6 +1501,13 @@ holding export options."
(let ((title (org-export-data (plist-get info :title) info))
(spec (org-latex--format-spec info)))
(concat
+ ;; LaTeX variant
+ (let ((variant
+ (car (member-ignore-case
+ (org-trim (or (plist-get info :latex-variant) ""))
+ org-latex-variants))))
+ (when variant
+ (format org-latex-variant-file-string variant)))
;; Time-stamp.
(and (plist-get info :time-stamp-file)
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
@@ -1497,8 +1529,9 @@ holding export options."
(org-element-normalize-string
(org-splice-latex-header
document-class-string
- org-latex-default-packages-alist
- org-latex-packages-alist nil
+ (org-latex--remove-packages org-latex-default-packages-alist info)
+ (org-latex--remove-packages org-latex-packages-alist info)
+ nil
(concat (org-element-normalize-string
(plist-get info :latex-header))
(plist-get info :latex-header-extra)))))
@@ -3418,6 +3451,12 @@ create a log buffer and do not bother removing log files.
Return PDF file name or an error if it couldn't be produced."
(let* ((base-name (file-name-sans-extension (file-name-nondirectory texfile)))
(full-name (file-truename texfile))
+ (compiler (or (with-temp-buffer
+ (save-excursion (insert-file-contents full-name))
+ (when (search-forward-regexp
+ (regexp-opt org-latex-variants) (line-end-position) t)
+ (match-string 0)))
+ "pdflatex"))
(out-dir (file-name-directory texfile))
;; Properly set working directory for compilation.
(default-directory (if (file-name-absolute-p texfile)
@@ -3440,11 +3479,13 @@ Return PDF file name or an error if it couldn't be produced."
(dolist (command org-latex-pdf-process)
(shell-command
(replace-regexp-in-string
- "%b" (shell-quote-argument base-name)
+ "%latex" (shell-quote-argument compiler)
(replace-regexp-in-string
- "%f" (shell-quote-argument full-name)
+ "%b" (shell-quote-argument base-name)
(replace-regexp-in-string
- "%o" (shell-quote-argument out-dir) command t t) t t) t t)
+ "%f" (shell-quote-argument full-name)
+ (replace-regexp-in-string
+ "%o" (shell-quote-argument out-dir) command t t) t t) t t) t)
outbuf))
;; Collect standard errors from output buffer.
(setq warnings (and (not snippet)
--
2.4.5
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0008-ox-latex-Add-polyglossia-support.patch --]
[-- Type: text/x-diff, Size: 6808 bytes --]
From 9a91650b444a737b1f627e40761b63dc6552e6f0 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Wed, 8 Jul 2015 14:12:21 +0200
Subject: [PATCH 08/10] ox-latex: Add polyglossia support
* ox-latex.el (org-latex-guess-polyglossia-language): New function.
(org-latex-polyglossia-language-alist): New defconst.
(org-latex-template): Apply new function.
Suggested-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98921>
---
lisp/ox-latex.el | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 154 insertions(+), 10 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ff42843..0851066 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -204,6 +204,96 @@
("uk" . "ukrainian"))
"Alist between language code and corresponding Babel option.")
+(defconst org-latex-polyglossia-language-alist
+ '(("am" . "amharic")
+ ("as" . "asturian") ;; questionable abbreviation
+ ("ar" . "arabic")
+ ("bo" . "tibetan")
+ ("bn" . "bengali")
+ ("bg" . "bulgarian")
+ ("br" . "breton")
+ ("bt-br" . "brazilian")
+ ("ca" . "catalan")
+ ("co" . "coptic") ;; questionable abbreviation
+ ("cs" . "czech")
+ ("cy" . "welsh")
+ ("da" . "danish")
+ ("de" . ("german" "german"))
+ ("de-at" . ("german" "austrian"))
+ ("de-de" . ("german" "german"))
+ ("dv" . "divehi")
+ ("el" . "greek")
+ ("en" . ("english" "usmax"))
+ ("en-au" . ("english" "australian"))
+ ("en-gb" . ("english" "uk"))
+ ("en-nz" . ("english" "newzealand"))
+ ("en-us" . ("english" "usmax"))
+ ("eo" . "esperanto")
+ ("es" . "spanish")
+ ("et" . "estonian")
+ ("eu" . "basque")
+ ("fa" . "farsi")
+ ("fi" . "finnish")
+ ("fr" . "french")
+ ("fu" . "friulan")
+ ("ga" . "irish")
+ ("gd" . "scottish")
+ ("gl" . "galician")
+ ("he" . "hebrew")
+ ("hi" . "hindi")
+ ("hr" . "croatian")
+ ("hu" . "magyar")
+ ("hy" . "armenian")
+ ("id" . "bahasai")
+ ("ia" . "interlingua")
+ ("is" . "icelandic")
+ ("it" . "italian")
+ ("kn" . "kannada")
+ ("la" . ("latin" "modern"))
+ ("la-modern" . ("latin" "modern"))
+ ("la-classic" . ("latin" "classic"))
+ ("la-medieval" . ("latin" "medieval"))
+ ("lo" . "lao")
+ ("lt" . "lithuanian")
+ ("lv" . "latvian")
+ ("mr" . "maranthi")
+ ("ml" . "malayalam")
+ ("nl" . "dutch")
+ ("nb" . "norsk")
+ ("nn" . "nynorsk")
+ ("nk" . "nko") ;; questionable abbreviation
+ ("no" . "norsk")
+ ("oc" . "occitan")
+ ("pl" . "polish")
+ ("pm" . "piedmontese") ;; questionable abbreviation
+ ("pt" . "portuges")
+ ("rm" . "romansh")
+ ("ro" . "romanian")
+ ("ru" . "russian")
+ ("sa" . "sanskrit")
+ ("sb" . "usorbian") ;; questionable abbreviation
+ ("sb-upper" . "usorbian") ;; questionable abbreviation
+ ("sb-lower" . "lsorbian") ;; questionable abbreviation
+ ("sk" . "slovak")
+ ("sl" . "slovenian")
+ ("sm" . "samin") ;; questionable abbreviation
+ ("sq" . "albanian")
+ ("sr" . "serbian")
+ ("sv" . "swedish")
+ ("sy" . "syriac") ;; questionable abbreviation
+ ("ta" . "tamil")
+ ("te" . "telugu")
+ ("th" . "thai")
+ ("tk" . "turkmen")
+ ("tr" . "turkish")
+ ("uk" . "ukrainian")
+ ("ur" . "urdu")
+ ("vi" . "vietnamese")
+ )
+ "Alist between language code and corresponding Polyglossia option.")
+
+
+
(defconst org-latex-table-matrix-macros '(("bordermatrix" . "\\cr")
("qbordermatrix" . "\\cr")
("kbordermatrix" . "\\\\"))
@@ -1195,6 +1285,58 @@ Return the new header."
", ")
t nil header 1)))))
+(defun org-latex-guess-polyglossia-language (header info)
+ "Set the Polyglossia language according to the LANGUAGE keyword.
+
+HEADER is the LaTeX header string. INFO is the plist used as
+a communication channel.
+
+Insertion of guessed language only happens when the Polyglossia
+package has been explicitly loaded.
+
+The argument to Polyglossia may be \"AUTO\" which is then
+replaced with the language of the document or
+`org-export-default-language'. Note, the language is really set
+using \setdefaultlanguage and not as an option to the package.
+
+Return the new header."
+ (let ((language (plist-get info :language))
+ result)
+ ;; If no language is set or Polyglossia is not loaded, return
+ ;; HEADER as-is.
+ (if (or (not (stringp language))
+ (not (string-match
+ "\\\\usepackage\\[?\\(.*?\\)?\\]?{polyglossia}\n" header)))
+ header
+ (let* ((options (or (org-string-nw-p (match-string 1 header)) "AUTO"))
+ (languages (save-match-data
+ ;; Reverse as the last loaded language is
+ ;; the main language.
+ (reverse
+ (org-split-string
+ (replace-regexp-in-string
+ "AUTO" language options t)
+ ",[ \t]*"))))
+ (main-language-set (string-match-p "\\\\setmainlanguage{.*?}" header)))
+ (replace-match
+ (concat "\\usepackage{polyglossia}\n"
+ (when languages
+ (dolist (langu languages result)
+ (let ((lang (or (assoc langu org-latex-polyglossia-language-alist)
+ langu)))
+ (setq result
+ (concat
+ result
+ (format (if main-language-set
+ "\\setotherlanguage%s{%s}\n"
+ (prog1 "\\setmainlanguage%s{%s}\n"
+ (setq main-language-set t)))
+ (if (listp lang)
+ (format "[variant=%s]" (nth 2 lang))
+ "")
+ (if (listp lang) (nth 1 lang) lang))))))))
+ t t header 0)))))
+
(defun org-latex--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
@@ -1349,16 +1491,18 @@ holding export options."
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
- (org-latex-guess-babel-language
- (org-latex-guess-inputenc
- (org-element-normalize-string
- (org-splice-latex-header
- document-class-string
- org-latex-default-packages-alist
- org-latex-packages-alist nil
- (concat (org-element-normalize-string
- (plist-get info :latex-header))
- (plist-get info :latex-header-extra)))))
+ (org-latex-guess-polyglossia-language
+ (org-latex-guess-babel-language
+ (org-latex-guess-inputenc
+ (org-element-normalize-string
+ (org-splice-latex-header
+ document-class-string
+ org-latex-default-packages-alist
+ org-latex-packages-alist nil
+ (concat (org-element-normalize-string
+ (plist-get info :latex-header))
+ (plist-get info :latex-header-extra)))))
+ info)
info)))
;; Possibly limit depth for headline numbering.
(let ((sec-num (plist-get info :section-numbers)))
--
2.4.5
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 14:53 ox-latex: default packages cleaning Rasmus
2015-07-07 15:48 ` Eric S Fraga
2015-07-07 19:35 ` Suvayu Ali
@ 2015-07-10 11:25 ` Robert Klein
2015-07-11 10:48 ` Rasmus
2015-07-13 10:08 ` Rasmus
2015-07-14 22:16 ` Marcin Borkowski
4 siblings, 1 reply; 31+ messages in thread
From: Robert Klein @ 2015-07-10 11:25 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
Hello
> * Fixltx2e
>
> This packages is depreciated with TL2015 cf. LaTeX News 22. We can
> use \RequirePackage[current]{latexrelease} but there's no point in
> that.... AFAIK latexrelease only useful for backwards compatibility.
Leaving this out probably doesn't break texing with older
texlive versions.
Please try to keep export compatible to older versions. I have a
couple of computers where I can use new versions of org-mode (and an
appropriate version of emacs), where it is not feasible to install a
newer version of texlive.
Best regards
Robert
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-10 11:25 ` Robert Klein
@ 2015-07-11 10:48 ` Rasmus
2015-07-11 18:53 ` Robert Klein
0 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-11 10:48 UTC (permalink / raw
To: emacs-orgmode
Hi Robert,
Robert Klein <roklein@roklein.de> writes:
>> * Fixltx2e
>>
>> This packages is depreciated with TL2015 cf. LaTeX News 22. We can
>> use \RequirePackage[current]{latexrelease} but there's no point in
>> that.... AFAIK latexrelease only useful for backwards compatibility.
>
> Leaving this out probably doesn't break texing with older
> texlive versions.
>
> Please try to keep export compatible to older versions. I have a
> couple of computers where I can use new versions of org-mode (and an
> appropriate version of emacs), where it is not feasible to install a
> newer version of texlive.
The target of Org 8.3 is 24.3. I don't know if there's a policy wrt
targeting older versions of auxiliary software.
In the case of fixltx2 it's reasonable to only remove it from the default
packages after the release of Org 8.3. Extrapolating, users of org-stable
will only see that change 1-2 years from now.
Rasmus
--
History is what should never happen again
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-11 10:48 ` Rasmus
@ 2015-07-11 18:53 ` Robert Klein
0 siblings, 0 replies; 31+ messages in thread
From: Robert Klein @ 2015-07-11 18:53 UTC (permalink / raw
To: emacs-orgmode
Hi Rasmus,
On Sat, 11 Jul 2015 12:48:06 +0200
Rasmus <rasmus@gmx.us> wrote:
> Hi Robert,
>
> Robert Klein <roklein@roklein.de> writes:
>
> >> * Fixltx2e
> >>
> >> This packages is depreciated with TL2015 cf. LaTeX News 22. We can
> >> use \RequirePackage[current]{latexrelease} but there's no point in
> >> that.... AFAIK latexrelease only useful for backwards
> >> compatibility.
> >
> > Leaving this out probably doesn't break texing with older
> > texlive versions.
> >
> > Please try to keep export compatible to older versions. I have a
> > couple of computers where I can use new versions of org-mode (and an
> > appropriate version of emacs), where it is not feasible to install a
> > newer version of texlive.
>
> The target of Org 8.3 is 24.3. I don't know if there's a policy wrt
> targeting older versions of auxiliary software.
>
> In the case of fixltx2 it's reasonable to only remove it from the
> default packages after the release of Org 8.3. Extrapolating, users
> of org-stable will only see that change 1-2 years from now.
Forget what I said. You are right.
LaTeX will also work without fixltx2e and org latex export probably
doesn't need it anyway.
Sorry about that.
Best regards
Robert
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 14:53 ox-latex: default packages cleaning Rasmus
` (2 preceding siblings ...)
2015-07-10 11:25 ` Robert Klein
@ 2015-07-13 10:08 ` Rasmus
2015-07-14 22:16 ` Marcin Borkowski
4 siblings, 0 replies; 31+ messages in thread
From: Rasmus @ 2015-07-13 10:08 UTC (permalink / raw
To: emacs-orgmode
Hi,
Rasmus <rasmus@gmx.us> writes:
> * tolerance
> * marvosym¹
> * Wasysym²
Pushed.
> * Fixltx2e
Will push after 8.3 is released.
Rasmus
--
Dobbelt-A
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 14:53 ox-latex: default packages cleaning Rasmus
` (3 preceding siblings ...)
2015-07-13 10:08 ` Rasmus
@ 2015-07-14 22:16 ` Marcin Borkowski
4 siblings, 0 replies; 31+ messages in thread
From: Marcin Borkowski @ 2015-07-14 22:16 UTC (permalink / raw
To: emacs-orgmode
On 2015-07-07, at 16:53, Rasmus <rasmus@gmx.us> wrote:
> Hi,
Hi,
and sorry for my delay – I have a huge email backlog...
> We could do some cleaning of org-default-package-alist before Org 8.3.
Yes, yes, yes!
> * tolerance
>
> Why is "\\tolerance=1000" part of org-default-package-alist? Is this
> value good for all languages? If we keep it, it should be configurable.
> But people who explicitly wants this behavior can probably add it
> themselves.
>
> If it's a means to archive "high-quality" paragraphs, maybe microtype is
> probably the 'proper' fix...
My suggestion: forget about \tolerance. It’s low-level TeX stuff,
hardly anybody knows what it does, really (it is one of the dozen or two
parameters governing the line-breaking algorithm), and most people would
not see any difference anyway. I wouldn’t add microtype, OTOH. One
reason: it issues a lot of warnings when you use a font it does not
know. It doesn’t hurt, but some people don’t like warnings. Also, some
people might not really /want/ microtype – it messes around with font
widths, and even with the default settings (which are rather
conservative), it can look a bit strange.
> * Fixltx2e
>
> This packages is depreciated with TL2015 cf. LaTeX News 22. We can use
> \RequirePackage[current]{latexrelease} but there's no point in that....
> AFAIK latexrelease only useful for backwards compatibility.
Didn’t even know that.
> * marvosym¹
> * Wasysym²
My opinion: remove both.
> Rasmus
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-07 19:35 ` Suvayu Ali
` (2 preceding siblings ...)
2015-07-08 12:54 ` Rasmus
@ 2015-07-14 22:31 ` Marcin Borkowski
2015-07-15 8:33 ` Rasmus
3 siblings, 1 reply; 31+ messages in thread
From: Marcin Borkowski @ 2015-07-14 22:31 UTC (permalink / raw
To: emacs-orgmode
On 2015-07-07, at 21:35, Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
> I would like to second microtype. In fact as far as I know, now a days
> it is recommended to load that for almost all documents with significant
> text on TeX.SX.
As I wrote a minute ago, I would rather not add microtype, though it's
a minor thing, really.
> I would also suggest removing inputenc. At the moment, it is loaded
> with the AUTO option. AFAIK, this is redundant since most recent
> (meaning for quite a few years) TeX engines already use the encoding of
> the file if nothing is specified.
Can you elaborate on that? AFAIK, XeTeX and LuaTeX use UTF-8 by
default, but pdfetex (which is the default LaTeX engine) does not. And
quite a lot of people ose pdfetex (me included;-)). I haven't heard
about any heuristic determination of encoding by TeX (and I hope nothing
like that happens, since it could be disastrous).
> The next one would be fontenc, now it is loaded with T1. I'm not sure
> if this is needed. Maybe LaTeX experts like Marcin or Fabrice could
> comment.
Thanks for calling me an expert, though I'm not one regarding fonts and
their encodings;-).
With fontenc, the thing is tricky. I do not know much about other
languages, but you actually can't use LaTeX to typeset texts in Polish
without changing the default LaTeX's font encoding (which is OT1, and it
doesn't support some Polish letters). (Usually, I do not use fontenc
for that, since there is a specialized package for Polish typesetting.)
I guess that removing fontenc for non-English texts might lead to
erroneous results – at least in case of presence of certain Polish words
(e.g., some names in bibliographies). I guess we don’t want that.
OTOH, one thing we /might/ want to add is \usepackage{lmodern}. The
Latin Modern family of fonts is a drop-in replacement for the default
Computer Modern, but with all sorts of accented characters. Using this
font family has the advantage that accented characters are not build
from letters and accents, but are single glyphs in the font. AFAIR,
this makes words containing accented letters hyphenatable. Not a huge
gain, but sometimes may be important (especially in some languages, and
with narrow columns).
> We could also take this opportunity to provide users an easy way to
> switch between TeX engines.
I second that!
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-14 22:31 ` Marcin Borkowski
@ 2015-07-15 8:33 ` Rasmus
0 siblings, 0 replies; 31+ messages in thread
From: Rasmus @ 2015-07-15 8:33 UTC (permalink / raw
To: emacs-orgmode
Marcin Borkowski <mbork@mbork.pl> writes:
>> I would also suggest removing inputenc. At the moment, it is loaded
>> with the AUTO option. AFAIK, this is redundant since most recent
>> (meaning for quite a few years) TeX engines already use the encoding of
>> the file if nothing is specified.
>
> Can you elaborate on that? AFAIK, XeTeX and LuaTeX use UTF-8 by
> default, but pdfetex (which is the default LaTeX engine) does not. And
> quite a lot of people ose pdfetex (me included;-)). I haven't heard
> about any heuristic determination of encoding by TeX (and I hope nothing
> like that happens, since it could be disastrous).
At least on Windows/Miktex this isn't working. And while I don't like
miktex enough people do.
>> The next one would be fontenc, now it is loaded with T1. I'm not sure
>> if this is needed. Maybe LaTeX experts like Marcin or Fabrice could
>> comment.
>
> Thanks for calling me an expert, though I'm not one regarding fonts and
> their encodings;-).
>
> With fontenc, the thing is tricky. I do not know much about other
> languages, but you actually can't use LaTeX to typeset texts in Polish
> without changing the default LaTeX's font encoding (which is OT1, and it
> doesn't support some Polish letters). (Usually, I do not use fontenc
> for that, since there is a specialized package for Polish typesetting.)
>
> I guess that removing fontenc for non-English texts might lead to
> erroneous results – at least in case of presence of certain Polish words
> (e.g., some names in bibliographies). I guess we don’t want that.
>
> OTOH, one thing we /might/ want to add is \usepackage{lmodern}. The
> Latin Modern family of fonts is a drop-in replacement for the default
> Computer Modern, but with all sorts of accented characters. Using this
> font family has the advantage that accented characters are not build
> from letters and accents, but are single glyphs in the font. AFAIR,
> this makes words containing accented letters hyphenatable. Not a huge
> gain, but sometimes may be important (especially in some languages, and
> with narrow columns).
If people have the need for additional fonts they can add it. In a patch
further down the thread I add support to set backends for packages (so
fontenc is only loaded if using pdflatex).
If you'd replaced lmodern with libertine I would have been more inclined
to agree (though it might not have as wide support as LM). BTW: I guess
any of the GUST fonts would have pretty great glyph support.
An easy mechanism for changing font package is nice. E.g. I use libertine
by default, but in some cases I'd might want to use another package in
which case I'd want to have libertine replaced.
>> We could also take this opportunity to provide users an easy way to
>> switch between TeX engines.
>
> I second that!
Feel free to test the patch in another post. If's difficult because: (i)
we want to be able to change engines with some liberty, but not to much
(e.g. you can run xelatex but you can't run myrandomscript.sh); (ii) the
info plist is not available at compile time so we have to write the info
to file, in the patch I use the AUCTeX latex-command var; (iii) it would
be nice to support flags (-shell-escape), but see (i).
Rasmus
--
I hear there's rumors on the, uh, Internets. . .
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-08 18:35 ` Rasmus
@ 2015-07-16 8:29 ` Suvayu Ali
2015-07-16 8:49 ` Rasmus
2015-07-29 16:21 ` Rasmus
0 siblings, 2 replies; 31+ messages in thread
From: Suvayu Ali @ 2015-07-16 8:29 UTC (permalink / raw
To: emacs-orgmode
On Wed, Jul 08, 2015 at 08:35:28PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>
> >> +(defun org-latex-guess-polyglossia-language (header info)
> >> + "Set the Polyglossia language according to the LANGUAGE keyword.
> >
> > I'm in two-minds about this. On the one had it is a nice thing, but on
> > the other hand, it prevents the more fine grained control offered by
> > polyglossia. For example, I used this in my setup before:
> >
> > \setdefaultlanguage[variant=british]{english}
>
> The attached supports Polyglossia better. Note, the last loaded language
> is the main one (as babel). Perhaps org-latex-variant-file-string should
> be less annoying (not a file-variable).
The polyglossia bits work well. The file local variable prompt for
every export is quite annoying though. Same goes for the exported file,
opening it brings up the same prompt again. I guess it is a one time
thing to mark that variable as safe, then it should be good.
I have a few other questions:
- how does one change the variant when doing a subtree export? By
setting EXPORT_LATEX_VARIANT?
- Is it possible to set a default variant?
- How does one insert a line in the package list which is not
usepackage. I guess the normal case is still valid:
"\\somedirective", but inserting a similar variant specific directive
isn't possible.
I'm starting to wonder, all these complications, is it really worth it?
What do you think?
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-16 8:29 ` Suvayu Ali
@ 2015-07-16 8:49 ` Rasmus
2015-07-27 8:22 ` Sebastien Vauban
2015-07-29 16:21 ` Rasmus
1 sibling, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-16 8:49 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> The polyglossia bits work well.
> The file local variable prompt for every export is quite annoying
> though. Same goes for the exported file, opening it brings up the same
> prompt again. I guess it is a one time thing to mark that variable as
> safe, then it should be good.
It's probably too annoying to default org-latex-variant-file-string to a
file variable. I find it neat to automatically have AUCTeX pick the right
engine, though.
I worry more about how to allow flags to be transmitted without making it
insecure. E.g. -shell-escape is one that we'd want to allow for minted.
Perhaps whitelisted flags.... Or just allow arbitrary flags after a latex
command.
> I have a few other questions:
> - how does one change the variant when doing a subtree export? By
> setting EXPORT_LATEX_VARIANT?
It seems to work at least to the point that the right engine is written to
the file:
#+LATEX_VARIANT: xelatex
* pdflatex
:PROPERTIES:
:export_latex_variant: pdflatex
:END:
* lualatex
:PROPERTIES:
:export_latex_variant: lualatex
:END:
> - Is it possible to set a default variant?
org-latex-variant => "pdflatex"
> - How does one insert a line in the package list which is not
> usepackage. I guess the normal case is still valid:
> "\\somedirective", but inserting a similar variant specific directive
> isn't possible.
Not possible ATM. You could use iftex on the latex level or we could
allow something like '("\\mymacro" ("pdflatex")) and enforce the second
argument to be a list to differentiate it from ("PKG OPTIONS" "PKG")....
> I'm starting to wonder, all these complications, is it really worth it?
> What do you think?
Most of my longer documents declare the compiler via bind of file
variables. So I'd use it. It would also allow me to get rid of some
filters.
Rasmus
--
Warning: Everything saved will be lost
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-16 8:49 ` Rasmus
@ 2015-07-27 8:22 ` Sebastien Vauban
2015-07-27 8:30 ` Rasmus
0 siblings, 1 reply; 31+ messages in thread
From: Sebastien Vauban @ 2015-07-27 8:22 UTC (permalink / raw
To: emacs-orgmode-mXXj517/zsQ
Hello,
Rasmus <rasmus-0UDz38MK/Mo@public.gmane.org> writes:
>> I have a few other questions:
>> - how does one change the variant when doing a subtree export? By
>> setting EXPORT_LATEX_VARIANT?
>
> It seems to work at least to the point that the right engine is written to
> the file:
>
> #+LATEX_VARIANT: xelatex
> * pdflatex
> :PROPERTIES:
> :export_latex_variant: pdflatex
> :END:
>
> * lualatex
> :PROPERTIES:
> :export_latex_variant: lualatex
> :END:
>
>
>> - Is it possible to set a default variant?
>
> org-latex-variant => "pdflatex"
FWIW, it seems that people who played with different LaTeX engines used
the "LATEX_CMD" property, as adviced on Worg [1]. Doesn't matter if we
change that, but just a reminder of some already common usage.
Best regards,
Seb
[1] http://orgmode.org/worg/org-faq.html#using-xelatex-for-pdf-export
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-27 8:22 ` Sebastien Vauban
@ 2015-07-27 8:30 ` Rasmus
2015-07-27 9:22 ` Sebastien Vauban
0 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2015-07-27 8:30 UTC (permalink / raw
To: emacs-orgmode
Sebastien Vauban <sva-news@mygooglest.com>
writes:
> FWIW, it seems that people who played with different LaTeX engines used
> the "LATEX_CMD" property, as adviced on Worg [1]. Doesn't matter if we
> change that, but just a reminder of some already common usage.
I didn't know that worg page. Just to understand, you are advising to use
"LATEX_CMD" as the keyword name? FWIW, that's fine with me, though
presently it's not really accurate as only {pdf,xe,lua}latex is allowed
(I'm hesitant to allow arbitrary scripts).
Rasmus
--
Not everything that goes around comes back around, you know
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-27 8:30 ` Rasmus
@ 2015-07-27 9:22 ` Sebastien Vauban
2015-07-27 9:31 ` Rasmus
0 siblings, 1 reply; 31+ messages in thread
From: Sebastien Vauban @ 2015-07-27 9:22 UTC (permalink / raw
To: emacs-orgmode-mXXj517/zsQ
Rasmus <rasmus-0UDz38MK/Mo@public.gmane.org> writes:
> Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> writes:
>
>> FWIW, it seems that people who played with different LaTeX engines used
>> the "LATEX_CMD" property, as adviced on Worg [1]. Doesn't matter if we
>> change that, but just a reminder of some already common usage.
>
> I didn't know that worg page. Just to understand, you are advising to
> use "LATEX_CMD" as the keyword name?
Yes.
> FWIW, that's fine with me, though presently it's not really accurate
> as only {pdf,xe,lua}latex is allowed
AFAIK, it's not intended to do more than just indicating which flavor of
the LaTeX engine to use (and, then, correctly update the real commands
which will be run), that is {pdf,xe,lua}latex.
> (I'm hesitant to allow arbitrary scripts).
I agree. Just stick to the basic need, which is to be able to easily
change of LaTeX engine.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-27 9:22 ` Sebastien Vauban
@ 2015-07-27 9:31 ` Rasmus
0 siblings, 0 replies; 31+ messages in thread
From: Rasmus @ 2015-07-27 9:31 UTC (permalink / raw
To: emacs-orgmode
Hi,
Sebastien Vauban <sva-news@mygooglest.com>
writes:
>> (I'm hesitant to allow arbitrary scripts).
>
> I agree. Just stick to the basic need, which is to be able to easily
> change of LaTeX engine.
I'd however also like to allow some flags, e.g. -shell-escape/write18 for
minted. I cannot think of other useful flags.
Thanks,
Rasmus
--
When in doubt, do it!
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: ox-latex: default packages cleaning
2015-07-16 8:29 ` Suvayu Ali
2015-07-16 8:49 ` Rasmus
@ 2015-07-29 16:21 ` Rasmus
1 sibling, 0 replies; 31+ messages in thread
From: Rasmus @ 2015-07-29 16:21 UTC (permalink / raw
To: emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> >> +(defun org-latex-guess-polyglossia-language (header info)
>> >> + "Set the Polyglossia language according to the LANGUAGE keyword.
>> >
>> > I'm in two-minds about this. On the one had it is a nice thing, but on
>> > the other hand, it prevents the more fine grained control offered by
>> > polyglossia. For example, I used this in my setup before:
>> >
>> > \setdefaultlanguage[variant=british]{english}
>>
>> The attached supports Polyglossia better. Note, the last loaded language
>> is the main one (as babel). Perhaps org-latex-variant-file-string should
>> be less annoying (not a file-variable).
>
> The polyglossia bits work well.
Pushed.
Rasmus
--
I feel emotional landscapes they puzzle me
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2015-07-29 16:25 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07 14:53 ox-latex: default packages cleaning Rasmus
2015-07-07 15:48 ` Eric S Fraga
2015-07-07 19:35 ` Suvayu Ali
2015-07-07 20:05 ` Rasmus
2015-07-07 20:52 ` Suvayu Ali
2015-07-07 21:07 ` Rasmus
2015-07-08 12:53 ` Rasmus
2015-07-08 13:43 ` Suvayu Ali
2015-07-08 13:53 ` Rasmus
2015-07-08 14:09 ` Suvayu Ali
2015-07-08 14:26 ` Rasmus
2015-07-08 14:55 ` Suvayu Ali
2015-07-08 15:41 ` Suvayu Ali
2015-07-08 16:06 ` Rasmus
2015-07-08 18:35 ` Rasmus
2015-07-16 8:29 ` Suvayu Ali
2015-07-16 8:49 ` Rasmus
2015-07-27 8:22 ` Sebastien Vauban
2015-07-27 8:30 ` Rasmus
2015-07-27 9:22 ` Sebastien Vauban
2015-07-27 9:31 ` Rasmus
2015-07-29 16:21 ` Rasmus
2015-07-08 12:54 ` Rasmus
2015-07-08 13:44 ` Suvayu Ali
2015-07-14 22:31 ` Marcin Borkowski
2015-07-15 8:33 ` Rasmus
2015-07-10 11:25 ` Robert Klein
2015-07-11 10:48 ` Rasmus
2015-07-11 18:53 ` Robert Klein
2015-07-13 10:08 ` Rasmus
2015-07-14 22:16 ` Marcin Borkowski
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.