[XeTeX] Colour specials for XeTeX

Philip Taylor P.Taylor at Hellenic-Institute.Uk
Sun Jun 7 21:33:58 CEST 2020

BPJ wrote:

> Well as everything in a computer program they are defined in the source code.

That is the very antithesis of Dijkstra's position on the subject, and I strongly agree with him !  The behaviour / syntax / semantics are described outside of the program — the program is merely one of many possible realisations of the desired behaviour.

> It is not the first time some feature of a computer program is insufficiently or not at all documented, and probably not the last time either. It is certainly disappointing when you for whatever reason can't figure them out from looking at the source code, but it is also good to keep in mind that the reason some feature is undocumented often is that the developers consider the feature unreliable. The code may be retained either because the developers hope to fix it if and when they figure out how to do it, or because removing it may cause other things to break, so there may be "good" reasons if you can't get them to work as intended or expected. I sincerely hope you find a workaround.

Well, the set of colour \specials in which I am interested appear to have been existence since 1992 or earlier, so if they /were/ unreliable one might think that that would have been noted and reported by now.  But I am delighted to say that having searched the online TUGboar archive, I was able to track down some of the earlier discussion of this set of specials, especially in articles written by Thomas Hafner, and these in turn led me to investigate the documentation for Tom Rokicki's "DVIPS" program ('TeXdoc dvips'), in which, to my great joy, I was able to read :

> 7.6 Color support details
> To support color, Dvips recognizes a certain set of specials. These specials start with the
> keyword ‘color’ or the keyword ‘background’, followed by a color specification.
> 7.6.1 Color specifications [...]
> 7.6.2 Color specials
> We will describe ‘background’ first, since it is the simplest. The ‘background’ keyword
> must be followed by a color specification. That color specification is used as a fill color for
> the background. The last ‘background’ special on a page is the one that gets issued, and
> it gets issued at the very beginning of the page, before any text or specials are sent. (This
> is possible because the prescan phase of Dvips notices all of the color specials so that the
> appropriate information can be written out during the second phase.)
> The ‘color’ special itself has three forms. The first is just ‘color’ followed by a color
> specification. In this case, the current global color is set to that color; the color stack must
> be empty when such a command is executed.
> The second form is ‘color push’ followed by a color specification. This saves the current
> color on the color stack and sets the color to be that given by the color specification. This
> is the most common way to set a color.
> The final version of the ‘color’ special is just ‘color pop’, with no color specification;
> this says to pop the color last pushed on the color stack from the color stack and set the
> current color to be that color.

It would therefore seem that [x]dvipdfm[x] supports (at least) the same set of colour \specials as did/does Tom Rokicki's "DVIPS"
and thus the documentation for the latter can serve as reference for the former.

/Philip Taylor/

More information about the XeTeX mailing list.