[XeTeX] XeTeX, colour, \special, \shipout

Ross Moore ross.moore at mq.edu.au
Sat Jun 20 01:43:11 CEST 2020


Hi Philip.

On 20 Jun 2020, at 12:08 am, Philip Taylor <P.Taylor at Hellenic-Institute.Uk<mailto:P.Taylor at Hellenic-Institute.Uk>> wrote:

XeTeX does what is expected if one uses \special {background cmyk 0.83 0.82 0.21 0.60} and ships out pages in the normal way; however, if \shipout is invoked directly, the shipped out boxes have a transparent ground.  How should the background colour of boxes which will be shipped out directly be specified ?

You need to understand that “background color” is *not* a basic concept in the PDF graphics model.

see the discussion at this link (and elsewhere), as shown in the image below:
 https://community.adobe.com/t5/acrobat/change-background-color-of-pdf-pages/td-p/8476774?page=1

[cid:8D687DCD-17E3-40C4-BA77-20DB94113AEF at telstra.com.au]


To get it, you need to draw and fill a coloured rectangle of the desired size,
placing it early on the page, or in a layer beneath the main content.

You can use  \vrule  or  \hrule  preceded by a colour  \special  to get this rectangle.

Setting it for use on every page is done in LaTeX, using the  everyshi  package,
to put objects into a box that is accessed during the  \output  routine,
being placed into  \box255  early, but occupying 0 typeset size.
Then the (foreground) contents are copied in (perhaps using \unvbox ?) over the top
of whatever is already there.

With plain XeTeX, the  \special{background … } presumably does something similar,
for use at a particular internal stage of the page-building process.
Presumably it is done by  dvipdfmx , and is not directly applicable to  \shipout .


But if you are going to bypass all that and  \shipout  your own boxes, then you will
have to implement the effect for your own usage – it cannot be expected to come for free.

1. create your coloured (background) rectangle (of the desired size) within a box.
2. set the box’s dimensions to 0 in both width and height+depth.
3. inside a new  \vbox  copy in the background first, then \box  (or \unbox ) the real contents.
4.  \shipout  this newly populated \vbox .

Fill in all the details, to ensure that everything is placed correctly for your needs.



Philip Taylor


Hope this helps.
Stay safe.

Ross


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xetex/attachments/20200619/622b5938/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2020-06-20 at 9.17.47 am.png
Type: image/png
Size: 96471 bytes
Desc: Screen Shot 2020-06-20 at 9.17.47 am.png
URL: <https://tug.org/pipermail/xetex/attachments/20200619/622b5938/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/xetex/attachments/20200619/622b5938/attachment-0003.png>


More information about the XeTeX mailing list.