[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa adf998c 25/51: Replace TeX-PDF-via-dvips-ps2pdf with TeX-PDF
From: |
Tassilo Horn |
Subject: |
[elpa] elpa adf998c 25/51: Replace TeX-PDF-via-dvips-ps2pdf with TeX-PDF-from-DVI |
Date: |
Sun, 22 May 2016 07:22:49 +0000 (UTC) |
branch: elpa
commit adf998c2ce482c62d15d2f72dac9097ca27edc55
Author: Mosè Giordano <address@hidden>
Commit: Mosè Giordano <address@hidden>
Replace TeX-PDF-via-dvips-ps2pdf with TeX-PDF-from-DVI
* tex.el (TeX-command-list): Add Dvipdfmx.
(TeX-expand-list-builtin): Use `TeX-PDF-from-DVI' in place of
`TeX-PDF-via-dvips-ps2pdf'.
(TeX-PDF-from-DVI): New safe buffer-local and customizable variable.
(TeX-PDF-via-dvips-ps2pdf): Mark as obsolete.
(TeX-toggle-PDF-via-dvips-ps2pdf): Remove function.
(TeX-PDF-from-DVI): New function.
(TeX-mode-specific-command-menu-entries): Update menu to convert DVI to
PDF.
* tex-buf.el (TeX-command-default, TeX-run-set-command,
TeX-TeX-sentinel, TeX-TeX-sentinel-check, TeX-LaTeX-sentinel,
TeX-dvips-sentinel, TeX-ps2pdf-sentinel): Use `TeX-PDF-from-DVI' in
place of `TeX-PDF-via-dvips-ps2pdf'.
(TeX-run-dvipdfmx, TeX-dvipdfmx-sentinel): New function.
():
* doc/auctex.texi (Processor Options): Document `TeX-PDF-from-DVI' and
remove mentions to `TeX-PDF-via-dvips-ps2pdf'
* doc/changes.texi: Mention `TeX-PDF-from-DVI'.
---
doc/auctex.texi | 48 +++++++++++++++++++++----------
doc/changes.texi | 26 +++++++++++------
tex-buf.el | 83 ++++++++++++++++++++++++++++++++++++------------------
tex.el | 68 ++++++++++++++++++++++++++++++++++++--------
4 files changed, 163 insertions(+), 62 deletions(-)
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 620076a..cdcb0ac 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2926,23 +2926,41 @@ the document into @acronym{DVI} output. Thus, if you
want a
@acronym{PDF} document in the end you can either use address@hidden engine,
see below for information about how to set engines, or compile the
document with @command{tex} and then convert to @acronym{PDF} with
address@hidden@command{ps2pdf} before viewing it. The latter can be
-done automatically in @AUCTeX{} by setting the
address@hidden variable to a non-nil value.
-
address@hidden TeX-PDF-via-dvips-ps2pdf
-With @code{TeX-PDF-mode} set to non-nil, if
address@hidden is non-nil too, the document is compiled
-with @command{tex} (or @command{latex}) instead of @command{pdftex} (or
address@hidden). When the document is ready, @kbd{C-c C-c} will
-suggest to run @command{dvips} and then @command{ps2pdf} in order to
-convert the @acronym{DVI} file to @acronym{PDF}. When the @acronym{PDF}
-file is finally ready, the next suggested command will be to open the
-viewer.
address@hidden@command{ps2pdf} before viewing it. In addition, most
+documents written in Japanese are compiled with @command{tex} or
address@hidden (not their @command{pdf} variants) and then converted to
address@hidden with @command{dvipdfmx}. You can use the
address@hidden variable to let @AUCTeX{} know you want to
+generate the final @acronym{PDF} by converting a @acronym{DVI} file.
+
address@hidden TeX-PDF-from-DVI
+This option controls if and how to produce a @acronym{PDF} file by
+converting a @acronym{DVI} file.
+
+When @code{TeX-PDF-mode} is non-nil, if @code{TeX-PDF-from-DVI} is
+non-nil too the document is compiled with @command{tex} (or
address@hidden) instead of @command{pdftex} (or @command{pdflatex}).
+When the document is ready, @kbd{C-c C-c} will suggest to run the
+command indicated by @code{TeX-PDF-from-DVI}.
+
+If non-nil, @code{TeX-PDF-from-DVI} should be the name of the command,
+as a string, used to convert the @acronym{DVI} file to @acronym{PDF} or
+to an intermediate type. Values currently supported are:
address@hidden
address@hidden
address@hidden"Dvips"}: the @acronym{DVI} file is converted to @acronym{PS} with
address@hidden After successfully running it, @command{ps2pdf} will
+be the default command to convert the @acronym{PS} file to
address@hidden
address@hidden
address@hidden"Dvipdfmx"}: the @acronym{DVI} file is converted to @acronym{PDF}
+with @command{dvipdfmx}.
address@hidden itemize
+When the @acronym{PDF} file is finally ready, the next suggested command
+will be to open the viewer.
This option can also be set as a file local variable, in order to use
-the sequence @address@hidden@command{ps2pdf} on a
-per-document basis.
+this conversion on a per-document basis.
Recall the whole sequence of @kbd{C-c C-c} commands can be replace by
the single @kbd{C-c C-a}.
diff --git a/doc/changes.texi b/doc/changes.texi
index 9d36f09..d819cc0 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -35,13 +35,22 @@ after compilation of the document.
@end ifclear
@item
-Added support for Atril viewer. Forward and inverse search requires
-version 1.9.1 or later to work.
+A new option, @code{TeX-PDF-from-DVI}, controls if and how to produce a
address@hidden file by converting a @acronym{DVI} file. This supersedes
address@hidden which is still recognized but marked as
+obsolete and may be removed in future releases.
@item
-Added support for dviout viewer on Windows. Note that this setup works
-when @code{TeX-source-correlate-method} is set to use
address@hidden for @acronym{DVI}, e.g.:
+Support for a number of external viewers has been addedd:
address@hidden
address@hidden
+Atril viewer. Forward and inverse search requires version 1.9.1 or
+later to work.
+
address@hidden
+dviout viewer on Windows. Note that this setup works when
address@hidden is set to use @samp{source-specials}
+for @acronym{DVI}, e.g.:
@lisp
(setq TeX-source-correlate-method
'((dvi . source-specials)
@@ -50,11 +59,12 @@ when @code{TeX-source-correlate-method} is set to use
which is the default.
@item
-Added support for SumatraPDF viewer on Windows.
+SumatraPDF viewer on Windows.
@item
-Added support for Zathura viewer. Forward and inverse search requires a
-recent version of the program to work (3.4 or later).
+Zathura viewer. Forward and inverse search requires a recent version of
+the program to work (3.4 or later).
address@hidden itemize
@item
A new function, @code{TeX-documentation-texdoc}, for reading
diff --git a/tex-buf.el b/tex-buf.el
index c9cda7d..f3a83d2 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -786,7 +786,7 @@ omitted) and `TeX-region-file'."
;; We should check for bst files here as well.
(if LaTeX-using-Biber TeX-command-Biber TeX-command-BibTeX))
((and
- ;; Rational: makeindex should be run when final document is almost
+ ;; Rationale: makeindex should be run when final document is almost
;; complete (see
;;
http://tex.blogoverflow.com/2012/09/dont-forget-to-run-makeindex/),
;; otherwise, after following latex runs, index pages may change due
@@ -797,10 +797,9 @@ omitted) and `TeX-region-file'."
(TeX-process-get-variable
name
'TeX-command-next
- (if (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode)
- "Dvips"
- TeX-command-Show)))
- (list "Dvips" TeX-command-Show))
+ (or (and TeX-PDF-mode (TeX-PDF-from-DVI))
+ TeX-command-Show)))
+ (list "Dvips" "Dvipdfmx" TeX-command-Show))
(cdr (assoc (expand-file-name (concat name ".idx"))
LaTeX-idx-changed-alist)))
"Index")
@@ -1009,7 +1008,7 @@ Return the new process."
"Remember TeX command to use to NAME and set corresponding output extension."
(setq TeX-command-default name
TeX-output-extension
- (if (and (null TeX-PDF-via-dvips-ps2pdf) TeX-PDF-mode) "pdf" "dvi"))
+ (if (and (null (TeX-PDF-from-DVI)) TeX-PDF-mode) "pdf" "dvi"))
(let ((case-fold-search t)
(lst TeX-command-output-list))
(while lst
@@ -1121,6 +1120,14 @@ run of `TeX-run-TeX', use
process
(TeX-synchronous-sentinel name file process))))
+(defun TeX-run-dvipdfmx (name command file)
+ "Create a process for NAME using COMMAND to convert FILE with dvipdfmx."
+ (let ((process (TeX-run-command name command file)))
+ (setq TeX-sentinel-function #'TeX-dvipdfmx-sentinel)
+ (if TeX-process-asynchronous
+ process
+ (TeX-synchronous-sentinel name file process))))
+
(defun TeX-run-ps2pdf (name command file)
"Create a process for NAME using COMMAND to convert FILE with ps2pdf."
(let ((process (TeX-run-command name command file)))
@@ -1363,10 +1370,11 @@ errors or warnings to show."
(TeX-master-directory)))
(TeX-error-overview)))
(message (concat name ": formatted " (TeX-current-pages)))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show))))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show)))))
(defun TeX-current-pages ()
"Return string indicating the number of pages formatted."
@@ -1423,10 +1431,11 @@ Return nil ifs no errors were found."
'TeX-current-master))
t))
t)
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show)))
nil))
;; This regexp should catch warnings of the type
@@ -1518,18 +1527,20 @@ Rerun to get outlines right" nil t)
((re-search-forward "^LaTeX Warning: Reference" nil t)
(message "%s%s%s" name ": there were unresolved references, "
(TeX-current-pages))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show)))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show))))
((re-search-forward "^\\(?:LaTeX Warning: Citation\\|\
Package natbib Warning:.*undefined citations\\)" nil t)
(message "%s%s%s" name ": there were unresolved citations, "
(TeX-current-pages))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show)))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show))))
((re-search-forward "Package longtable Warning: Table widths have \
changed\\. Rerun LaTeX\\." nil t)
(message
@@ -1555,10 +1566,11 @@ Rerun to get mark in right position\\." nil t)
")"))))
(message "%s" (concat name ": successfully formatted "
(TeX-current-pages) add-info)))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show)))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show))))
(t
(message "%s%s%s" name ": problems after " (TeX-current-pages))
(setq TeX-command-next TeX-command-default)))
@@ -1643,11 +1655,26 @@ Rerun to get mark in right position\\." nil t)
"\\<TeX-mode-map>\\[TeX-recenter-output-buffer]")))
(t
(if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
+ (and (equal (TeX-PDF-from-DVI) "Dvips") TeX-PDF-mode))
(setq TeX-output-extension "ps"
TeX-command-next "Ps2pdf"))
(message "Dvips finished successfully. "))))
+(defun TeX-dvipdfmx-sentinel (_process _name)
+ "Cleanup TeX output buffer after running dvipdfmx."
+ (goto-char (point-max))
+ (cond
+ ((search-backward "TeX Output exited abnormally" nil t)
+ (message "Dvipdfmx failed. Type `%s' to display output."
+ (substitute-command-keys
+ "\\<TeX-mode-map>\\[TeX-recenter-output-buffer]")))
+ (t
+ (if (with-current-buffer TeX-command-buffer
+ (and (equal (TeX-PDF-from-DVI) "Dvipdfmx") TeX-PDF-mode))
+ (setq TeX-output-extension "pdf"
+ TeX-command-next TeX-command-Show))
+ (message "Dvipdfmx finished successfully. "))))
+
(defun TeX-ps2pdf-sentinel (_process _name)
"Cleanup TeX output buffer after running ps2pdf."
(goto-char (point-max))
@@ -1658,7 +1685,7 @@ Rerun to get mark in right position\\." nil t)
"\\<TeX-mode-map>\\[TeX-recenter-output-buffer]")))
(t
(if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
+ (and (equal (TeX-PDF-from-DVI) "Dvips") TeX-PDF-mode))
(setq TeX-command-next TeX-command-Show
TeX-output-extension "pdf"))
(message "ps2pdf finished successfully. "))))
diff --git a/tex.el b/tex.el
index cf9faae..43a70fa 100644
--- a/tex.el
+++ b/tex.el
@@ -151,6 +151,8 @@ If nil, none is specified."
:help "Generate PostScript file")
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t
:help "Convert DVI file to PostScript")
+ ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t
+ :help "Convert DVI file to PDF with dvipdfmx")
("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t
:help "Convert PostScript file to PDF")
("Index" "makeindex %s" TeX-run-index nil t
@@ -447,7 +449,7 @@ string."
("%(PDF)" (lambda ()
(if (and (eq TeX-engine 'default)
(if TeX-PDF-mode
- (not TeX-PDF-via-dvips-ps2pdf)
+ (not (TeX-PDF-from-DVI))
TeX-DVI-via-PDFTeX))
"pdf"
"")))
@@ -2123,19 +2125,52 @@ already established, don't do anything."
:group 'TeX-command
:type 'boolean)
+(defcustom TeX-PDF-from-DVI nil
+ "Specify if and how to produce PDF output from a DVI file.
+
+If non-nil, the default compiler produces DVI output. The value
+should be the name of the command used to convert the DVI file to
+PDF or to an intermediate type.
+
+Possible values are
+
+* \"Dvips\": the DVI file is converted to PS with dvips. After
+ successfully running it, ps2pdf will be the default command to
+ convert the PS file to PDF
+* \"Dvipdfmx\": the PDF is produced with dvipdfmx
+
+Programs should not use this variable directly but the function
+`TeX-PDF-from-DVI' which handles now obsolete variable
+`TeX-PDF-via-dvips-ps2pdf'."
+ :group 'TeX-command
+ :type '(choice
+ (const :tag "No DVI to PDF conversion" nil)
+ (const :tag "dvips - ps2pdf sequence" "Dvips")
+ (const :tag "dvipdfmx" "Dvipdfmx")))
+;; If you plan to support new values of `TeX-PDF-from-DVI' remember to update
+;; `TeX-command-default' accordingly.
+(make-variable-buffer-local 'TeX-PDF-from-DVI)
+(put 'TeX-PDF-from-DVI 'safe-local-variable
+ (lambda (x) (or (stringp x) (null x))))
+
(defcustom TeX-PDF-via-dvips-ps2pdf nil
"Whether to produce PDF output through the (La)TeX - dvips - ps2pdf
sequence."
:group 'TeX-command
:type 'boolean)
(make-variable-buffer-local 'TeX-PDF-via-dvips-ps2pdf)
-(put 'TeX-PDF-via-dvips-ps2pdf 'safe-local-variable 'booleanp)
+(put 'TeX-PDF-via-dvips-ps2pdf 'safe-local-variable 'TeX-booleanp)
+(make-obsolete-variable 'TeX-PDF-via-dvips-ps2pdf 'TeX-PDF-from-DVI "11.90")
-(defun TeX-toggle-PDF-via-dvips-ps2pdf ()
- "Toggle `TeX-PDF-via-dvips-ps2pdf'."
- (interactive)
- (setq TeX-PDF-via-dvips-ps2pdf (not TeX-PDF-via-dvips-ps2pdf))
- (message (concat "TeX-PDF-via-dvips-ps2pdf: "
- (if TeX-PDF-via-dvips-ps2pdf "on" "off"))))
+(defun TeX-PDF-from-DVI ()
+ "Return the value of variable `TeX-PDF-from-DVI'.
+
+If `TeX-PDF-from-DVI' is not set and obsolete option
+`TeX-PDF-via-dvips-ps2pdf' is non-nil, return \"dvips-ps2pdf\"
+for backward compatibility."
+ (cond
+ (TeX-PDF-from-DVI)
+ (TeX-PDF-via-dvips-ps2pdf
+ "Dvips")))
(define-minor-mode TeX-interactive-mode
"Minor mode for interactive runs of TeX."
@@ -4960,10 +4995,21 @@ Brace insertion is only done if point is in a math
construct and
:style toggle :selected TeX-PDF-mode
:active (not (eq TeX-engine 'omega))
:help "Use PDFTeX to generate PDF instead of DVI"]
- [ "PDF via dvips + ps2pdf" TeX-toggle-PDF-via-dvips-ps2pdf
- :style toggle :selected TeX-PDF-via-dvips-ps2pdf
+ ( "PDF from DVI"
:visible TeX-PDF-mode
- :help "Compile with (La)TeX and convert to PDF with dvips + ps2pdf"]
+ :help "Compile to DVI with (La)TeX and convert to PDF"
+ [ "Compile directly to PDF"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI nil))
+ :style radio :selected (null (TeX-PDF-from-DVI))
+ :help "Compile directly to PDF without intermediate conversions"]
+ [ "dvips + ps2pdf"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvips"))
+ :style radio :selected (equal (TeX-PDF-from-DVI) "Dvips")
+ :help "Convert DVI to PDF with dvips + ps2pdf sequence"]
+ [ "dvipdfmx"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvipdfmx"))
+ :style radio :selected (equal (TeX-PDF-from-DVI) "Dvipdfmx")
+ :help "Convert DVI to PDF with dvipdfmx"])
[ "Run Interactively" TeX-interactive-mode
:style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i"
:help "Stop on errors in a TeX run"]
- [elpa] elpa 7ea1aa3 18/51: TikZ: Don't allow relative points with \coordinate., (continued)
- [elpa] elpa 7ea1aa3 18/51: TikZ: Don't allow relative points with \coordinate., Tassilo Horn, 2016/05/22
- [elpa] elpa c032063 19/51: Auto save `TeX-command-extra-options'., Tassilo Horn, 2016/05/22
- [elpa] elpa 56c1afd 28/51: Call TeX-newline-function interactively, Tassilo Horn, 2016/05/22
- [elpa] elpa eb9986d 46/51: Respect both "xcolor" and "color" for query to "shadecolor", Tassilo Horn, 2016/05/22
- [elpa] elpa 40c2c26 32/51: Allow for negative offsets in region backward search, Tassilo Horn, 2016/05/22
- [elpa] elpa 9613bdd 36/51: Check TeX engine only once, Tassilo Horn, 2016/05/22
- [elpa] elpa d9910d4 21/51: Fix small errors in doc string and comment, Tassilo Horn, 2016/05/22
- [elpa] elpa 6eb95e6 14/51: Integrate viewer support between tex.el and tex-jp.el, Tassilo Horn, 2016/05/22
- [elpa] elpa e90e050 34/51: Insert braces after some macros and \relax after \ProcessOptions, Tassilo Horn, 2016/05/22
- [elpa] elpa 0a3632e 45/51: Adjust query commands for loading by xcolor.el, Tassilo Horn, 2016/05/22
- [elpa] elpa adf998c 25/51: Replace TeX-PDF-via-dvips-ps2pdf with TeX-PDF-from-DVI,
Tassilo Horn <=
- [elpa] elpa 3e93869 43/51: Add new style/xcolor.el, Tassilo Horn, 2016/05/22
- [elpa] elpa ae6ed8b 06/51: TikZ: make `TeX-TikZ-single-macro-arg' prompt required., Tassilo Horn, 2016/05/22
- [elpa] elpa d83900b 09/51: TikZ: Make '+' and '++' prefixes apply to TikZ points, Tassilo Horn, 2016/05/22
- [elpa] elpa ae6cb79 26/51: Reword documentation of TeX-PDF-from-DVI, Tassilo Horn, 2016/05/22
- [elpa] elpa 1c397d5 29/51: Fix TeX-error-overview-make-entries, Tassilo Horn, 2016/05/22
- [elpa] elpa e092f72 35/51: Use commit date to determine package date, Tassilo Horn, 2016/05/22
- [elpa] elpa 7b41d77 38/51: Adapt for upLaTeX, Tassilo Horn, 2016/05/22
- [elpa] elpa d6b107e 33/51: Improve style/doc.el, Tassilo Horn, 2016/05/22
- [elpa] elpa cf54f7d 49/51: Make ChangeLog UTF-8, Tassilo Horn, 2016/05/22
- [elpa] elpa ebf4b8a 51/51: Release GNU AUCTeX 11.89.4, Tassilo Horn, 2016/05/22