emacs-orgmode
[Top][All Lists]
Advanced

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

[question] lisp code in :results header arg.?


From: Juan Manuel Macías
Subject: [question] lisp code in :results header arg.?
Date: Tue, 16 Feb 2021 17:30:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

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)...?

Best Regards,

Juan Manuel 

#+NAME:preamble
#+begin_src latex :results silent :exports results
  \usepackage{luacode}
  \usepackage{fontspec}
  \directlua
  {
  fonts.handlers.otf.addfeature 
  {
     name = "ktest",
     type = "kern",
     data = 
        {
           ["A"] = { ["V"] = -45 },
        },
  }
  }
  \setmainfont{Linux Libertine O}
  [RawFeature={+ktest}]
#+end_src

#+begin_src emacs-lisp :var x=preamble :results raw :exports results
  (let* ((lines (split-string x "\n" nil))
         (headers (mapconcat (lambda
                           (line)
                           (unless (equal line "")
                             (format "#+LaTeX_Header: %s" line)))
                         lines "\n")))
    headers)
#+end_src

#+RESULTS:
#+LaTeX_Header: \usepackage{luacode}
#+LaTeX_Header: \usepackage{fontspec}
#+LaTeX_Header: \directlua
#+LaTeX_Header: {
#+LaTeX_Header: fonts.handlers.otf.addfeature 
#+LaTeX_Header: {
#+LaTeX_Header:    name = "ktest",
#+LaTeX_Header:    type = "kern",
#+LaTeX_Header:    data = 
#+LaTeX_Header:       {
#+LaTeX_Header:          ["A"] = { ["V"] = -45 },
#+LaTeX_Header:       },
#+LaTeX_Header: }
#+LaTeX_Header: }
#+LaTeX_Header: \setmainfont{Linux Libertine O}
#+LaTeX_Header: [RawFeature={+ktest}]




reply via email to

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