emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] change font-size in python plots depending on context


From: Fraga, Eric
Subject: Re: [O] change font-size in python plots depending on context
Date: Mon, 19 Aug 2019 11:10:20 +0000

Hi Johanna,

> I have various files that go together in one document, either
> chapterwise or the whole book. And just as with tikz (latex) I want the font
> size of python plots to change automatically when the context changes.

What I do, for a similar use case, is to define values using properties
and then extract these values with a little function I wrote (see
below).  For example,

#+begin_src org
,#+property: myvariable 10
...
,#+begin_src ... :var v=(esf/get-parameter "myvariable")
... (use v in here)
,#+end_src
#+end_src

The esf/get-parameter function is:

#+begin_src emacs-lisp
  (defun esf/get-parameter (p)
    (let ((value (org-entry-get (point) p 'inherit)))
      (message "parameter %s value obtained %s" p value)
      (if value
          (if (string-match-p "^[-+ ]*[[:digit:].]+$" value)
              (string-to-number value)
            value)
        (error "Property parameter \"%s\" not known." p))))
#+end_src

I'm sure there are better ways but this is what I have developed
organically over the years...

HTH,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-401-gfabd6d



reply via email to

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