15

It turns out that I've been using several deprecated commands, such as \tikzstyle and right of. Is there any way to have TikZ or pdfLaTeX warn in those cases, such as nag does?

Tim N
  • 10,219
  • 13
  • 63
  • 88

1 Answers1

3

Borrowing an example that uses \tikzstyle by percusse at tikzstyle default node text with fill color I show below how you can redefine the deprecated command to place a warning in the log or alternately, in the console and log. In this MWE, I have the redefinition in the file itself. But if you're like me, you have your own style file of oft-used macros that \usepackage{mycommands} in just about everything.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
%%%%%%%%%%%%%%%%%
%%% PUT THIS IN YOUR OWN STYLE FILE
\let\svtikzstyle\tikzstyle
% LOG FILE ONLY:
%\def\tikzstyle{\wlog{WARNING: tikzstyle is used}\svtikzstyle}
% CONSOLE AND LOG FILE:
\def\tikzstyle{\typeout{WARNING: tikzstyle is used}\svtikzstyle}
%%%%%%%%%%%%%%%%%
% borrowed example from answer by percusse
\tikzstyle{stuff_nofill}=[rectangle,draw,font={A}]
\tikzstyle{stuff_fill}=[rectangle,draw,fill=black!20,minimum
size=1.4em,label={center:A}]
\begin{document}
\begin{tikzpicture}
 \node at (0,1) [stuff_nofill] {};
 \node at (0,0) [stuff_fill] {};
\end{tikzpicture}
\end{document}

enter image description here