[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does a `standalone` document set `TeX-PDF-from-DVI`?

From: Arash Esbati
Subject: Re: Why does a `standalone` document set `TeX-PDF-from-DVI`?
Date: Sat, 16 Jan 2021 00:24:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50

Maximilian Wuttke <> writes:

> On 13/01/2021 22:48, Arash Esbati wrote:
>> AUCTeX doesn't have a style for standalone package [...]
> OK, so should there be a style hook for the standalone package?

Yes, it's waiting for someone to write it :-)

> It turns out that the following code already runs the style hook for
> tikz (and *not* for pstricks), since "tikz" is provided as a class
> option. (It also tries to run a style hook for "border=5pt", but there
> is none).
>> \documentclass[tikz,border=5pt]{standalone}
>> \begin{document}
>> \begin{tikzpicture}
>>   \node{test!};
>> \end{tikzpicture}
>> \end{document}

Actually, it doesn't run the style hook, it only loads the style file.
You can check this by eval'ing (TeX-style-list) once you load that .tex
file and/or try to get completion for tikzpicture with `C-c C-e'.

A style file standalone.el which runs the style hooks based on given
class options can look like this:

--8<---------------cut here---------------start------------->8---
 (lambda ()

   (dolist (opt '("tikz" "preview" "pstricks"))
     (when (or (LaTeX-provided-class-options-member "standalone" opt)
               (LaTeX-provided-class-options-member "standalone"
                                                    (concat opt "=true")))
       (TeX-run-style-hooks opt)))

   (when (or (LaTeX-provided-class-options-member "standalone" "multi")
             (LaTeX-provided-class-options-member "standalone" "multi=true"))
        (TeX-arg-eval mapconcat #'identity
                       (TeX-argument-prompt nil nil "Environment(s)")

   (when (or (LaTeX-provided-class-options-member "standalone" "beamer")
             (LaTeX-provided-class-options-member "standalone" "beamer=true"))

   ;; Fontification
   (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("standaloneenv" "{"))

(defun LaTeX-standalone-class-options ()
  "Read class options for standalone document class."
  (TeX-read-key-val t `(("class"
                         ,(or LaTeX-global-class-files
                              (let ((TeX-file-extensions '("cls")))
                                    (message "Searching for LaTeX classes...")
                                    (TeX-search-files-by-type 'texinputs 
'global t t)
                                  (message "Searching for LaTeX 
                        ("crop" ("true" "false"))
                        ("preview" ("true" "false"))
                         ("true" "false"
                          ,@(mapcar #'car (LaTeX-environment-list))))
                         ("true" "false"
                          ,@(mapcar (lambda (x)
                                      (concat TeX-esc (car x)))
                        ("ignorerest" ("true" "false"))
                        ("multido" ("true" "false"))
                        ("tikz" ("true" "false"))
                        ("pstricks" ("true" "false"))
                        ("beamer" ("true" "false"))
                        ("float" ("true" "false"))
                        ("convert" ("true" "false"))

(defun LaTeX-standalone-package-options ()
  "Read package options for standalone package."
  (TeX-read-key-val t
                    '(("subpreambles" ("true" "false"))
                      ("sort" ("true" "false"))
                      ("print" ("true" "false"))
                      ("comments" ("true" "false"))
                      ("group" ("true" "false"))
                      ("mode" ("tex" "image" "build"
                               "buildmissing" "buildnew"))
                      ("obeyclassoptions" ("true" "false"))
                      ("extension" (".pdf" ".eps"))
--8<---------------cut here---------------end--------------->8---

Best, Arash

reply via email to

[Prev in Thread] Current Thread [Next in Thread]