1

I'm finishing up on a book I typeset in LuaLaTeX with a custom paper format. I need some text positioned at absolute coordinates on the page using the textblock* environment from the textpos package, however it won't show in the output.

I narrowed down the problem to the use of both the crop and the pagecolor package. If I remove either one from my preamble, the textblock* is visible as intended, but I need both packages, and in that case, no textblock*. How can I make the packages work together?

By the way, I use TeXstudio, which highlights the element at the current cursor position in the output document when I build it. Even though the textblock* is not visible, it is correctly highlighted. This led me to assume that there may be an overlay of color over my textblock*, but I'm stuck with my assumption. See the following image:

TeXstudio highlights the hidden element

Here is my MWE:

\documentclass[paper=240mm:163mm]{scrbook}

\usepackage{xcolor}
\usepackage[width=193truemm, height=270truemm, center, cam]{crop}
\usepackage[pagecolor=none]{pagecolor}

\usepackage[absolute]{textpos}

\begin{document}

Some text.

\begin{textblock*}{\textwidth}(0mm,0mm)
    Absolute position for other text.
\end{textblock*}
    
\end{document}
3
  • Do you use a current tex system? Commented Nov 30, 2023 at 17:42
  • 1
    Load crop after pagecolor. Commented Nov 30, 2023 at 17:50
  • The textpos package documentation includes a rather rambling discussion of interactions between textpos and other packages (\S2.3). The color package is one of the packages mentioned, but that discussion is clearly talking about now quite old versions of packages. Commented Dec 1, 2023 at 9:58

2 Answers 2

1

You might be right with your assumption that the page color is placed over the textblock* (at least with TeXLive 2023). Loading crop after \pagecolor seems to work (color yellow set just to test the coloring):

\documentclass[paper=240mm:163mm]{scrbook}

\usepackage{xcolor}
%\usepackage[pagecolor=yellow]{pagecolor}
\pagecolor{yellow}
\usepackage[width=193truemm, height=270truemm, center, cam]{crop}
\usepackage[absolute]{textpos}

\begin{document}

Some text.

\begin{textblock*}{\textwidth}(0mm,0mm)
    Absolute position for other text.
\end{textblock*}
    
\end{document}

enter image description here

I'd consider this a bug. Whether this should be fixed in the crop package or in the textpos package, however, I can't tell. However, when loading the pagecolor package, a warning appears:

Package pagecolor Warning: Option nopagecolor=none requested but this does not work with the crop package. By option nopagecolor the "color" to be used with \nopagecolor\ is set. The current value is "none" (maybe by default), but the crop package broke \nopagecolor. Therefore the color cannot be "none". Please change the option accordingly! As first aid nopagecolor is now set to white

So, I think, the culprit might be the crop package.

5
  • 2
    \pagecolor does not need a package. Load only xcolor
    – yannisl
    Commented Nov 30, 2023 at 18:30
  • @YiannisLazarides You are right, I edited the answer. Nevertheless, if you put \pagecolor after crop, the above also does not work. Commented Nov 30, 2023 at 19:11
  • @YiannisLazarides Thanks for the reminder about xcolor. @JasperHabicht I ran into this exact problem, where after the first \pagecolor, no more textblock*s appear. Do you see a way to use \pagecolor (which I need) together with textpos, or are there alternatives?
    – hschmauder
    Commented Dec 1, 2023 at 13:46
  • @hschmauder So, you need to use \pagecolor later in your code again? It seems that this bug is known and reported in the manual to the textpos package. A solution suggested there is to place textblocks not in absolute, but in relative mode (as first thing on a new page for example). Commented Dec 1, 2023 at 14:08
  • I tried to use relative mode to work around the problem, which is not nice, but possible. After some research, I came up with another solution I will post as another answer for others who may run into this situation.
    – hschmauder
    Commented Dec 1, 2023 at 16:00
1

In addition to Jasper Habicht's answer, which set me on the right trail, I want to provide clues for others in this situation.

Use relative mode instead

If the \pagecolor command is required throughout the document, use relative positioning for the textblocks, setting \TPHorizModule and \TPVertModule to whatever position is desired.

Use the overlay option

Inspired by a similar answer to a somewhat related problem, you can use the overlay option when loading textpos, i.e. \usepackage[absolute, overlay]{textpos}. In my case, this worked around all \pagecolor issues I had.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .