> On Feb 16, 2021, at 8:30 AM, Juan Manuel Macías <maciasch...@posteo.net> 
> wrote:
> 
> Hi,
> 
> I'm exploring some ways to include a complex LaTeX preamble using source
> blocks. Consider this (code at the end of this message), that works fine.
> 
> My question is: In order to do it all in a single block, would there be
> any way to pass the output of the first block as an argument to a
> function, and put that function as a header arg (results)...?


[rest deleted]

I think you might do better to use noweb chunks, viz.

#+name: pre-amble
#+begin_src latex :exports none
  \usepackage{luacode}
  \usepackage{fontspec}
  \directlua
  {
  [...]
  }
  }
  \setmainfont{Linux Libertine O}
  [RawFeature={+ktest}]
#+end_src


#+begin_src latex :noweb yes :results drawer
,#+LaTeX_HEADER: <<pre-amble>>
#+end_src


Evaluating the latter chunk (assuming `org-babel-load-languages' has (latex . 
t)) gives what I suspect you want.

Note that using a drawer allows replacement of the result.

HTH,
Chuck


Reply via email to