summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-11-27 12:07:11 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-11-27 12:07:11 +0100
commit289363d51023b7ed785dabe7e68ac81d45539cdf (patch)
treeb882ed2bef6919dff2c84556b7d3efd0c070caa7
parentee7721f795aa5a2ff5c14dd59cbe8ab58ceeefc1 (diff)
downloadorg-mode-289363d51023b7ed785dabe7e68ac81d45539cdf.tar.gz
Fix LaTeX preview
* lisp/org.el (org-compile-file): Introduce new %O placeholder. (org-preview-latex-process-alist): Use it. * lisp/ox-latex.el (org-latex-pdf-process): * lisp/ox-man.el (org-man-pdf-process): * lisp/ox-texinfo.el (org-texinfo-info-process): Document it. Reported-by: Scott Otterson <scotto@sharpleaf.org> <http://permalink.gmane.org/gmane.emacs.orgmode/110464>
-rw-r--r--lisp/org.el35
-rw-r--r--lisp/ox-latex.el11
-rw-r--r--lisp/ox-man.el8
-rw-r--r--lisp/ox-texinfo.el11
4 files changed, 38 insertions, 27 deletions
diff --git a/lisp/org.el b/lisp/org.el
index d791bd9..de510ed 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4092,7 +4092,7 @@ All available processes and theirs documents can be found in
:image-output-type "png"
:image-size-adjust (1.0 . 1.0)
:latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
- :image-converter ("dvipng -fg %F -bg %B -D %D -T tight -o %o%b.png %f"))
+ :image-converter ("dvipng -fg %F -bg %B -D %D -T tight -o %O %f"))
(dvisvgm
:programs ("latex" "dvisvgm")
:description "dvi > svg"
@@ -4102,7 +4102,7 @@ All available processes and theirs documents can be found in
:image-output-type "svg"
:image-size-adjust (1.7 . 1.5)
:latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
- :image-converter ("dvisvgm %f -n -b min -c %S -o %o%b.svg"))
+ :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))
(imagemagick
:programs ("latex" "convert")
:description "pdf > png"
@@ -4113,7 +4113,7 @@ All available processes and theirs documents can be found in
:image-size-adjust (1.0 . 1.0)
:latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f")
:image-converter
- ("convert -density %D -trim -antialias %f -quality 100 %o%b.png")))
+ ("convert -density %D -trim -antialias %f -quality 100 %O")))
"Definitions of external processes for LaTeX previewing.
Org mode can use some external commands to generate TeX snippet's images for
previewing or inserting into HTML files, e.g., \"dvipng\". This variable tells
@@ -4156,9 +4156,10 @@ PROPERTIES accepts the following attributes:
Place-holders used by `:image-converter' and `:latex-compiler':
- %f input file name.
- %b base name of input file.
- %o base directory of input file.
+ %f input file name
+ %b base name of input file
+ %o base directory of input file
+ %O absolute output file name
Place-holders only used by `:image-converter':
@@ -22764,11 +22765,12 @@ If PROCESS is a function, it is called with a single argument:
the SOURCE file.
If it is a list of commands, each of them is called using
-`shell-command'. By default, in each command, %b, %f, %F and %o
-are replaced with, respectively, SOURCE base name, name, full
-name and directory. It is possible, however, to use more
-place-holders by specifying them in optional argument SPEC, as an
-alist following the pattern (CHARACTER . REPLACEMENT-STRING).
+`shell-command'. By default, in each command, %b, %f, %F, %o and
+%O are replaced with, respectively, SOURCE base name, name, full
+name, directory and absolute output file name. It is possible,
+however, to use more place-holders by specifying them in optional
+argument SPEC, as an alist following the pattern (CHARACTER
+. REPLACEMENT-STRING).
When PROCESS is a list of commands, optional argument LOG-BUF can
be set to a buffer or a buffer name. `shell-command' then uses
@@ -22776,6 +22778,7 @@ it for output."
(let* ((base-name (file-name-base source))
(full-name (file-truename source))
(out-dir (file-name-directory source))
+ (output (expand-file-name (concat base-name "." ext) out-dir))
(time (current-time))
(err-msg (if (stringp err-msg) (concat ". " err-msg) "")))
(save-window-excursion
@@ -22787,16 +22790,16 @@ it for output."
`((?b . ,(shell-quote-argument base-name))
(?f . ,(shell-quote-argument source))
(?F . ,(shell-quote-argument full-name))
- (?o . ,(shell-quote-argument out-dir))))))
+ (?o . ,(shell-quote-argument out-dir))
+ (?O . ,(shell-quote-argument output))))))
(dolist (command process)
(shell-command (format-spec command spec) log-buf))))
(_ (error "No valid command to process %S%s" source err-msg))))
;; Check for process failure. Output file is expected to be
;; located in the same directory as SOURCE.
- (let ((output (expand-file-name (concat base-name "." ext) out-dir)))
- (unless (org-file-newer-than-p output time)
- (error (format "File %S wasn't produced%s" output err-msg)))
- output)))
+ (unless (org-file-newer-than-p output time)
+ (error (format "File %S wasn't produced%s" output err-msg)))
+ output))
;;; Indentation
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 39364c4..aecbb32 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1145,12 +1145,15 @@ A better approach is to use a compiler suit such as `latexmk'."
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f")
"Commands to process a LaTeX file to a PDF file.
+
This is a list of strings, each of them will be given to the
shell as a command. %f in the command will be replaced by the
-full file name, %b by the file base name (i.e. without directory
-and extension parts), %o by the base directory of the file,
-%latex is the LaTeX compiler (see `org-latex-compiler'), and %bib
-is the BibTeX-like compiler (see `org-latex-bib-compiler').
+relative file name, %F by the absolute file name, %b by the file
+base name (i.e. without directory and extension parts), %o by the
+base directory of the file, %O by the absolute file name of the
+output file, %latex is the LaTeX compiler (see
+`org-latex-compiler'), and %bib is the BibTeX-like compiler (see
+`org-latex-bib-compiler').
The reason why this is a list is that it usually takes several
runs of `pdflatex', maybe mixed with a call to `bibtex'. Org
diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index 4e2bfc7..324d5a7 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -208,11 +208,13 @@ in this list - but it does not hurt if it is present."
"tbl %f | eqn | groff -man | ps2pdf - > %b.pdf")
"Commands to process a Man file to a PDF file.
+
This is a list of strings, each of them will be given to the
shell as a command. %f in the command will be replaced by the
-full file name, %b by the file base name (i.e. without directory
-and extension parts) and %o by the base directory of the file.
-
+relative file name, %F by the absolute file name, %b by the file
+base name (i.e. without directory and extension parts), %o by the
+base directory of the file and %O by the absolute file name of
+the output file.
By default, Org uses 3 runs of to do the processing.
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index cf9cc2f..ab61b6b 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -346,10 +346,13 @@ The function should return the string to be exported."
(defcustom org-texinfo-info-process '("makeinfo %f")
"Commands to process a Texinfo file to an INFO file.
-This is list of strings, each of them will be given to the shell
-as a command. %f in the command will be replaced by the full
-file name, %b by the file base name (i.e without extension) and
-%o by the base directory of the file."
+
+This is a list of strings, each of them will be given to the
+shell as a command. %f in the command will be replaced by the
+relative file name, %F by the absolute file name, %b by the file
+base name (i.e. without directory and extension parts), %o by the
+base directory of the file and %O by the absolute file name of
+the output file."
:group 'org-export-texinfo
:type '(repeat :tag "Shell command sequence"
(string :tag "Shell command")))