Take the 2-minute tour ×
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.

I am having some trouble placing text at the bottom of the next page. For some reason, the text is being printed at the bottom of the current page. I tried nesting but it only works for the first printing on next page command. Please help me fix this.

        \documentclass{article}
        \usepackage{atbegshi}
        \usepackage{blindtext}
        \usepackage{picture}

        \newcommand{\printnextpage}[1]{
        {\LARGE to print on bottom of next page }


        \AtBeginShipoutNext{%
        \AtBeginShipoutUpperLeft{%
         \put(0.1\paperwidth,-0.95\paperheight){#1}%
         }%
        }
        }

        \begin{document}
        \blindtext[2]
        \printnextpage{i am at bottom}
        \blindtext[7]
        \printnextpage{im at bottom too}
        \blindtext[9]
        \end{document}
share|improve this question

1 Answer 1

The current page is the next page, which will be output next. You can nest \AtBeginShipoutNext:

\documentclass{article}
\usepackage{atbegshi}
\usepackage{blindtext}
\usepackage{picture}

\newcommand{\printnextpage}[1]{%
  {\LARGE to print on bottom of next page }%
  \par
  \AtBeginShipoutNext{%
    \AtBeginShipoutNext{%
      \AtBeginShipoutUpperLeft{%
        \put(0.1\paperwidth,-0.95\paperheight){#1}%
      }%
    }%  
  }%
}

\begin{document}
\blindtext[2]
\printnextpage{i am at bottom}
\blindtext[7]
\end{document}

Another more complicate method: (Absolute) page numbers can be remembered in references and a \AtBeginShipout would check the reference to know, when it has to print the text.

share|improve this answer
    
it works only for the first \printnextpage, if i add more it doest work as expected. –  Ephraim Ncory Jun 15 at 15:17
    
@EphraimNcory: I do not know, what you expect. If \printnextpage is used twice, then the second text will overwrite the first text, because they are placed at the same location. –  Heiko Oberdiek Jun 15 at 15:26
    
just edited the MWE, run it and you will get an idea of what i mean –  Ephraim Ncory Jun 15 at 15:31
    
@EphraimNcory: Asynchronous output routine: \printnextpage has two parts: \AtBeginShipoutNext is executed right away, but the text before can go on this or later pages. The way via references is more robust regarding the asynchronous output routine. But can you clarify the purpose of the whole exercise? I not sure that atbegshi is the right approach. There are other ways like mark registers that could provide a better solution depending on the use case scenario. –  Heiko Oberdiek Jun 15 at 15:39
    
all i am trying to achieve is provide a command which when called will print some text provided as an argument at the bottom of the next page, care to shed some light into those other ways to achieve what i want. –  Ephraim Ncory Jun 15 at 15:43

Your Answer

 
discard

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.