This question is a follow-up to this question ("pgfplots: Strange Bump in
\tanhFunction").Stefan Pinnow, who knows a thing or two about
pgfplots, provided an answer that distinguished between\addplot{tanh(\x)};and\addplot{tanh(x)};(xvs\xas the argument).In a comment, Stefan stated "My thought also was that tanh(\x) is the same as tanh(x) but it seems that Lua "doesn't like" "commands", i.e.
\<something>. But to my experience I never used \x in \addplot calls. Since this is easier to read and easier to type [...]".% use TeX as calculation engine \addplot {tanh(\x)}; % use Lua as calculation engine (when compiled with LuaLaTeX of course) \addplot+ [very thick] {tanh(x)};The current
pgfplotsmanual (Revision 1.18.1 (2021/05/15)) states in Chapter 4.3.3 (Computing Coordinates with Mathematical Expressions): "In short: it is the same whether you write \x or just x inside of math expressions.".
- Question: In what circumstances does it matter whether I use
xor\xin anaddplotargument?


\xyou are just passing the number literal such as3.4567to the function. TeX's macro expansion will do the job for you. But withxit undergoes some heavy csname-tricks because how in the world does PGF going to recognize a variable/function? – Symbol 1 Aug 24 '21 at 02:46\draw plot ...;and it's impossible not to mess upsin(x)vssin(\x)vs\sin(x)vs\sin(\x). Perhaps pgfplots's author is just tired of this and try to make the interface as friendly as possible. I myself always usesin(\x)because I like to see it as a\foreach\x in{...}thing. – Symbol 1 Aug 24 '21 at 02:48sin(x)instead of any variant that contains escape character\. In that regard,sin(x)makes more sense. But of course, these are just pure guesses. I never work with lualatex becausefontspecalways fail =( – Symbol 1 Aug 24 '21 at 03:00xand\xdon't behave the same: https://tex.stackexchange.com/questions/663296/strange-syntax-in-pgfplot I think this may be a bug or at least a strange behavior... – Hérisson Didier Nov 09 '22 at 19:56