emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: "Juan Manuel Macías" <maciaschain@posteo.net>,
	"Org Mode List" <emacs-orgmode@gnu.org>
Subject: Re: New try at multi-lingual export to latex/pdf using pdflatex and babel
Date: Sun, 28 Jan 2024 18:02:33 +0100	[thread overview]
Message-ID: <CAO48Bk98C8pJ83mYwUEAqsgB7EnadePy5=uc+PqsGpue5AUNdA@mail.gmail.com> (raw)
In-Reply-To: <87zfwpefj3.fsf@localhost>


[-- Attachment #1.1: Type: text/plain, Size: 1676 bytes --]

No worries.. next try ;-)

Best, /PA

On Sun, 28 Jan 2024 at 14:43, Ihor Radchenko <yantar92@posteo.net> wrote:

> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>
> >> "Pedro A. Aranda" <paaguti@gmail.com> writes:
> >>
> >> > I've been reading a bit. What I propose is an alternative way to
> handle
> >> > all the tricky parts of font and character handling with fontspec in
> >> > lualatex and xetex. This package restricts the use of the ams*
> packages
> >> > to pdflatex, because fontenc handles that internally and produces
> >> > package collisions.
> >>
> >> > Attached is the final version of the patch.
> >>
> >> Thanks!
> >> May you also add a comment to the code explaining the rationale right
> >> there?
>
> > Here you are. I hope the couple of words suffice ;-)
>
> Sorry, I was not clear.
> I did not mean to ask about amending the docstring.
> I meant literal code comments, explaining why we have duplicate amsmath
> entries and why we restrict certain packages to specific compilers.
>
> Also, the above quoted paragraph with rationale of the patch should go
> into the commit message. See
> https://orgmode.org/worg/org-contribute.html#commit-messages
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #1.2: Type: text/html, Size: 2910 bytes --]

[-- Attachment #2: 0001-Refine-packages-for-font-management.patch --]
[-- Type: text/x-patch, Size: 3690 bytes --]

From 0beed8846195717e6db051033cac8fd942f89c53 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda Gutierrez" <paaguti@gmail.com>
Date: Sun, 28 Jan 2024 17:51:23 +0100
Subject: [PATCH] Refine packages for font management

* lisp/org.el: Change `org-latex-default-packages-alist' to
refine font management depending on the latex compiler.

Differentiate between pdflatex and lualatex/xetex
packages for font management. lualatex/xetex should use
fontspec instead of fontenc/inputenc. When using
fontspec, you need to load amsmath before fontspec 
and you don't need amssymb.
  
---

 lisp/org.el | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 796545392..539a128f1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3421,15 +3421,21 @@ header, or they will be appended."
 	  (default-value var)))
 
 (defcustom org-latex-default-packages-alist
-  '(("AUTO" "inputenc"  t ("pdflatex"))
+  '(;; amsmath before fontspec for lualatex and xetex
+    (""     "amsmath"   t ("lualatex" "xetex"))
+    ;; fontspec ASAP for lualatex and xetex
+    (""     "fontspec"  t ("lualatex" "xetex"))
+    ;; inputenc and fontenc are for pdflatex only
+    ("AUTO" "inputenc"  t ("pdflatex"))
     ("T1"   "fontenc"   t ("pdflatex"))
     (""     "graphicx"  t)
     (""     "longtable" nil)
     (""     "wrapfig"   nil)
     (""     "rotating"  nil)
     ("normalem" "ulem"  t)
-    (""     "amsmath"   t)
-    (""     "amssymb"   t)
+    ;; amsmath and amssymb after inputenc/fontenc for pdflatex
+    (""     "amsmath"   t ("pdflatex"))
+    (""     "amssymb"   t ("pdflatex"))
     (""     "capt-of"   nil)
     (""     "hyperref"  nil))
   "Alist of default packages to be inserted in the header.
@@ -3440,7 +3446,9 @@ incompatibility with another package you are using.
 The packages in this list are needed by one part or another of
 Org mode to function properly:
 
+- fontspec: for font and character selection in lualatex and xetex
 - inputenc, fontenc:  for basic font and character selection
+  in pdflatex
 - graphicx: for including images
 - longtable: For multipage tables
 - wrapfig: for figure placement
@@ -3448,8 +3456,8 @@ Org mode to function properly:
 - ulem: for underline and strike-through
 - amsmath: for subscript and superscript and math environments
 - amssymb: for various symbols used for interpreting the entities
-  in `org-entities'.  You can skip some of this package if you don't
-  use any of the symbols.
+  in `org-entities'.  You can skip some of this package if you
+  don't use any of the symbols.
 - capt-of: for captions outside of floats
 - hyperref: for cross references
 
@@ -15211,20 +15219,20 @@ INCREMENT-STEP divisor."
 	(setq hour (mod hour 24))
 	(setq pos-match-group 1
               new (format "-%02d:%02d" hour minute)))
-       
+
        ((org-pos-in-match-range pos 6) ;; POS on "dmwy" repeater char.
 	(setq pos-match-group 6
               new (car (rassoc (+ nincrements (cdr (assoc (match-string 6 ts-string) idx))) idx))))
-       
+
        ((org-pos-in-match-range pos 5) ;; POS on X in "Xd" repeater.
 	(setq pos-match-group 5
               ;; Never drop below X=1.
               new (format "%d" (max 1 (+ nincrements (string-to-number (match-string 5 ts-string)))))))
-       
+
        ((org-pos-in-match-range pos 9) ;; POS on "dmwy" repeater in warning interval.
 	(setq pos-match-group 9
               new (car (rassoc (+ nincrements (cdr (assoc (match-string 9 ts-string) idx))) idx))))
-       
+
        ((org-pos-in-match-range pos 8) ;; POS on X in "Xd" in warning interval.
 	(setq pos-match-group 8
               ;; Never drop below X=0.
-- 
2.34.1


  reply	other threads:[~2024-01-28 17:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-21  8:44 New try at multi-lingual export to latex/pdf using pdflatex and babel Pedro Andres Aranda Gutierrez
2024-01-21 13:02 ` Ihor Radchenko
2024-01-21 17:11   ` Pedro Andres Aranda Gutierrez
2024-01-21 17:47     ` Juan Manuel Macías
2024-01-22  6:30       ` Pedro Andres Aranda Gutierrez
2024-01-22  6:47         ` Pedro Andres Aranda Gutierrez
2024-01-22 13:11           ` Juan Manuel Macías
2024-01-22 12:10       ` Ihor Radchenko
2024-01-22 13:40         ` Juan Manuel Macías
2024-01-23  7:41           ` Pedro Andres Aranda Gutierrez
2024-01-24 16:25             ` Ihor Radchenko
2024-01-25  7:25               ` Pedro A. Aranda
2024-01-25 13:41                 ` Ihor Radchenko
2024-01-25 16:54                   ` Pedro A. Aranda
2024-01-26 13:28                     ` Ihor Radchenko
2024-01-26 17:49                       ` Pedro Andres Aranda Gutierrez
2024-01-28 13:47                         ` Ihor Radchenko
2024-01-28 17:02                           ` Pedro Andres Aranda Gutierrez [this message]
2024-01-29 13:28                             ` Ihor Radchenko
2024-01-29 14:34                               ` Pedro Andres Aranda Gutierrez
2024-01-29 14:51                                 ` Ihor Radchenko
2024-01-29 14:51                                   ` Pedro Andres Aranda Gutierrez
2024-02-09 23:10     ` Ihor Radchenko
2024-02-10  6:13       ` Pedro Andres Aranda Gutierrez
2024-02-10 14:39         ` Ihor Radchenko
2024-02-11  6:22           ` Pedro Andres Aranda Gutierrez
2024-02-11 11:04             ` Juan Manuel Macías
2024-04-15 12:21               ` Ihor Radchenko
2024-04-22 20:06                 ` Ihor Radchenko

Reply instructions:

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

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

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

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

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

  git send-email \
    --in-reply-to='CAO48Bk98C8pJ83mYwUEAqsgB7EnadePy5=uc+PqsGpue5AUNdA@mail.gmail.com' \
    --to=paaguti@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=maciaschain@posteo.net \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).