this post was submitted on 28 Jul 2025
5 points (100.0% liked)

TeX typesetting

193 readers
7 users here now

A place to share ideas, resources, tips, and hacks for Donald Knuths typesetting software TeX. All variants and formats like OpTeX, LaTeX and ConTeXt are welcome.

founded 2 years ago
MODERATORS
 

I want to produce a PDF that looks good on the screen in color. Of course if I do that well with color backgrounds and all, the same document will look lousy when printed on a monochrome laser printer. E.g. consider a text box with color background. The background will go through a dithering algorithm which often enshitifies the text layer on top of that. Likewise on mono e-readers.

In principle, the doc needs two different representations. One for color and one for mono. As rich as the PDF standard is, I don’t think I have ever seen a PDF with multiple modes. So LaTeX aside, does the PDF standard even support this?

I can think of a hack using PDF layers which is supported by the ocgx2 LaTeX package. Color backgrounds could be isolated to a switchable layer. This is not great though because the end user needs to be aware of the layer and must take a manual action to turn off the background layer before printing as black and white. And still, non-black foreground text will print as gray unless foreground text is in a layer too (yikes).

Am I S.O.L?

top 2 comments
sorted by: hot top controversial new old
[–] reactionality 3 points 2 days ago* (last edited 2 days ago) (1 children)

Literally just print as PDF on Windows, you can pick if you want greyscale or coloured... If you want to produce a nice PDF from a markdown document, I recommend the knitr package in RStudio with R, and writing an .Rmd file such that you can just place all your graphs/code/text in it as you write, including LaTeX stuff.

[–] evenwicht 1 points 1 day ago* (last edited 1 day ago)

Literally just print as PDF on Windows, you can pick if you want greyscale or coloured…

That’s a non-starter for the same reason I mention: color backgrounds are dithered and colored text becomes various shades of gray, not black. There are lots of dithering techniques to experiment with and some might yield black text, but if I am producing a PDF I would not want to impose that kind of expertise and experimentation on the end user.

I am asking how to produce a PDF that has a mono mode and a color mode -- and whether that technology even exists. If the PDF is rendered on the screen, it might have color backgrounds. But when printed to a mono device, the color backgrounds should be stripped out (or not, depending on my specification).

If you want to produce a nice PDF from a markdown document, I recommend the knitr package in RStudio with R, and writing an .Rmd file such that you can just place all your graphs/code/text in it as you write, including LaTeX stuff.

I am not starting from a markdown doc, but I would if that made a difference. I’ve never used RStudio. Does that produce a PDF that has two representations, mono and color?