auctex-devel
[Top][All Lists]

## [AUCTeX-devel] Try to colorize preview (was Re: Asking help for preview-

 From: Ikumi Keita Subject: [AUCTeX-devel] Try to colorize preview (was Re: Asking help for preview-latex) Date: Sun, 23 Jun 2019 20:08:36 +0900

Hi Jean,

>> 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
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
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



patch-preview-el
Description: patch #1

patch-preview-sty
Description: patch #2