emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: orgmode <emacs-orgmode@gnu.org>
Subject: [question] lisp code in :results header arg.?
Date: Tue, 16 Feb 2021 17:30:44 +0100	[thread overview]
Message-ID: <87zh040ybv.fsf@posteo.net> (raw)


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 

#+begin_src latex :results silent :exports results
     name = "ktest",
     type = "kern",
     data = 
	   ["A"] = { ["V"] = -45 },
  \setmainfont{Linux Libertine O}

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

#+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	other threads:[~2021-02-16 16:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 16:30 Juan Manuel Macías [this message]
2021-02-16 17:58 ` [question] lisp code in :results header arg.? Berry, Charles via General discussions about Org-mode.
2021-02-16 18:25   ` Juan Manuel Macías

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh040ybv.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).