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

I have issue with \afterpage command and \lstlisting, it's add one blank page after beginning code listing, and after blank page is two of my command.

\section*{APPENDIX A}

\newcommand\mycontinue{\noindent\makebox[\linewidth][r]{CONTINUE APPENDIX  A}\afterpage{\mycontinue}}


\subsection*{Some title}

Answer for question for after page: http://tex.stackexchange.com/a/54292/14208

share|improve this question
Can you pl. post a complete MWE showing the problem? – Harish Kumar May 4 '12 at 8:42

You were lucky you only got one page, as far as I can see that definition encodes a recursive infinite loop as \mycontinue is defined in terms of itself. (Martin's original answer reset it on the last page)

I thought from your previous question that you wanted the text to be in the heading rather than the page block in which case just defining a suitable page style based on headings and going \pagestyle{headings} would be enough. That would put the section title in the heading you'd just have to change the definition slightly (using fancyhdr package most easily) to add the "continued" text.

share|improve this answer
but I need on specified pages, not at all – Yaroslav Boichuk May 4 '12 at 9:34
yes but you can change the pagestyle just for specific sections, if you want the text in the main body something like afterpage is perhaps the way to go but afterpage is always pushing the boundaries of what is reasonable to do. On the other hand changing the page headings via \mark set by sectioning commands is a robust feature supported by the basic underlying Tex engine. – David Carlisle May 4 '12 at 10:03
thx, I will try to do that! – Yaroslav Boichuk May 4 '12 at 10:09

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.