# Spot commands in the layout file

I'm searching for a way to highlight some commands in the layout file. I need, in my proofreading work (I'm a typesetter) to quickly spot some kinds of commands like vertical space modifiers or page breaking commands.

I'm testing:

\documentclass[11pt]{article}
\pagestyle{empty}
\usepackage{lipsum}
\usepackage{color}

\let\Oldenlargethispage\enlargethispage
\renewcommand{\enlargethispage}{\marginpar{\colorbox{red}{ETP}}\Oldenlargethispage}

\let\Oldpagebreak\pagebreak
\renewcommand{\pagebreak}{\marginpar{\colorbox{red}{pagebreak}}\Oldpagebreak}

\let\Oldclearpage\clearpage
\renewcommand{\clearpage}{\marginpar{\colorbox{red}{clearpage}}\Oldclearpage}

\let\Oldnewpage\newpage
\renewcommand{\newpage}{\marginpar{\colorbox{red}{newpage}}\Oldnewpage}

\begin{document}

\lipsum

\pagebreak

\lipsum

\end{document}


But, in a second time I'll save, for example, the following code:

\let\Oldenlargethispage\enlargethispage
\renewcommand{\enlargethispage}{\marginpar{\colorbox{red}{ETP}}\Oldenlargethispage}

\let\Oldpagebreak\pagebreak
\renewcommand{\pagebreak}{\marginpar{\colorbox{red}{pagebreak}}\Oldpagebreak}

\let\Oldclearpage\clearpage
\renewcommand{\clearpage}{\marginpar{\colorbox{red}{clearpage}}\Oldclearpage}

\let\Oldnewpage\newpage
\renewcommand{\newpage}{\marginpar{\colorbox{red}{newpage}}\Oldnewpage}


in a separate file (e.g. pagebreaks-highlight.tex) and I will compile with (an alias of):

latex -src-specials -synctex=1 "\AtBeginDocument{\input{\string~/path/pagebreaks-highlight.tex}} \nonstopmode\input{myfile.tex}"


to quicky spot my targets commands without changing my working file.

My question is: what's the best way to highlight this kind of commands without changing the overall layout? I suspect that \marginpar may introduce layout changes.

I'like something like the showkeys package layout but "colored".

• Any \marginpar may modify the page/line breaks. Not relevant, but are you sure about -src-specials? It's an obsolete feature. – egreg Jan 14 '18 at 15:33
• What is the purpose of having the "special commands" rendered into the output? wouldn't i be better so "prove read" that in an editor like TexStudio, where you could apply additional highlighting on top of the default? – Timothy Truckle Jan 14 '18 at 15:43
• @egreg I wasn't aware that -src-specials is obsolete. I use it to achieve forward-search in okular/emacs. It works fine. – Gabriele Nicolardi Jan 14 '18 at 18:10
• @TimothyTruckle, I need absolutely to have emacs as my text editor because of the tons of tools I built... – Gabriele Nicolardi Jan 14 '18 at 18:13
• I strongly believe that the highlighting is better done in emacs then in the resulting PDF ... – Timothy Truckle Jan 24 '18 at 10:56