How to input a "dashlined" page for every even page
To have comment pages numbered, as well (see below for alternative):
Create your baseline document in the almost normal way. The only quirk is to get it to number each page by 2's, starting at 1
. Here is lipsum30.tex
:
\documentclass{article}
\usepackage{lipsum}
\renewcommand\thepage{\the\numexpr\value{page}+\value{page}-1\relax}
\begin{document}
\lipsum[1-30]
\end{document}
to create a 6-page lipsum30.pdf
, with pages numbered 1, 3, 5, 7, 9, 11.
Once your baseline document (here lipsum30.pdf
) has been created:
\documentclass{article}
\usepackage{everypage}
\usepackage{graphicx}
% THESE ARE LaTeX DEFAULTS; CAN CHANGE IF NEEDED.
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\AddThispageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{\textcolor{red}{#3}}}}}
% VERIFIED THAT SETTING \hoffset AND \voffset DO NOT BREAK SOLUTION.
%\hoffset=0.4in
%\voffset=0.2in
\usepackage{pgffor,pdfpages}
\begin{document}
\foreach\x in {1,...,6}{
\includepdf[pages=\x]{lipsum30.pdf}
\atxy{0in}{\paperheight}{\includegraphics[height=\paperheight]{lined-paper-template-9898}}
\vspace*{-1.2in}\noindent\hspace{-45pt}%
\Huge \underline{Your comments for page \the\numexpr\x+\x-1\relax:}
}
\end{document}
Note on page numbering
If one would like no numbering on the comment pages, with the odd (document) pages being numbered 1-6, consecutively, then just eliminate the \thepage
redefinition in the base document, and in the splicing document, set \pagestyle{empty}
. If you refer to pages by number, as I did on the comment pages, you will also need to revise that as well, to reflect the new numbering scheme: \Huge \underline{Your comments for page \x:}
.
The file lined-paper-template-9898.jpg
found at http://www.wordmstemplates.com/wp-content/uploads/2015/08/lined-paper-template-9898.jpg. If you don't like this form of paper ruling, choose another image, or just set up your own page ruling in the pgffor
loop.
Although there is already an accepted answer, here is another approach.
Caution:
Because this uses afterpage
, it will not work for twocolumn
documents and it's not robust, i.e. it may break easily.
This also means, while Steven B. Segletes' answer will work, this one may not do so.
This solution doesn't need pdfpages
. Instead the final result is produced from one source. It also has additional features: the appearance of the comment pages can be changed mid document and comment pages can be suppressed.
There are three commands:
\EverySecondPage{...}
starts adding comment pages. This command is only allowed once in the document, and not to be placed in an environment! The latter is necessary, because some environments may expand their content more then once. The argument is a command, which produces one comment page, e.g. \DashedPage
.
\ChangeEverySecondPage{...}
can be used to change the appearance of the comment pages by passing a different command to it.
\NomoreEverySecondPage
disables adding comment pages. To re-enable them, \ChangeEverySecondPage{...}
must be used.
The commands take effect beginning from the page on which they where expanded first by TeX. This means, if TeX decides to move something read on page n to the next page, it may seem as if the command takes effect too early. I.e. the point in the document where the command appeared is on page n+2, but it's effect can already be seen on comment page n+1. So it may be necessary to move the command a paragraph up or down.
The commands can be used inside, for example, a tcolorbox
environment. But it's effect will be visible beginning from the page the environment started, because tcolorbox
(as far as I know) reads it's whole contents, before anything is given out. The same probably applies to many other environments.
The command to set comment pages should be defined in the preamble, so \EverySecondPage
and \ChangeEverySecondPage
only get a simple command as argument.
Here is the code:
\documentclass[a4paper]{article}
\usepackage[breakable]{tcolorbox}
\usepackage{notespages}
\usepackage{multido}
\usepackage{afterpage}
\usepackage{lipsum}
\newcommand{\DottedLines}[2][1.5]{% %% THE #1 ARGUMENT (MULTIPLE OF BASELINESKIP) IS OPTIONAL THE DEFAULT IS 1.5
\par\nobreak
\noindent\rule{0pt}{1.5\baselineskip}% <- added to remove spurious space
\multido{}{#2}{\noindent\makebox[\linewidth]{\rule{0pt}{#1\baselineskip}\dotfill}\\}}
\def\DashedPage{\newpage\DottedLines[2.5]{15}\newpage}
\makeatletter
% set initial contents for second pages and start it
% only to be called once!
\newcommand{\EverySecondPage}[1]{\gdef\@esp@content{#1}\@everysecondpage}
% to change the contents for second pages
\newcommand{\ChangeEverySecondPage}[1]{\gdef\@esp@content{#1}}
% suppress subsequent second pages
\newcommand{\NomoreEverySecondPage}{\global\let\@esp@content\relax}
% internal macro
\newcommand{\@everysecondpage}{\afterpage{\@esp@content\@everysecondpage}}
% necessary, otherwhise there will be two pages at the end
\AtEndDocument{\NomoreEverySecondPage}
\makeatother
\begin{document}
\EverySecondPage{\DashedPage}
\lipsum[1-12]
\ChangeEverySecondPage{\notespage[notesstyle=lines,vparts=25,titletext={Your comments:}]}
\lipsum[13-25]
\NomoreEverySecondPage
\begin{tcolorbox}[title=Just a test,breakable]
\lipsum[1-10]
\end{tcolorbox}
\ChangeEverySecondPage{\notespage[hparts=20,titletext={Your comments:}]}
\begin{tcolorbox}[title=And another test,breakable]
\lipsum[11-20]
\end{tcolorbox}
\end{document}
And this is the result: