1

I have been reading the pgf & tikz manual and I want too generate svg directly from my tex file. The manual says I need to run:

lualatex --output-format=dvi example
dvisvgm example

I would like to automate this process when using AUCTeX so that I can do C-c C-c tikzsvg to run both commands on my file. So far, I know I need to modify TeX-command-list to add a new AUCTeX "command". I have two issues:

  1. The syntax for the command to run seems complex, with a lot of string substitution. Inspecting the variable TeX-expand-list-builtin is not of much help in understanding all the substitutions.
  2. The procedure involves two successive commands and I am not sure how to tell auctex to run one after the other.

Can anyone provide some guidance on how to accomplish this? Is this question more suitable to emacs se?

3
  • If you don't find a suitable for you solution, keep in mind that texlive has a convert command that converts between pdf and images formats... I know it is not an answer but it may helps
    – koleygr
    Aug 4, 2017 at 17:08
  • 1
    Untested: Does it work if you add this to your .emacs, restart Emacs and do C-c C-c in your .texfile? (eval-after-load "tex" '(add-to-list 'TeX-command-list '("tikzsvg" "lualatex --output-format=dvi %s && dvisvgm %s" TeX-run-command t t :help "Run LuaLaTeX and dvisvgm") t)) Aug 4, 2017 at 21:13
  • @ArashEsbati That works great. Write an answer and I'll give you the check mark.
    – sturgman
    Aug 7, 2017 at 16:01

1 Answer 1

1

You can make an addition to TeX-command-list by putting something like this in your .emacs:

(eval-after-load "tex"
  '(add-to-list 'TeX-command-list
                '("tikzsvg" "lualatex --output-format=dvi %s && dvisvgm %s"
                   TeX-run-command t t :help "Run LuaLaTeX and dvisvgm") t))

The elements of this addition are:

  1. "tikzsvg" is the name of the command presented to you with completion when you hit C-c C-c
  2. The second string is handed to the shell. You can chain commands with && operator
  3. %s expands to name of the master file
  4. TeX-run-command creates an asynchronous process with command in 2. and shows the output in a separate buffer
  5. First t lets you modify the expanded string in Minibuffer
  6. Second t makes this command available in every mode
  7. String after :help is shown in the menu

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .