From: "Fraga, Eric" <e.fraga@ucl.ac.uk>
To: "johanna.may@th-koeln.de" <johanna.may@th-koeln.de>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: change font-size in python plots depending on context
Date: Mon, 19 Aug 2019 11:10:20 +0000 [thread overview]
Message-ID: <87o90ls95w.fsf@ucl.ac.uk> (raw)
In-Reply-To: 87o90l5yje.fsf@th-koeln.de
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
next prev parent reply other threads:[~2019-08-19 11:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 8:50 change font-size in python plots depending on context johanna.may
2019-08-19 11:10 ` Fraga, Eric [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-08-19 16:50 Thomas S. Dye
2019-08-20 9:25 ` johanna.may
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
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=87o90ls95w.fsf@ucl.ac.uk \
--to=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=johanna.may@th-koeln.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).