# Repeating text in the beginning of certain pages

With the following code, the text

This is an experiment!

is not placed in the indicated pages: 1, 2 and 4.

\documentclass[12pt]{article}

\usepackage{lipsum}
\usepackage{afterpage,everypage}
\usepackage{tikz}
\usepackage{xstring}

\newcommand*{\MyList}{1,2,4}

\foreach \x in \MyList {
\IfEq{\arabic{page}}{\x}{
\afterpage{\noindent \centering This is an experiment!}
\breakforeach%
}
}
}

\begin{document}


• Just remove \afterpage and add \par after "experiment!" – Fran Jun 3 at 0:04