1

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.

\appendix
\section*{APPENDIX A}

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

\afterpage{\mycontinue}

\subsection*{Some title}
\lstinputlisting{code.java}

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

1 Answers1

2

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.

David Carlisle
  • 757,742
  • but I need on specified pages, not at all – Yaroslav Boichuk May 04 '12 at 09:34
  • 1
    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 04 '12 at 10:03
  • thx, I will try to do that! – Yaroslav Boichuk May 04 '12 at 10:09