emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword
Date: Tue, 26 Sep 2023 22:39:46 +0700	[thread overview]
Message-ID: <ueuu03$fsk$1@ciao.gmane.io> (raw)
In-Reply-To: <87r0ml3oax.fsf@tsdye.online>

On 26/09/2023 04:57, Thomas S. Dye wrote:
> Aloha all,
> 
> Juan Manuel Macías <maciaschain@posteo.net> writes:
>>
>>> If so, Org should have native support of \DocumentMetadata, not
>>> LATEX_PRE_HEADER or something similar.
>>
>> If it were the only case of code before \documentclass, I would agree.
>> But, as I have already said above, the diversity of use cases makes the
>> implementation of /ad hoc/ solutions unviable, in my opinion.
> 
> FWIW, I agree with Juan Manuel here and would welcome a straightforward 
> way to insert material before the header.

I just have checked that a dirty hack with a few lines of code for 
`org-export-filter-final-output-functions' allows to insert arbitrary 
text to the beginning of export result. Perhaps a more elegant solution 
exists, but I admit it is not a straightforward way. At least it is 
possible.

I do not mind that generation of preamble should be more flexible, but I 
consider LATEX_PRE_HEADER as an ad hoc solution, so I am trying to find 
a better variant. That is why I asked for details concerning particular 
use cases.

I remember recipes like "put \usepackage{cmap} immediately after 
\documentclass" (nowadays this particular one should not be necessary). 
So I would prefer to avoid keywords per each chunk of preamble code.

\begin{filecontents*} from the original post is not convincing. 
\DocumentMetadata perhaps should be supported out of the box.

I would consider some kind of templates that use predefined fragments

#+LATEX_REPLACE_TEMPLATE: :preamble mypreamble
#+name: mypreamble
#+begin_src latex :exports none :noweb yes
\providecommand{\pdfxopts}{x-1a}
<<ox-latex-template-preamble>>
#+end_src

with ability to use fine grain snippets instead

#+LATEX_REPLACE_TEMPLATE: :preamble detailedpreamble
#+name: detailedpreamble
#+begin_src latex :exports none :noweb yes
<<ox-latex-template-DocumentMetadata>>
\PassOptionsToPackage...
<<ox-latex-template-documentclass>>
\usepackage{cmap}
\usepackage[english,<<ox-template-language>>]{babel}
<<ox-latex-template-usepackage>>
#+end_src


I hope, something similar may be made more readable than series of 
LATEX_HEADER & Co lines.



  reply	other threads:[~2023-09-26 15:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-16 18:00 [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword Juan Manuel Macías
2023-09-17 10:02 ` Ihor Radchenko
2023-09-17 17:23 ` Timothy
2023-09-18  8:09   ` Ihor Radchenko
2023-09-22 16:38 ` Max Nikulin
2023-09-24 18:42   ` Juan Manuel Macías
2023-09-25 13:58     ` Max Nikulin
2023-09-25 18:49       ` Juan Manuel Macías
2023-09-25 21:57         ` Thomas S. Dye
2023-09-26 15:39           ` Max Nikulin [this message]
2023-09-26 19:12             ` Juan Manuel Macías
2023-09-28 10:07               ` Max Nikulin
2023-09-28 12:31                 ` Juan Manuel Macías
2023-09-29  2:38                   ` Max Nikulin
2023-10-01 16:32                   ` Max Nikulin
2023-09-28 15:36                 ` AW
2023-10-01 16:02                   ` Max Nikulin
2023-10-01 17:48                     ` Juan Manuel Macías
2023-10-02 10:42               ` Max Nikulin

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='ueuu03$fsk$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

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

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

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

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