Currently, I'm representing second and fourth order tensor with this (taken from someone, and i don't really get how it works):
% tensor 2:
\newcommand{\tend}[1]{\oalign{\mbox{\boldmath$#1$}\crcr\hidewidth$\scriptscriptstyle\sim$\hidewidth}}
%tensor 4:
\newcommand{\tenq}[1]{\tend{\tend #1}\vphantom{#1}}
Which looks like this:
I very much don't like the result: boldface is strange, with scales badly, there is too much spacing for the fourth order tensor… I found the untertilde package, with looks more robust for second order, but i cannot see how to make 4th order from it.
I also found this topic, bold widetilde, which doe not adress symbol stacking for 4th order.
Is there a simple elegant way to do? My main concern here is consistant boldface for the tilde and the letter, and proper vertical spacing of the 4th order.
Thanks
Best Answer
Here I use stacks to recursively place
\sim
under the argument, based on the value of the optional argument. In the definition, the[1pt]
is the under-gap from the argument and the[0pt]
is the vertical separation between\sim
characters in a multi-stack. These values can be altered to suit (including being made negative).I have not used any bold font for the tensor itself, though it could be added, if desired, to the definition, or at time of invocation.
The specification of
\def\useanchorwidth{T}
says to ignore the width of the\sim
underset in setting the horizontal spacing. The only time that could be an issue is if you, for example, used adjacent invocations on narrow arguments, e.g.,\tenq[2]{i}\tenq[3]{j}
. While the\useanchorwidth
line could be removed, in which case\tenq
with narrow arguments would always take up at least the width of a\scriptscriptstyle\sim
, my first step would instead be to manually add\,
space on those very rare occasions when needed.