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

2022-09-26 Thread Juan Manuel Macías
Ihor Radchenko writes: > What I have in mind is to modify `org-export-read-attribute' directly. > Then, we can call `org-export-read-attribute' in `org-export-data'; > resolve the refs in the template (re-use code from > `org-babel-ref-resolve' and `org-babel-parse-multiple-vars'); do normal >

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

2022-09-25 Thread Ihor Radchenko
Juan Manuel Macías writes: > Going back to the earlier :ATTR_BACKEND: issue as a property for > headings, I've been doing some testing and scribbled down a possible > function[1] whose code is almost entirely stolen from > org-export-read-attribute, with some modifications. Evaluated at the >

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

2022-09-25 Thread Juan Manuel Macías
Ihor Radchenko writes: >>> #+ATTR_BACKEND: :export_template "can also work on non-headings" >>> Paragraph. >> >> In this case I would not see it necessary, IMHO. For simple things (of >> the begin/end style) there are the special blocks. And for more complex >> pre- and/or post- code we have

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

2022-09-24 Thread Ihor Radchenko
Juan Manuel Macías writes: >> #+ATTR_BACKEND: :export_template "can also work on non-headings" >> Paragraph. > > In this case I would not see it necessary, IMHO. For simple things (of > the begin/end style) there are the special blocks. And for more complex > pre- and/or post- code we have

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

2022-09-24 Thread Juan Manuel Macías
Hi, Ihor, sorry for the late reply, Ihor Radchenko writes: > 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:

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

2022-09-22 Thread Pedro Andres Aranda Gutierrez
Ihor writes: > * 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+:

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

2022-09-22 Thread Ihor Radchenko
Daniel Fleischer writes: > If org-latex-classes is not a good enough solution I also think it should > be a general export feature, not specific to latex. In that case you > need a general syntax, e.g. properties like "export_prefix", > "export_postfix" and the code should be as simple as

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

2022-09-22 Thread Ihor Radchenko
"Fraga, Eric" writes: > This looks fine to me. I don't particularly care about the actual > syntax. However, a minor point out of curiosity: why not just ":latex:" > for the property name? Because attr_backend is our convention for export attributes. > And I would hope to have ":beamer:" (or

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

2022-09-22 Thread Ihor Radchenko
Juan Manuel Macías 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

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

2022-09-22 Thread Pedro Andres Aranda Gutierrez
Ihor writes; > More concretely, I mean something like > > * Section > :PROPERTIES: > :attr_latex: :prepend "section" \setcounter{secnumdepth}{0} > :attr_latex+: :prepend "section" \addtocontents{toc}{\protect\setcounter{tocdepth}{0}\ignorespaces} > :attr_latex+: :append "section"

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

2022-09-21 Thread Fraga, Eric
On Wednesday, 21 Sep 2022 at 16:55, Daniel Fleischer wrote: > I don't understand the usecase, that's why I wasn't really following. If > you write \vspace{10cm} before some headline, it's going to do the right > thing even if it "belongs" to a previous headline. For me, the issue is that I often

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

2022-09-21 Thread Juan Manuel Macías
Daniel Fleischer writes: > I don't understand the usecase, that's why I wasn't really following. If > you write \vspace{10cm} before some headline, it's going to do the right > thing even if it "belongs" to a previous headline. Imagine, for example, that you have defined a LaTeX command that

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

2022-09-21 Thread Daniel Fleischer
Ihor Radchenko [2022-09-21 Wed 16:55] wrote: > More concretely, I mean something like > > * Section > :PROPERTIES: > :attr_latex: :prepend "section" \setcounter{secnumdepth}{0} > :attr_latex+: :prepend "section" > \addtocontents{toc}{\protect\setcounter{tocdepth}{0}\ignorespaces} >

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

2022-09-21 Thread Max Nikulin
On 21/09/2022 15:55, Ihor Radchenko wrote: There is nothing wrong about this, but I feel that this kind of approach is encouraging to shoot your own leg a bit too much. I am afraid, it is unavoidable facet of flexibility. Anyway arbitrary LaTeX command may be inserted using export snippet or

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

2022-09-21 Thread Juan Manuel Macías
Ihor Radchenko writes: > It may produce unexpected results if "Section" heading is demoted all > the way to paragraph. If Section heading is demoted all the way to paragraph, I assume that the expected will happen: that in the output to LaTeX a string will be added before \paragraph and another

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

2022-09-21 Thread Timothy
Hi Eric, > And I would hope to have “:beamer:” (or “:attr_beamer:”) as well! I’d hope that pre/post-ending attributes would be backend-generalised. All the best, Timothy

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

2022-09-21 Thread Fraga, Eric
On Wednesday, 21 Sep 2022 at 16:55, Ihor Radchenko wrote: > More concretely, I mean something like > > * Section > :PROPERTIES: > :attr_latex: :prepend "section" \setcounter{secnumdepth}{0} > :attr_latex+: :prepend "section" >

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

2022-09-21 Thread Ihor Radchenko
Adding Daniel Fleischer (the ox-latex maintainer) to this exchange. Juan Manuel Macías writes: > Ihor Radchenko writes: > >> I do not like this idea. >> Please remember that headlines may be exported as parts, sections, >> subsections, list items, or paragraphs depending on the headline level.

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

2022-09-20 Thread Juan Manuel Macías
Ihor Radchenko writes: >> Can it be extended to add properties to a >> #BEGIN_example >> #END_example >> snippet? > > Didn't we conclude that wrapping blocks during LaTeX export should be > done via special blocks? (This question has been raised multiple times, > I am unsure if you are referring

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

2022-09-20 Thread Juan Manuel Macías
Ihor Radchenko writes: > I do not like this idea. > Please remember that headlines may be exported as parts, sections, > subsections, list items, or paragraphs depending on the headline level. > Arbitrary pre/post commands may unexpectedly break things during export. I don't see why, if the user

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

2022-09-20 Thread Ihor Radchenko
Juan Manuel Macías writes: > I don't know if the following scenario usually appears in the workflow > of other Org users as well. Otherwise, I think this patch could be > ignored. > > In my workflow I often need to pre- or postpend some LaTeX code > immediately before or after a section.

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

2022-09-20 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez writes: > Can it be extended to add properties to a > #BEGIN_example > #END_example > snippet? Didn't we conclude that wrapping blocks during LaTeX export should be done via special blocks? (This question has been raised multiple times, I am unsure if you are

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

2022-09-19 Thread Fraga, Eric
On Sunday, 18 Sep 2022 at 12:27, Juan Manuel Macías wrote: > I don't know if the following scenario usually appears in the workflow > of other Org users as well. Otherwise, I think this patch could be > ignored. I would find something like this useful as I often have commands such as \newpage and

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

2022-09-19 Thread Pedro Andres Aranda Gutierrez
HI Juan Manuel, Looks cool and would be a +1 from my side, since I need that too... Can it be extended to add properties to a #BEGIN_example #END_example snippet? I already suggested that some time ago... /PA -- Fragen sind nicht da um beantwortet zu werden, Fragen sind da um gestellt zu

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

2022-09-18 Thread Max Nikulin
On 18/09/2022 19:27, Juan Manuel Macías wrote: * Section :PROPERTIES: :presec: \begingroup\foo :postsec: \endgroup :END: Juan Manuel, can it be implemented using a derived backend that calls the original variant of headline transcoder (`org-latex-headline') and adds pre/post code

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

2022-09-18 Thread Juan Manuel Macías
Hi all, I don't know if the following scenario usually appears in the workflow of other Org users as well. Otherwise, I think this patch could be ignored. In my workflow I often need to pre- or postpend some LaTeX code immediately before or after a section. Consider the following example: