Fix Worg image export trick for Emacs-27.2 and Org-9.5.2
This commit is contained in:
parent
cc7d3adff3
commit
9b9d12ce99
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,6 +20,8 @@
|
||||
latexmkrc
|
||||
org-store-link
|
||||
setup-include.org
|
||||
tree.svg
|
||||
worg-backend-dependent-execution-update.org
|
||||
|
||||
/_minted-README
|
||||
/eln-cache
|
||||
|
56
README.org
56
README.org
@ -1556,6 +1556,62 @@ Listing [[lst:emacs-lisp-setup-call]] initializes the buffer local variables
|
||||
\end{titlepage}
|
||||
#+end_src
|
||||
|
||||
*** [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#orgcc214c1][Worg: backend dependent execution]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:backend-dependent-execution-update
|
||||
:END:
|
||||
|
||||
#+caption[Worg update: backend dependent header arguments]:
|
||||
#+caption: Worg update: backend dependent header arguments.
|
||||
#+name: lst:backend-dependent-execution-update
|
||||
#+begin_src org :tangle worg-backend-dependent-execution-update.org
|
||||
,#+latex_header: \usepackage{tikz}
|
||||
|
||||
,#+header: :file (by-backend (html "tree.svg") (latex nil))
|
||||
,#+header: :results (by-backend (html "raw file") (latex "latex replace"))
|
||||
,#+header: :headers '("\\usepackage{tikz}\n")
|
||||
,#+begin_src latex
|
||||
\usetikzlibrary{trees}
|
||||
\begin{tikzpicture}
|
||||
\node [circle, draw, fill=red!20] at (0,0) {1}
|
||||
child { node [circle, draw, fill=blue!30] {2}
|
||||
child { node [circle, draw, fill=green!30] {3} }
|
||||
child { node [circle, draw, fill=yellow!30] {4} }};
|
||||
\end{tikzpicture}
|
||||
,#+end_src
|
||||
|
||||
,* COMMENT Setup
|
||||
,#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'ox
|
||||
(setq org-babel-latex-htlatex "htlatex")
|
||||
(defmacro by-backend (&rest body)
|
||||
`(cl-case org-export-current-backend ,@body)))
|
||||
,#+end_src
|
||||
#+end_src
|
||||
|
||||
#+caption[Specify export backend dependent header arguments]:
|
||||
#+caption: Specify export backend dependent header arguments.
|
||||
#+name: lst:header-arguments-by-backend
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'ox
|
||||
(defmacro by-backend (&rest body)
|
||||
`(cl-case org-export-current-backend ,@body)))
|
||||
#+end_src
|
||||
|
||||
This section updates the outdated [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#orgcc214c1][Worg: backend dependent execution]] example to
|
||||
Emacs-27.2 and Org-9.5.2. It shows how to export [[https://en.wikipedia.org/wiki/PGF/TikZ][PGF/TikZ]] images to:
|
||||
1. [[https://en.wikipedia.org/wiki/PDF][PDF]] by embedding in [[https://www.latex-project.org/][LaTeX]].
|
||||
2. [[https://en.wikipedia.org/wiki/HTML][HTML]] by passing from [[https://www.latex-project.org/][LaTeX]] by [[https://en.wikipedia.org/wiki/PDF][PDF]] and to [[https://en.wikipedia.org/wiki/Scalable_Vector_Graphics][SVG]].
|
||||
Listing [[lst:backend-dependent-execution-update]] tangles to
|
||||
[[file:worg-backend-dependent-execution-update.org][worg-backend-dependent-execution-update.org]] as either a standalone example or an
|
||||
example for inclusion. Listing [[lst:header-arguments-by-backend]] tangles to the
|
||||
=user-init-file= to make the convenience =by-backend= macro always available.
|
||||
Finally, inclusion of [[file:worg-backend-dependent-execution-update.org][worg-backend-dependent-execution-update.org]] produces here
|
||||
the figure with the nodes 1, 2, 3, and 4:\\
|
||||
|
||||
#+include: worg-backend-dependent-execution-update.org
|
||||
*This line is hidden because of the "{{{*}}}COMMENT Setup" header in the inclusion!*
|
||||
|
||||
* Programming
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:programming
|
||||
|
Loading…
Reference in New Issue
Block a user