TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As part of a layout for a home made recipe book, I'm trying to lay out a series of text boxes at absolute positions on a page. I'm using eso-pic to put a background image on the page which has openings for the text I'm trying to lay out such as ingredients and directions.

I'm currently using the eso-pic AddToShipoutPictureFg to handle each block of text which resides in a rotated minipage. If I understand correctly, the arguments to AddToShipoutPicture will only get expanded at the end of the page. This is creating problems when I'm using a changing definition such as a counter inside the AddToShipoutPicture macro.

Here is an example showing the method I'm using for multiple rotated text boxes.





% First chunk of angled boxed text.
    \put(2,6){% Or in my document \put(Xcoord,Ycoord)
            This is some text.  I expect
            the counter to be 1, counter is \themycounter.

% Or in my document:
% \renewcommand{\Xcoord}{calculated X position}
% \renewcommand{\Ycoord}{calculated Y position}

% Second chunk of angled boxed text.
    \put(2,8){% Or in my document \put(Xcoord,Ycoord)
            This is some more text.  I expect
            the counter to be 2, counter is \themycounter.



This is the result, showing that the counter's value is always at the last value set:

enter image description here

How can the expansion of the counter's value be forced at the time AddToShipoutPictureFG appears in the source text so that the output at the red arrow shows 1 rather than 2?

NOTE 1: I'm a newbie using pdflatex. If there's an easier way to get multiple rotated, absolute positioned text boxes on the page please advise. I tried using the rotating package with textpos environment but they don't appear to play nice together - rotation occurs about a point in the text block that I can't determine.

NOTE 2: I've used a counter for the purposes of this example to illustrate a changing definition between AddToShipoutPictureFG calls. What I have in my document in place of \stepcounter{mycounter} is a macro which redefines an X, Y coordinate pair for the following text box which is used inside the next AddToShipoutPictureFG call. Of course the X, Y definitions at page end are the last X,Y set and so the text boxes always appear on top of each other rather than at the X,Y coordinate set before each AddToShipoutPictureFG call.

share|improve this question
up vote 4 down vote accepted



immediately after the \themycounter so it is incremented after it is used. As is you are incrementing it on the main flow but using it twice in the output routine

share|improve this answer
Thank you, that makes sense. – Austin Phillips Jul 30 '12 at 1:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.