add gpl-prologue

This commit is contained in:
2025-12-29 23:29:22 +01:00
parent 2d377dda06
commit c4db3450a9

View File

@@ -794,7 +794,7 @@ nil the return value is nil"
(add-to-list 'org-babel-load-languages '(ditaa . t))))
(use-package ob-gnuplot
:commands (gpl-file gpl-term)
:commands (gpl-file gpl-term gpl-prologue)
:init
(with-eval-after-load 'org
(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 ; \
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) "
"usage e.g. to prepend style for all gnuplot src blocks by-backend:
#+property: header-args:gnuplot :prologue (by-backend (latex gnuplot-init-light) (t gnuplot-init-dark))
"usage e.g. to prepend style for all gnuplot src blocks by-backend, see
`gpl-prologue'.
")
(defvar gnuplot-init-dark "reset ; \
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 ; \
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) "
"usage e.g. to prepend style for all gnuplot src blocks by-backend:
#+property: header-args:gnuplot :prologue (by-backend (latex gnuplot-init-light) (t gnuplot-init-dark))
"usage e.g. to prepend style for all gnuplot src blocks by-backend, see
`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)
"\
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")) )
;;(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
OSIZE: other export size
@@ -879,7 +891,7 @@ usage: #+HEADER: :term (gpl-term \"15cm,12cm\" \"380,300\")
(by-backend
(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