emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Bug: org-preview-latex-fragment does not work with pygmentize (-shel


From: Arne Babenhauserheide (IMK)
Subject: [O] Bug: org-preview-latex-fragment does not work with pygmentize (-shell-escape missing) [with patch] [7.8.11]
Date: Wed, 12 Sep 2012 10:19:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120828 Thunderbird/14.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
- ------------------------------------------------------------------------

Dear org hackers,

When using the minted package, latex requires the -shell-escape argument
to call pygmentize. Due to this, org-preview-latex-fragment fails for me
(used via C-c C-x C-l).

If I change the function org-create-formula-image to call latex with
- -shell-escape, it works for me.

In MikTex --enable-write18 should do the same.

Note, though, that -shell-escape is disabled for security
reasons, since it can call arbitrary code (
http://scrolls.mafgani.net/2011/03/latex-shell-escape/ )

The reason why texmf does not activate shell-escape for pygmentize by
default is

    % pygmentize - but is the filter feature insecure?
    ? /etc/texmf/web2c/texmf.cnf
    ? info: http://pygments.org/docs/filters/

I think the best solution would be to check pygmentize, maybe define a
subset of the functionality (without the filters) and get it into
the shell_escape_commands (setting it myself did not work for me?).

But since that is not readily accessible, I adapted the preview function
instead:

diff -u /usr/share/emacs/site-lisp/org-mode/org.el /home/arne/org.el.new
- --- /usr/share/emacs/site-lisp/org-mode/org.el        2012-05-25
23:12:51.000000000 +0200
+++ /home/arne/org.el.new       2012-09-12 09:37:00.788632982 +0200
@@ -17075,7 +17075,7 @@
       (condition-case nil
          (progn
            (cd tmpdir)
- -         (call-process "latex" nil nil nil texfile))
+           (call-process "latex" nil nil nil "-shell-escape" texfile))
        (error nil))
       (cd dir))
     (if (not (file-exists-p dvifile))

Best wishes,
Arne

Emacs  : GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-07-10 on imkpcghg
Package: Org-mode version 7.8.11

current state:
==============
(setq
 org-ditaa-jar-path "~/.emacs.d/private/org/ditaa0_9/ditaa0_9.jar"
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-export-latex-listings 'minted
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-agenda-custom-commands '(("o" "Agenda and TODOs"
                               ((tags "KANBAN") (agenda nil) (todo ""
"~/plan.org")))
                              )
 org-agenda-files '("~/plan.org")
 org-agenda-include-diary t
 org-babel-load-languages '((python . t) (sh . t) (emacs-lisp . t)
(ditaa . t) (dot . t)
                            (C . t) (R . t) (gnuplot . t) (org . t))
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-tangle-lang-exts '(("C++" . "cpp") ("python" . "py")
("emacs-lisp" . "el"))
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-agenda-skip-scheduled-if-done t
 org-latex-to-pdf-process '("pdflatex -interaction nonstopmode
- -shell-escape -output-directory %o %f" "bibtex $(basename %b)"
"pdflatex -interaction nonstopmode -shell-escape -output-directory %o
%f" "pdflatex -interaction nonstopmode -shell-escape -output-directory
%o %f")
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
                      org-babel-hide-result-toggle-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-export-latex-packages-alist '(("" "color") ("" "minted"))
 org-default-notes-file "~/.emacs.d/private/org/emacs-remember-mode.org"
 org-directory "~/.emacs.d/private/org"
 outline-mode-hook '((lambda nil (require (quote outline-magic))))
 org-babel-pre-tangle-hook '(save-buffer)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
                  org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
 org-export-latex-classes '(("article" "\\documentclass[11pt]{scrartcl}"
                             ("\\section{%s}" . "\\section*{%s}")
                             ("\\subsection{%s}" . "\\subsection*{%s}")
                             ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
                             ("\\paragraph{%s}" . "\\paragraph*{%s}")
                             ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
                            ("report" "\\documentclass[11pt]{scrreprt}"
                             ("\\part{%s}" . "\\part*{%s}")
                             ("\\chapter{%s}" . "\\chapter*{%s}")
                             ("\\section{%s}" . "\\section*{%s}")
                             ("\\subsection{%s}" . "\\subsection*{%s}")
                             ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
                             ("\\paragraph{%s}" . "\\paragraph*{%s}")
                             ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
                            ("book" "\\documentclass[11pt]{scrbook}"
                             ("\\part{%s}" . "\\part*{%s}")
                             ("\\chapter{%s}" . "\\chapter*{%s}")
                             ("\\section{%s}" . "\\section*{%s}")
                             ("\\subsection{%s}" . "\\subsection*{%s}")
                             ("\\subsubsection{%s}" .
"\\subsubsection*{%s}"))
                            ("beamer" "\\documentclass{beamer}"
org-beamer-sectioning))
 org-export-preprocess-before-normalizing-links-hook
'(org-remove-file-link-modifiers)
 org-mode-hook '(org-mode-reftex-setup turn-on-font-lock
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook
org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-extend-today-until 4
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-start-on-weekday nil
 org-export-interblocks '((src org-babel-exp-non-block-elements))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-agenda-skip-deadline-if-done t
 org-occur-hook '(org-first-headline-recenter)
 org-from-is-user-regexp nil
 org-export-preprocess-before-selecting-backend-code-hook
'(org-beamer-select-beamer-code)
 outline-minor-mode-hook '((lambda nil (require (quote outline-magic)))
                           (lambda nil (require (quote outline-magic))
                            (define-key outline-minor-mode-map [(f10)]
(quote outline-cycle)))
                           )
 org-remember-templates '(("todo" 116 "?: %?\n"
"~/.emacs.d/private/org/emacs-plan.org" nil
                           nil)
                          ("Note" 110 "%?\n" nil nil nil))
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
                               org-beamer-auto-fragile-frames
                               org-beamer-place-default-actions-for-lists)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-abbrev-alist '(("bib" . "~/aufschriebe/ref.bib::%s")
                         ("notes" . "~/aufschriebe/papers.org::#%s")
                         ("papers" . "~/aufschriebe/papers/%s.pdf"))
 org-export-blocks '((src org-babel-exp-src-block nil)
                     (export-comment org-export-blocks-format-comment t)
                     (ditaa org-export-blocks-format-ditaa nil)
                     (dot org-export-blocks-format-dot nil))
 )
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQUEWuAAoJEFyD82SnDaCe/iUH/jpWM1lhyQb55Os9zjqe5eza
31h/MkAE3a6UgB6vRkU6oJrO3r0xLDHjTFyElrQGINzqpkzDdwfY1owMYtYgmhqk
IxE5f2XoWTjEa6zjgLHCG6kjIfxabbuTH5pz2XKe38nXkZGg5/Abkokp4onz/l88
y0j0AIe+NdRDLIZDW+AiG59AlX9Wzb7LXklkbrigmk6fIVBhO16qgVQCk6VQLwSM
BXPB8huIAZxWqlHq+kpj+Qjjqfd6CBwTipq0wpGWOvsiA6HiMV8rl0gnN84JGrGq
s3HI6cgl3ejOmGhWfPkeRMrZNcUYjuhtA2d/vcs7qClvZBph3dsb8oFiKITZGEg=
=HSki
-----END PGP SIGNATURE-----



reply via email to

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