
目前,我用這個表示二階和四階張量(取自某人,我不太明白它是如何運作的):
% tensor 2:
\newcommand{\tend}[1]{\oalign{\mbox{\boldmath$#1$}\crcr\hidewidth$\scriptscriptstyle\sim$\hidewidth}}
%tensor 4:
\newcommand{\tenq}[1]{\tend{\tend #1}\vphantom{#1}}
看起來像這樣:
我非常不喜歡這個結果:粗體很奇怪,尺度很差,四階張量的間距太大......我找到了untertilde 包,對於二階來說看起來更健壯,但我不明白如何從中下第四個訂單。我也發現了這個話題粗體寬波浪線,它不解決第四階的符號堆疊問題。
有沒有簡單優雅的做法呢?我在這裡主要關心的是波浪線和字母的粗體一致,以及第四順序的適當垂直間距。
謝謝
答案1
在這裡,我根據可選參數的值,使用堆疊遞歸地放置\sim
在參數下。在定義中,[1pt]
是參數的下間隙,是多堆疊中字元[0pt]
之間的垂直間距。\sim
可以更改這些值以適應(包括設為負數)。
我沒有對張量本身使用任何粗體字體,但如果需要,可以將其添加到定義中或在調用時添加。
規範說在設定水平間距時\def\useanchorwidth{T}
忽略下凹的寬度。\sim
唯一可能出現問題的情況是,例如,您在狹窄的參數上使用了相鄰的調用,例如\tenq[2]{i}\tenq[3]{j}
.雖然\useanchorwidth
可以刪除該行,在這種情況下\tenq
,窄參數總是至少佔用 a 的寬度\scriptscriptstyle\sim
,但我的第一步是\,
在需要時在極少數情況下手動添加空間。
\documentclass{article}
\usepackage{stackengine}
\stackMath
\newcommand\tenq[2][1]{%
\def\useanchorwidth{T}%
\ifnum#1>1%
\stackunder[0pt]{\tenq[\numexpr#1-1\relax]{#2}}{\scriptscriptstyle\sim}%
\else%
\stackunder[1pt]{#2}{\scriptscriptstyle\sim}%
\fi%
}
\begin{document}
\[
\tenq{\sigma}\neq\tenq[2]{\Lambda}\neq\tenq[3]{\Delta}\neq\tenq[4]{\psi}
\]
\end{document}
答案2
如果您喜歡第一個,您可以使用相同的定義,\tenq
但使用\approx
代替\sim
。
也可以使用\bm
同一個包中的而不是\boldmath
.
微量元素:
\documentclass{article}
\usepackage{amsmath,bm}
% tensor 2:
\newcommand{\tend}[1]{\hbox{\oalign{$\bm{#1}$\crcr\hidewidth$\scriptscriptstyle\bm{\sim}$\hidewidth}}}
%tensor 4:
\newcommand{\tenq}[1]{\hbox{\oalign{$\bm{#1}$\crcr\hidewidth$\scriptscriptstyle\bm{\approx}$\hidewidth}}}
\begin{document}
\[
\tend{\sigma}\neq\tenq{\Lambda}
\]
\end{document}
答案3
只是為了好玩。
\documentclass{standalone}
\usepackage{amsmath,bm}
\newlength{\fillwidth}
% creates a tilde which slightly overlaps what's above and below, centered in a space \fillwidth wide
\newcommand{\flatsim}{\hbox to \fillwidth{\hfil\raisebox{0pt}[.05ex][.05ex]{$\scriptscriptstyle\bm{\sim}$}\hfil}}
\newcommand{\triple}[1]{\settowidth{\fillwidth}{$\bm{#1}$}%
\vtop{\baselineskip=0pt\hbox{$\bm{#1}$}\hbox{\rule{0pt}{.2ex}}\flatsim\flatsim\flatsim}}
\begin{document}
\triple{\sigma}
\end{document}