Hi Jean,
>>>>> jfbu <[email protected]> writes:
>> I have not looked up in detail (I am still with gs 9.26, and besides I
>> do not use that much the preview functionality -- hope that is pardonable),
>> but this small tex file
>>
>> \documentclass{article}
>> \AtBeginDocument{\RequirePackage{color}\pagecolor{yellow}\color{red}}
>> \begin{document}
>> \[E = mc^2\]
>> \end{document}
>>
>> works as expected, hence it seems it is quite feasible to alter the PDF
>> production as suggested by Ken.
> Ah sorry for noise. Problem with fuller example actually using
> \PassOptionsToPackage{active,tightpage,auctex}{preview}\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]
> is as I should have expected that the ccolor ommands outside
> the display math mode are not executed.
Thanks, I was trying similar approach. The attached patch #1 (just
adding initial TeX codes at execution of pdflatex) works only partially.
Though the background turns its color as expected, the foreground color
isn't affected.
The situation changes by further modification in preview.sty with the
attached patch #2, which uncomments two lines. Together with the above
patch #1, my intent of setting both the foreground and background colors
are reflected in the outcome of preview-latex.
However, these two lines in preview.sty (actually in preview.dtx) were
commmented out at this commit:
----------------------------------------------------------------------
5dc76f79d0fff44794262037b93f0533af78f805
Author: David Kastrup <[email protected]>
AuthorDate: Mon Jan 20 00:09:00 2003 +0000
(subsection{The internals}): comment out color
setup. That means that one might not be able to use color.sty for
setting up fore/background color, but it will also mean that
loading color.sty does not interfere with the initial colors set
up inside of GhostScript. In the long run, we will have to solve
this differently.
----------------------------------------------------------------------
If the situation of Ghostscript mentioned in the above commit message
hasn't changed during this 16 years, the patch #2 would lose at some
complicated situation.
I hope that David comments on this issue. In particular, I'd like to
know, or to know to how to judge, whether "the initial colors set up
inside of Ghostscript" still interfere with color.sty or not.
> Now, it seems the solution will come from extending preview.sty
> package with two new options pagecolor and forecolor in key-value
> syntax. Or simply add some macro to its interface no need to actually
> plunge into its option handling.
> I trust it can then be modified to produce the displaymath and textmath
> in a manner which will activate the \pagecolor and \color.
> (there might possibly be some thorny interference with tightpage)
It may be a good idea to introduce those two new options or some macro.
In that case, the required changes should be installed at the
neighborhood of the above two lines in preview.sty (or preview.dtx.)
Regards,
Ikumi Keita
--- preview.el~ 2019-06-22 22:15:33.280789000 +0900
+++ preview.el 2019-06-22 23:27:50.561977000 +0900
@@ -742,48 +742,52 @@
to Ghostscript floats."
(format "%g" (/ value 65535.0)))
+;; (defun preview-pdf-color-string (colors)
+;; "Return a string that patches PDF foreground color to work properly."
+;; ;; Actually, this is rather brutal. It will only be invoked in
+;; ;; cases, however, where previously it was not expected that
+;; ;; anything readable turned up, anyway.
+;; (let ((fg (aref colors 1)))
+;; (if fg
+;; (concat
+;; "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\
+;; /graphicsbeginpage{//graphicsbeginpage exec "
+;; (mapconcat #'preview-gs-color-value fg " ")
+;; " 3 copy rg RG}bind store end readonly store "))))
(defun preview-pdf-color-string (colors)
- "Return a string that patches PDF foreground color to work properly."
- ;; Actually, this is rather brutal. It will only be invoked in
- ;; cases, however, where previously it was not expected that
- ;; anything readable turned up, anyway.
- (let ((fg (aref colors 1)))
- (if fg
- (concat
- "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\
-/graphicsbeginpage{//graphicsbeginpage exec "
- (mapconcat #'preview-gs-color-value fg " ")
- " 3 copy rg RG}bind store end readonly store "))))
+ "" "")
+;; (defun preview-gs-color-string (colors)
+;; "Return a string setting up colors"
+;; (let ((bg (aref colors 0))
+;; (fg (aref colors 1))
+;; (mask (aref colors 2))
+;; (border (aref colors 3)))
+;; (concat
+;; (and (or (and mask border) (and bg (not fg)))
+;; "gsave ")
+;; (and bg
+;; (concat
+;; (mapconcat #'preview-gs-color-value bg " ")
+;; " setrgbcolor clippath fill "))
+;; (and mask border
+;; (format "%s setrgbcolor false setstrokeadjust %g \
+;; setlinewidth clippath strokepath \
+;; matrix setmatrix true \
+;; {2 index{newpath}if round exch round exch moveto pop false}\
+;; {round exch round exch lineto}{curveto}{closepath}\
+;; pathforall pop fill "
+;; (mapconcat #'preview-gs-color-value mask " ")
+;; (* 2 border)))
+;; ;; I hate antialiasing. Warp border to integral coordinates.
+;; (and (or (and mask border) (and bg (not fg)))
+;; "grestore ")
+;; (and fg
+;; (concat
+;; (mapconcat #'preview-gs-color-value fg " ")
+;; " setrgbcolor")))))
(defun preview-gs-color-string (colors)
- "Return a string setting up colors"
- (let ((bg (aref colors 0))
- (fg (aref colors 1))
- (mask (aref colors 2))
- (border (aref colors 3)))
- (concat
- (and (or (and mask border) (and bg (not fg)))
- "gsave ")
- (and bg
- (concat
- (mapconcat #'preview-gs-color-value bg " ")
- " setrgbcolor clippath fill "))
- (and mask border
- (format "%s setrgbcolor false setstrokeadjust %g \
-setlinewidth clippath strokepath \
-matrix setmatrix true \
-{2 index{newpath}if round exch round exch moveto pop false}\
-{round exch round exch lineto}{curveto}{closepath}\
-pathforall pop fill "
- (mapconcat #'preview-gs-color-value mask " ")
- (* 2 border)))
- ;; I hate antialiasing. Warp border to integral coordinates.
- (and (or (and mask border) (and bg (not fg)))
- "grestore ")
- (and fg
- (concat
- (mapconcat #'preview-gs-color-value fg " ")
- " setrgbcolor")))))
+ "" "")
(defun preview-dvipng-color-string (colors res)
"Return color setup tokens for dvipng.
@@ -1970,28 +1974,30 @@
(setcar (car file) (list attached (caar file))))
file)
+;; (defun preview-delete-file (file)
+;; "Delete a preview FILE.
+;; See `preview-make-filename' for a description of the data
+;; structure. If the containing directory becomes empty,
+;; it gets deleted as well."
+;; (let ((filename
+;; (if (consp (car file))
+;; (and (zerop
+;; (setcdr (car file) (1- (cdr (car file)))))
+;; (car (car file)))
+;; (car file))))
+;; (if filename
+;; (unwind-protect
+;; (if (listp filename)
+;; (dolist (elt filename) (delete-file elt))
+;; (delete-file filename))
+;; (let ((tempdir (cdr file)))
+;; (when tempdir
+;; (if (> (nth 2 tempdir) 1)
+;; (setcar (nthcdr 2 tempdir) (1- (nth 2 tempdir)))
+;; (setcdr file nil)
+;; (delete-directory (nth 0 tempdir)))))))))
(defun preview-delete-file (file)
- "Delete a preview FILE.
-See `preview-make-filename' for a description of the data
-structure. If the containing directory becomes empty,
-it gets deleted as well."
- (let ((filename
- (if (consp (car file))
- (and (zerop
- (setcdr (car file) (1- (cdr (car file)))))
- (car (car file)))
- (car file))))
- (if filename
- (unwind-protect
- (if (listp filename)
- (dolist (elt filename) (delete-file elt))
- (delete-file filename))
- (let ((tempdir (cdr file)))
- (when tempdir
- (if (> (nth 2 tempdir) 1)
- (setcar (nthcdr 2 tempdir) (1- (nth 2 tempdir)))
- (setcdr file nil)
- (delete-directory (nth 0 tempdir)))))))))
+ "" nil)
(defvar preview-buffer-has-counters nil)
(make-variable-buffer-local 'preview-buffer-has-counters)
@@ -2215,7 +2221,8 @@
(defcustom preview-LaTeX-command '("%`%l \"\\nonstopmode\\nofiles\
\\PassOptionsToPackage{" ("," . preview-required-option-list) "}{preview}\
-\\AtBeginDocument{\\ifx\\ifPreview\\undefined"
+\\AtBeginDocument{\\RequirePackage{color}\\color{white}\\pagecolor{red}\
+\\ifx\\ifPreview\\undefined"
preview-default-preamble "\\fi}\"%' \"{\\detokenize{\" %t \"}}\"")
;; Since TeXLive 2018, the default encoding for LaTeX files has been
;; changed to UTF-8 if used with classic TeX or pdfTeX. I.e.,
--- preview.sty~ 2019-06-23 19:00:15.562770000 +0900
+++ preview.sty 2019-06-22 23:53:13.815070000 +0900
@@ -268,9 +268,9 @@
\splittopskip\z@skip\setbox\z@\vsplit\pr@box to\z@
\unvbox\z@
\nointerlineskip
- %\color@setgroup
+ \color@setgroup
\box\pr@box
- %\color@endgroup
+ \color@endgroup
}%
\pr@ship@end
{\let\protect\noexpand
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel