emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] Pre-/postpend arbitrary LaTeX code to a section


From: Ihor Radchenko
Subject: Re: [Patch] Pre-/postpend arbitrary LaTeX code to a section
Date: Thu, 22 Sep 2022 22:08:03 +0800

Juan Manuel Macías <maciaschain@posteo.net> writes:

>> I suggest to use more canonical attr_latex that explicitly limits the
>> export backend.
>
> I see. But in any case, something like `:prepend "section"' would be
> unnecessary (and even counterproductive) for what I'm proposing, but I'm
> afraid I didn't explain myself well in the first message. One of the
> benefits of approaching this issue with a few minor modifications to
> org-latex-headline is that the result is regardless of the section level
> at which the property is applied. We may want to prefix the section with
> a specific LaTeX code only for \section (or \paragraph or whatever) and
> we may want to introduce a more general LaTeX code, level-agnostic.
> Explicitly put "section", "subsection", etc, IMHO unnecessarily
> complicates things. But I also insist (as I said at the beginning) that
> I don't know if this use case can also be extended to other users.

Yeah. Extra matcher is probably too cumbersome.
Yet, I feel like conditional prefix/suffix may be useful in some
scenarios.

Having read the available replies in this thread, I am thinking of the
following:

1. Instead of explicit prefix and suffix, we can unify extra text around
   the exported Org element to a template:

* headline
:PROPERTIES:
:ATTR_BACKEND: :export_template "\begin{myenv}\n%s\n\end{myenv}"
:ATTR_BACKEND+: "The %%s instances are replaced by the exported element"
:ATTR_BACKEND+: (concat "arbitrary sexp, the exported element is bound to: " 
*this*)
:ATTR_BACKEND+: babel_block_name(exported=*this*)
:ATTR_BACKEND+: "the property lines are concatenated with \" \" (space),"
:ATTR_BACKEND+: "just like the usual approach in `org-export-read-attribute'"
:END:

#+ATTR_BACKEND: :export_template "can also work on non-headings"
Paragraph.

2. The generic Org export routine will remove the :export_template
   attributes prior to passing the element to backend-defined export
   transcoder, thus avoiding the problem Max raised wrt ox-html
   attributes.

3. Similar to :export_template, we can have
   :export_prefix/:export_suffix, but I feel that the template will be
   more flexible.

WDYT?

-- 
Ihor Radchenko,
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]