Sebastien,

One way to propagate values prior to export is to use named src blocks and 
noweb references to them.

For example, the following code:

---
#+name: orga-def
#+begin_src latex :exports none
  my old school
#+end_src

#+begin_src latex :noweb yes
  \begin{titlepage}
  Some custom LaTeX here
  This is my school:
  <<orga-def>>
  \end{titlepage}
  \newcommand{\orga}{
    <<orga-def>>
  }
#+end_src
----

will export as 

---
\begin{titlepage}
Some custom LaTeX here
This is my school:
my old school
\end{titlepage}
\newcommand{\orga}{
  my old school
}
---

if the latex is activated in `org-babel-load-languages`. You can customize this 
easily.

Or you just can `(require 'ob-latex)`.

You can preview the latex produced by eval-ing the src block or executing 
`org-babel-expand-src-block` (C-c C-v C-v) to see the latex produced.

Note that I added newlines around `<<orga-def>>` which was not necessary for 
this example, but if multi-line codes are used in the `orga-def` block, noweb 
will prefix/postfix each line and that could be a headache. See `Noweb 
Replacement Syntax` in the manual for more detail on prefixing.

HTH,

Chuck

> On Jun 1, 2024, at 5:05 AM, Sébastien Gendre <s...@k-7.ch> wrote:
> 
> 
> I need to have an Org document that could be used as easily as possible
> by anyone else. Sadly, having to define new Emacs function could be too
> much for what my school ask.

Reply via email to