The objective is to make a grid of 5 rows by 2 columns for each page. Unfortunately, only the first page has a grid of 4 rows by 2 columns. How to fix it?
Minimal Working Example
I have tried to make this MWE as minimal as possible and at the same time keep the real scenario remain unchanged. Please don't remove the code that might be trivial.
\documentclass{article}
\usepackage[a4paper,hmargin=2mm,vmargin=2mm]{geometry}
\usepackage{longtable,array}
\newcounter{counter}
\newcolumntype\specifier{|*2{>{\centering\stepcounter{counter}}m{0.5\dimexpr\linewidth-4\tabcolsep-3\arrayrulewidth\relax}|}}
\makeatletter
\def\row[#1]#2{%
\parbox[c][0.2\dimexpr\textheight-6\arrayrulewidth-\topskip\relax][c]{\linewidth}{\centering #1 \par \vspace{15pt} {\bf #2}}%
\ifodd\value{counter}
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{&}{\tabularnewline\hline}%
}
\makeatother
\newcommand\finalline{%
\ifodd\value{counter}\omit\tabularnewline\cline{1-1}\fi
}
\usepackage{etoolbox}
\AfterEndPreamble{%
\topskip=0pt\relax
\begin{longtable}{\specifier}\hline
}
\preto\enddocument{\finalline\end{longtable}}
\pagestyle{empty}
\begin{document}
\row[RAM]{Random Access Memory}
\row[BIOS]{Basic Input Output System}
\row[MWE]{Minimal Working Example}
\row[OMG]{Oh My Ghost}
\row[PS]{Post Script}
\row[RAM]{Random Access Memory}
\row[BIOS]{Basic Input Output System}
\row[MWE]{Minimal Working Example}
\row[OMG]{Oh My Ghost}
\row[PS]{Post Script}
\row[RAM]{Random Access Memory}
\row[BIOS]{Basic Input Output System}
\row[MWE]{Minimal Working Example}
\row[OMG]{Oh My Ghost}
\row[PS]{Post Script}
\row[RAM]{Random Access Memory}
\row[BIOS]{Basic Input Output System}
\row[MWE]{Minimal Working Example}
\row[OMG]{Oh My Ghost}
\end{document}
Output

Bonus problem
I just noticed that when there is only a single cell on the last page, an unwanted extra line appear right to the cell as pointed by a red arrow. How to remove it as well?



tikzto globally place nodes on the page. That seems to be a lot more flexible than having to figure out why something like this does not always work – daleif Jun 23 '15 at 11:15tikzcode. Here is the most crusial part:\begin{tikzpicture}[remember picture,overlay];-) – daleif Jun 23 '15 at 11:22