patch ob-core to allow function as header-args and add function for latex src blocks for tikz pictures
This commit is contained in:
@@ -481,7 +481,12 @@ Updating an old preamble.org should remove this warning."))
|
||||
'((name . "obsolete")))
|
||||
|
||||
;; TODO: still useful?
|
||||
(defun svg-fname (filename) (concat filename (by-backend (latex "_light") (t "_dark")) ".svg")))
|
||||
(defun svg-fname (filename)
|
||||
(concat filename (by-backend
|
||||
(latex "_light")
|
||||
(article-latex "_light")
|
||||
(t "_dark"))
|
||||
".svg")))
|
||||
|
||||
(use-package ob-gnuplot
|
||||
:defer t
|
||||
@@ -539,7 +544,7 @@ usage: #+HEADER: :file (gpl-file \"ledger-income\")
|
||||
See also: http://www.gnuplot.info/docs_5.2/Gnuplot_5.2.pdf#section*.519
|
||||
"
|
||||
;;(concat filename (by-backend (latex ".tex") (t ".svg")) )
|
||||
(concat filename (by-backend (latex ".tikz") (t ".svg")) )
|
||||
(concat filename (by-backend (latex ".tikz") (article-latex ".tikz") (t ".svg")) )
|
||||
;;(by-backend (latex "") (t (concat filename ".svg")))
|
||||
)
|
||||
(defun gpl-term (lsize osize)
|
||||
@@ -555,11 +560,42 @@ usage: #+HEADER: :term (gpl-term \"15cm,12cm\" \"380,300\")
|
||||
"
|
||||
(concat
|
||||
;;(by-backend (latex "epslatex size ") (t "svg size "))
|
||||
(by-backend (latex "lua tikz size ") (t "svg size "))
|
||||
(by-backend (latex lsize) (t osize))
|
||||
(by-backend (latex " color") (t " mouse standalone background '#11000000'"))))
|
||||
(by-backend (latex "lua tikz size ") (article-latex "lua tikz size ") (t "svg size "))
|
||||
(by-backend (latex lsize) (article-latex lsize) (t osize))
|
||||
(by-backend (latex " color") (article-latex " color") (t " mouse standalone background '#11000000'"))))
|
||||
)
|
||||
|
||||
(use-package ob-latex
|
||||
:defer t
|
||||
:config
|
||||
;; tikz config for own org export projects
|
||||
(defun tpl-file (filename)
|
||||
"\
|
||||
FILENAME: the file name
|
||||
|
||||
returns: file name with extension for the org src header :file
|
||||
- for LaTeX export it is set to: nil
|
||||
- for other export it is set to: FILENAME.svg
|
||||
|
||||
usage: #+HEADER: :file (tpl-file \"ledger-income\")
|
||||
"
|
||||
(by-backend (latex nil)
|
||||
(article-latex nil)
|
||||
(t (concat filename ".svg"))))
|
||||
(defun tpl-results ()
|
||||
"\
|
||||
TikZ
|
||||
|
||||
returns: result type for the org src header :results
|
||||
- for LaTeX export it is set to: raw
|
||||
- for other export it is set to: raw file
|
||||
|
||||
usage: #+HEADER: :results (tpl-results)
|
||||
"
|
||||
(by-backend (latex "raw")
|
||||
(article-latex "raw")
|
||||
(t "raw file"))))
|
||||
|
||||
(use-package ob-python
|
||||
:defer t
|
||||
:config
|
||||
@@ -573,7 +609,7 @@ returns: file name varible with extension for the org src header :var
|
||||
|
||||
usage: #+HEADER: :var fname=(mpl-var \"ledger-income\")
|
||||
"
|
||||
(concat filename (by-backend (latex ".pgf") (t ".svg"))))
|
||||
(concat filename (by-backend (latex ".pgf") (article-latex ".pgf") (t ".svg"))))
|
||||
(defun mpl-prologue ()
|
||||
"\
|
||||
Matplotlib
|
||||
@@ -584,7 +620,9 @@ returns: style settings for a org src python matplotlib code block
|
||||
|
||||
usage: #+HEADER: :prologue (mpl-prologue)
|
||||
"
|
||||
(by-backend (latex "") (t "import matplotlib.pyplot as plt;plt.style.use('dark_background');"))))
|
||||
(by-backend (latex "")
|
||||
(article-latex "")
|
||||
(t "import matplotlib.pyplot as plt;plt.style.use('dark_background');"))))
|
||||
|
||||
(use-package ob-ditaa
|
||||
:defer t
|
||||
|
||||
Reference in New Issue
Block a user