I suspect that arithmetic I put inside newcommand is not processed as I would expect.
What is the value of \FMARGIN after declaring it as
\newcommand{\FWIDTH}{2mm}
\newcommand{\FMARGIN}{10mm+\FWIDTH}
Is it 12mm or something else?
Because when I use it inside coordinate arithmetic I get unexpected results. Not all margins are same distance away from the bounding box.
Complete code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary
{%
calc,
shapes.geometric
}
\newcommand{\FWIDTH}{2mm}
\newcommand{\FMARGIN}{10mm+\FWIDTH}
\begin{document}
\begin{tikzpicture}
\path node
[%
isosceles triangle,
draw=blue,
minimum width=30mm,
line width=1mm
] {};
\path
[%
draw=red,
line width=1mm
]
($(current bounding box.north west)+(-\FMARGIN,\FMARGIN)$)
rectangle
($(current bounding box.south east)+(\FMARGIN,-\FMARGIN)$);
\end{tikzpicture}
\end{document}
Output:
Difference becomes more obvious when \FWIDTH is set to a higher value (like 5mm).



calcand then use\newlength\FMARGIN \setlength\FMARGIN{2mm} ... \setlength\FBWIDTH{10mm+\FMARGIN}or whatever. Or use the PGF maths stuff\pgfmathsetlength ...or even\pgfmathsetmacro .... But PGF maths is slow. – cfr Sep 07 '17 at 01:02\show\FMARGINto find out for yourself. – cfr Sep 07 '17 at 01:07\newcommand{\FMARGIN}{\dimexpr10mm+\FWIDTH\relax}– Steven B. Segletes Sep 07 '17 at 01:35