[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword
From: |
Max Nikulin |
Subject: |
Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword |
Date: |
Thu, 28 Sep 2023 17:07:41 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 |
On 27/09/2023 02:12, Juan Manuel Macías wrote:
Max Nikulin writes:
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.
I think that this would not be the case. This is not just any part of
the preamble, but a fairly definite part. Broadly speaking, LaTeX_header
would take care of what is after \documenclass (the axis of a LaTeX
document); LaTeX_pre_header would do it of anything that may have come
before. And both provide a less constricted preamble for advanced use of
LaTeX. Frankly, I can't think of a simpler solution.
LaTeX code may be inserted
- before \DocumentMetadata
- between \DocumentMetadata and \documentclass
- between \documentclass and preamble added by Org
- between Org preamble and \begin{document}
Since ordering is important, I would prefer to assemble preamble from
predefined fragments (or replace particular ones) to putting code into
these (and probably more) slots.
\begin{filecontents*} from the original post is not convincing.
Are you not convinced by some instructions that are included in the
official documentation of a LaTeX package (pdfx)?
More I read about .xmpdata, more it looks similar to an ugly kludge from
my point of view. The following phrases are hardly consistent:
- "Including the metadata with the LATEX source is very convenient."
- "remember to remove the existing copy of \jobname.xmpdata file before
the next processing run".
(A side note: "overwrite" option of filecontents looks promising.)
So the goal is an XML document embedded into PDF. I admit, Org can not
provide it directly since e.g. PDF compliance level is responsibility of
a PDF engine.
However the intermediate .xmpdata file may be provided independently of
its .tex counterpart accordingly to docs. This file contains metadata
and in Org metadata are managed through keywords. Significant fraction
of metadata may be shared with HTML or MarkDown, so keywords should be
considered as primary data. Writing this file from Org (e.g. by a babel
source code block) should avoid issues with LaTeX input encodings
described in the docs. Thus generation of .xmpdata during exporting of
an .org file allows to keep metadata consistent.
Currently I do not see a way to get values of INFO argument of
org-export functions from source code blocks making access to metadata
tricky. This should be addressed somehow. I would consider specifying
metadata in a way similar to org-babel header arguments to allow more
fields than currently supported by Org. It should facilitate generation
of \DocumentMedata, .xmpdada, etc.
Ability to overwrite fragments of preamble should be supported, but only
as last resort. Specifying \DocumentMetadata or .xmpdata contents
literally should be avoided to prevent discrepancy with metadata keywords.
I consider \begin{filecontents*}{\jobname.xmpdata} as an acceptable (but
perhaps fragile) hack for LaTeX-first document. During export of Org
file, this file should be written directly with values from Org metadata.
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, (continued)
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Ihor Radchenko, 2023/09/17
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Timothy, 2023/09/17
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Max Nikulin, 2023/09/22
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Juan Manuel Macías, 2023/09/24
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Max Nikulin, 2023/09/25
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Juan Manuel Macías, 2023/09/25
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Thomas S. Dye, 2023/09/25
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Max Nikulin, 2023/09/26
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Juan Manuel Macías, 2023/09/26
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword,
Max Nikulin <=
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Juan Manuel Macías, 2023/09/28
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, Max Nikulin, 2023/09/28
- Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword, AW, 2023/09/28