Question
Is there any way to manage that text stays on the grid given by a tikzpicture?
Screenshot
MWE
\documentclass{article}
\usepackage{tikz}
\usepackage{eso-pic}
\AddToShipoutPicture{%
\begin{tikzpicture}[remember picture, overlay]
\tikzset{normal lines/.style={black!20, very thin}}
\tikzset{margin lines/.style={black!20, thick}}
\node at (current page.south west){
\begin{tikzpicture}[remember picture, overlay]
\draw[style=normal lines,step=0.5cm] (0,0) grid +(210mm,297mm);
\end{tikzpicture}
};
\end{tikzpicture}
}
\usepackage{blindtext}
\begin{document}
\section{Lorem ipsum}
\blindtext[2]
\section{Lorem ipsum}
\blindtext[3]
\section{Lorem ipsum}
\blindtext[2]
\end{document}


\baselineskipof the sections (and surrounding spaces) are not the same as that of the paragraph text. – Werner Dec 08 '17 at 17:32\baselineskipinterval." If you have only regular/paragraph text, this should be okay, but as soon as you add sectional units and floats, then things might not line up as expected. Two alternatives are possible: (1) Use LuaLaTeX to "process the input buffer" before content is set on the page; (2) Change this method to put in horizontal rules rather than line numbers after the document is already created. – Werner Dec 08 '17 at 17:42\smash{}which nullifies increased line height due to larger text. The enclosed text will not wrap, but you can break it into several lines, each with their own\smash{}. (3) Use\nullbefore and after the section heading, to space an integer number of lines. (4) If your work is more like a novel than like an academic report, thenoveldocument class has grid typesetting built in. Cannot use TiKz. – Dec 08 '17 at 18:04\section) from details of layout implementation, so even if you define all the macros "by hand" it is best to call the resulting macro\sectionand keep the resulting document markup basically unchanged. – David Carlisle Dec 08 '17 at 22:42