TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Looking for macro to know if the current page is empty , and opening new page if were not as well. Is there any idea to do that? example in this MWE


\newcommand{\border}{\begin{tikzpicture}[remember picture, overlay]
    \coordinate (top) at ($(current page.north)+(0,-1.5)$);
    \coordinate (bottom) at ($(current page.south)+(0,1.5)$);
    \coordinate (left) at ($(current page.west)+(1.5,0)$);
    \coordinate (right) at ($(current page.east)+(-1.5,0)$);
    \draw[red] (bottom-|left) rectangle (top-|right);





I want to put the frame in a blank page after the text

share|improve this question
Define "empty". No content but has a header/footer? How about creating a minimal working example (MWE) that shows what you mean by "empty" and "not empty" in addition to the result from this condition. – Werner Jul 25 '14 at 16:59
i mean 'empty page' totally blank – salim bou Jul 25 '14 at 17:03
You can insert \newpage or \clearpage to move to a blank page. – Werner Jul 25 '14 at 17:19
up vote 5 down vote accepted

My guess: \newpage is what you are looking for. It starts a new page, if there is something. Otherwise \newpage does not cause a page break.

share|improve this answer
Thanks this is what i need – salim bou Jul 25 '14 at 17:23
@Heiko What's the difference between \newpage and \clearpage? When should one be used and not the other? – Manuel Jul 25 '14 at 18:18
@Manuel, \clearpage: macro:->\ifvmode \ifnum \@dbltopnum =\m@ne \ifdim \pagetotal <\topskip \hbox {}\fi \fi \fi \newpage \write \m@ne {}\vbox {}\penalty -\@Mi As you can see, \clearpage makes use of \newpage. – Sigur Jul 25 '14 at 18:35
@Manual \clearpage additionally flushes pending float objects. – Heiko Oberdiek Jul 25 '14 at 18:38

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.