add gpl-prologue
This commit is contained in:
@@ -794,7 +794,7 @@ nil the return value is nil"
|
|||||||
(add-to-list 'org-babel-load-languages '(ditaa . t))))
|
(add-to-list 'org-babel-load-languages '(ditaa . t))))
|
||||||
|
|
||||||
(use-package ob-gnuplot
|
(use-package ob-gnuplot
|
||||||
:commands (gpl-file gpl-term)
|
:commands (gpl-file gpl-term gpl-prologue)
|
||||||
:init
|
:init
|
||||||
(with-eval-after-load 'org
|
(with-eval-after-load 'org
|
||||||
(add-to-list 'org-babel-load-languages '(gnuplot . t)))
|
(add-to-list 'org-babel-load-languages '(gnuplot . t)))
|
||||||
@@ -819,8 +819,8 @@ set linetype 6 lc rgb '#4cbded' lw 2 pt 5 ; \
|
|||||||
set linetype 7 lc rgb '#a1132e' lw 2 pt 5 ; \
|
set linetype 7 lc rgb '#a1132e' lw 2 pt 5 ; \
|
||||||
filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \
|
filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \
|
||||||
set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) "
|
set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) "
|
||||||
"usage e.g. to prepend style for all gnuplot src blocks by-backend:
|
"usage e.g. to prepend style for all gnuplot src blocks by-backend, see
|
||||||
#+property: header-args:gnuplot :prologue (by-backend (latex gnuplot-init-light) (t gnuplot-init-dark))
|
`gpl-prologue'.
|
||||||
")
|
")
|
||||||
(defvar gnuplot-init-dark "reset ; \
|
(defvar gnuplot-init-dark "reset ; \
|
||||||
theme_type = 'dark' ; \
|
theme_type = 'dark' ; \
|
||||||
@@ -841,10 +841,22 @@ set linetype 6 lc rgb '#76ab2f' lw 2 pt 5 ; \
|
|||||||
set linetype 7 lc rgb '#ecb01f' lw 2 pt 5 ; \
|
set linetype 7 lc rgb '#ecb01f' lw 2 pt 5 ; \
|
||||||
filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \
|
filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \
|
||||||
set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) "
|
set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) "
|
||||||
"usage e.g. to prepend style for all gnuplot src blocks by-backend:
|
"usage e.g. to prepend style for all gnuplot src blocks by-backend, see
|
||||||
#+property: header-args:gnuplot :prologue (by-backend (latex gnuplot-init-light) (t gnuplot-init-dark))
|
`gpl-prologue'.
|
||||||
")
|
")
|
||||||
|
|
||||||
|
(defun gpl-prologue ()
|
||||||
|
"\
|
||||||
|
returns: file name with extension for the org src header :file
|
||||||
|
- for LaTeX export it is set to: FILENAME.tikz
|
||||||
|
- for other export it is set to: FILENAME.svg
|
||||||
|
|
||||||
|
usage:
|
||||||
|
#+HEADER: :prologue (gpl-prologue)
|
||||||
|
#+property: header-args:gnuplot :prologue (gpl-prologue)
|
||||||
|
"
|
||||||
|
(by-backend (latex gnuplot-init-light) (t gnuplot-init-dark)))
|
||||||
|
|
||||||
(defun gpl-file (filename)
|
(defun gpl-file (filename)
|
||||||
"\
|
"\
|
||||||
FILENAME: the file name
|
FILENAME: the file name
|
||||||
@@ -861,7 +873,7 @@ See also: http://www.gnuplot.info/docs_5.2/Gnuplot_5.2.pdf#section*.519
|
|||||||
(concat filename (by-backend (latex ".tikz") (article-latex ".tikz") (t ".svg")) )
|
(concat filename (by-backend (latex ".tikz") (article-latex ".tikz") (t ".svg")) )
|
||||||
;;(by-backend (latex "") (t (concat filename ".svg")))
|
;;(by-backend (latex "") (t (concat filename ".svg")))
|
||||||
)
|
)
|
||||||
(defun gpl-term (lsize osize &optional bg)
|
(defun gpl-term (lsize osize &optional bg interactive)
|
||||||
"\
|
"\
|
||||||
LSIZE: latex export size
|
LSIZE: latex export size
|
||||||
OSIZE: other export size
|
OSIZE: other export size
|
||||||
@@ -879,7 +891,7 @@ usage: #+HEADER: :term (gpl-term \"15cm,12cm\" \"380,300\")
|
|||||||
(by-backend
|
(by-backend
|
||||||
(latex " color")
|
(latex " color")
|
||||||
(article-latex " color")
|
(article-latex " color")
|
||||||
(t (concat " mouse standalone background '" (or bg "#11000000") "'")))))
|
(t (concat (when interactive " mouse standalone") " background '" (or bg "#11000000") "'")))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package ob-latex
|
(use-package ob-latex
|
||||||
|
|||||||
Reference in New Issue
Block a user