Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
Sebastien Vauban sva-n...@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
Re: [O] ox-latex: default packages cleaning
Hello, Rasmus ras...@gmx.us 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
Re: [O] ox-latex: default packages cleaning
Hi, Sebastien Vauban sva-n...@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!
Re: [O] ox-latex: default packages cleaning
Rasmus ras...@gmx.us writes: Sebastien Vauban sva-n...@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? 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
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
On Wed, Jul 08, 2015 at 08:35:28PM +0200, Rasmus wrote: Suvayu Ali fatkasuvayu+li...@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.
Re: [O] ox-latex: default packages cleaning
Marcin Borkowski mb...@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. . .
Re: [O] ox-latex: default packages cleaning
On 2015-07-07, at 16:53, Rasmus ras...@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
Re: [O] ox-latex: default packages cleaning
On 2015-07-07, at 21:35, Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
Hi, Rasmus ras...@gmx.us writes: * tolerance * marvosym¹ * Wasysym² Pushed. * Fixltx2e Will push after 8.3 is released. Rasmus -- Dobbelt-A
Re: [O] ox-latex: default packages cleaning
Hi Robert, Robert Klein rokl...@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
Re: [O] ox-latex: default packages cleaning
Hi Rasmus, On Sat, 11 Jul 2015 12:48:06 +0200 Rasmus ras...@gmx.us wrote: Hi Robert, Robert Klein rokl...@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
Re: [O] ox-latex: default packages cleaning
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
Re: [O] ox-latex: default packages cleaning
On Wed, Jul 08, 2015 at 03:53:32PM +0200, Rasmus wrote: Suvayu Ali fatkasuvayu+li...@gmail.com writes: From 54bcf8f1ae26c91fa856b64071dca65d3f31e1f2 Mon Sep 17 00:00:00 2001 From: Rasmus ras...@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.
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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 From df91d417df3223c0698e56be219f8f1a303ce566 Mon Sep 17 00:00:00 2001 From: Rasmus ras...@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
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
On Wed, Jul 08, 2015 at 02:54:41PM +0200, Rasmus wrote: Suvayu Ali fatkasuvayu+li...@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.
Re: [O] ox-latex: default packages cleaning
On Wed, Jul 08, 2015 at 02:53:46PM +0200, Rasmus wrote: Suvayu Ali fatkasuvayu+li...@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 ras...@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.
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@gmail.com writes: From 54bcf8f1ae26c91fa856b64071dca65d3f31e1f2 Mon Sep 17 00:00:00 2001 From: Rasmus ras...@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ä!
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
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.
Re: [O] ox-latex: default packages cleaning
Hi, Suvayu Ali fatkasuvayu+li...@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 -- ツ
Re: [O] ox-latex: default packages cleaning
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.
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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 From 96dcb2ab15ddfce1f95560f49076187508b2ef43 Mon Sep 17 00:00:00 2001 From: Rasmus ras...@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+li...@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)
Re: [O] ox-latex: default packages cleaning
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
Re: [O] ox-latex: default packages cleaning
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.
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
Suvayu Ali fatkasuvayu+li...@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
Re: [O] ox-latex: default packages cleaning
On Tue, Jul 07, 2015 at 10:05:06PM +0200, Rasmus wrote: Suvayu Ali fatkasuvayu+li...@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.
[O] ox-latex: default packages cleaning
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 euro; EUR EUR €) (EURdig \\EURdig{} nil euro; EUR EUR €) (EURhv \\EURhv{} nil euro; EUR EUR €) (EURcr \\EURcr{} nil euro; EUR EUR €) (EURtm \\EURtm{} nil euro; 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 #9786; :-) :-) ☺) (blacksmile \\blacksmiley{} nil #9787; :-) :-) ☻) (sad \\frownie{} nil #9785; :-( :-( ☹) 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)))