我在学习张量分析时,想要用LaTeX做笔记,但是遇到了一个问题,如下图所示


IMG_20190827_192853.jpg


T和S上面的那种箭头该如何实现,或者说用哪个宏包可以实现,还望大家告诉我,非常感谢!!!!!

2 回答2

1
<p></p><p></p><p>&nbsp;- 写了一个宏 `\xhat`,用着试试。</p><p>&nbsp;- 宏定义中,需要解释的部分可能非常多,确有兴趣的,评论提出吧。</p><p><br/></p><p><img src="/data/ueditor/php/upload/image/20190830/1567130181449957.png" title="1567130181449957.png" alt="image.png"/></p><p>第二个可选参数的作用不明显,再说吧。</p><p><br/></p><p><img src="/data/ueditor/php/upload/image/20190830/1567130325130240.png" title="1567130325130240.png" alt="image.png"/></p><p>对用户&nbsp;<a href="https://wenda.latexstudio.net/u-10015.html" title="registor" target="_blank" style="box-sizing: content-box; background: 0px 0px rgb(255, 255, 255); text-decoration-line: none; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1) 0s; cursor: pointer; margin: 0px 5px 0px 0px; padding: 0px; outline: 0px; font-size: 15px; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; white-space: normal;">registor</a>私信「线条较宽时,线的交接处不好看」的回应:增加 tikz 选项 `line cap=round`。</p><p><br/></p><pre class="brush:plain;toolbar:false">%&nbsp;question&nbsp;from&nbsp;https://wenda.latexstudio.net/q-1115.html \documentclass{article} \usepackage{amsmath} \usepackage{bm} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usepackage{xparse} \makeatletter \newsavebox\xhat@box \newsavebox\xhat@box@pre \newsavebox\xhat@box@suf \newsavebox\xhat@box@voffset \tikzset{ &nbsp;&nbsp;xhat&nbsp;line/.style={ &nbsp;&nbsp;&nbsp;&nbsp;line&nbsp;cap=round &nbsp;&nbsp;}, &nbsp;&nbsp;xhat&nbsp;arrow/.style={ &nbsp;&nbsp;&nbsp;&nbsp;arrows={-Latex[length=3pt]} &nbsp;&nbsp;} } \ExplSyntaxOn \NewDocumentCommand&nbsp;\xhat&nbsp;{&nbsp;>{\SplitArgument{1}{,}}&nbsp;O{,}&nbsp;O{}&nbsp;m&nbsp;}{ &nbsp;&nbsp;\xhat@getxoffset#1 &nbsp;&nbsp;\savebox\xhat@box@voffset{\ensuremath{#2}} &nbsp;&nbsp;\savebox\xhat@box{\ensuremath{#3}} &nbsp;&nbsp;\mathnormal{ &nbsp;&nbsp;&nbsp;&nbsp;\mathop{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\mathstrut &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\xhat@voffset{\xhat@box@voffset}\xhat@voffset{\xhat@box} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\smash[t]{\usebox\xhat@box} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;\limits^{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\begin{tikzpicture}[baseline={(beg)}] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\path&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.5\wd\xhat@box@pre,&nbsp;0)&nbsp;coordinate&nbsp;(beg) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(\wd\xhat@box&nbsp;-&nbsp;.5\wd\xhat@box@suf,&nbsp;0)&nbsp;coordinate&nbsp;(end); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\draw[white]&nbsp;(0,&nbsp;0)&nbsp;--&nbsp;+(\wd\xhat@box,&nbsp;0); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\draw[xhat~&nbsp;line] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(beg)&nbsp;--&nbsp;node[midway,&nbsp;fill=black,&nbsp;draw=white,&nbsp;circle,&nbsp;line~&nbsp;width=1pt,&nbsp;inner~&nbsp;sep=1pt]&nbsp;{}&nbsp;(end); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\path[xhat~&nbsp;line,&nbsp;xhat~&nbsp;arrow] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(beg)&nbsp;edge&nbsp;+(0,&nbsp;-5pt) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(end)&nbsp;edge&nbsp;+(0,&nbsp;-5pt); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\end{tikzpicture} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;} } \def\xhat@getxoffset#1#2{ &nbsp;&nbsp;\savebox\xhat@box@pre{\ensuremath{#1}} &nbsp;&nbsp;\savebox\xhat@box@suf{\ensuremath{#2}} } \def\xhat@voffset#1{ &nbsp;&nbsp;\rule{0pt}{\dimexpr\ht#1&nbsp;-&nbsp;2pt\relax} } \ExplSyntaxOff \makeatother \input&nbsp;code-with-output %&nbsp;&nbsp;&nbsp;code-with-output&nbsp;is&nbsp;downloadable&nbsp;from&nbsp; %&nbsp;&nbsp;&nbsp;https://github.com/muzimuzhi/latex-examples/blob/master/utilities/code-with-output.tex \begin{document} \begin{example*}{Usages&nbsp;of&nbsp;\texttt{\textbackslash&nbsp;xhat}} &nbsp;&nbsp;%&nbsp;\xhat &nbsp;&nbsp;%&nbsp;&nbsp;&nbsp;[<left&nbsp;offset&nbsp;text>,&nbsp;<right&nbsp;offset&nbsp;text>] &nbsp;&nbsp;%&nbsp;&nbsp;&nbsp;[<phantom&nbsp;height&nbsp;text>] &nbsp;&nbsp;%&nbsp;&nbsp;&nbsp;(<extra&nbsp;tikz&nbsp;options>) &nbsp;&nbsp;%&nbsp;&nbsp;&nbsp;{<whole&nbsp;text>} &nbsp;&nbsp;\parindent=0pt\Large &nbsp;&nbsp;Function&nbsp;of&nbsp;\verb|<left/right&nbsp;offset&nbsp;text>|: &nbsp;&nbsp;\begin{align*} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abc&nbsp;\xhat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{abc}&nbsp;ffffd&nbsp;\xhat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ST}&nbsp;\\ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abc&nbsp;\xhat[a,b]{abc}&nbsp;ffffd&nbsp;\xhat[S,T]{ST} &nbsp;&nbsp;\end{align*} &nbsp;&nbsp; &nbsp;&nbsp;Function&nbsp;of&nbsp;\verb|<phantom&nbsp;height&nbsp;text>|: &nbsp;&nbsp;\begin{align*} &nbsp;&nbsp;&nbsp;&nbsp;abc&nbsp;\xhat[\bm{S},\bm{T}]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\bm{TS}}&nbsp;&= &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\xhat[\bm{g},\bm{g}_s]{\bm{g}^k\bm{g}^l\bm{g}_r\bm{g}_s}&nbsp;\\ &nbsp;&nbsp;&nbsp;&nbsp;abc&nbsp;\xhat[\bm{S},\bm{T}][g^l]{\bm{TS}}&nbsp;&= &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\xhat[\bm{g},\bm{g}_s]{\bm{g}^k\bm{g}^l\bm{g}_r\bm{g}_s} &nbsp;&nbsp;\end{align*} \end{example*} \begin{example*}{Usage&nbsp;of&nbsp;\texttt{\textbackslash&nbsp;xhat},&nbsp;2} &nbsp;&nbsp;\parindent=0pt\Large &nbsp;&nbsp;Line&nbsp;cap&nbsp;is&nbsp;always&nbsp;round. &nbsp;&nbsp;\Huge &nbsp;&nbsp;\[ &nbsp;&nbsp;&nbsp;&nbsp;\xhat[\bm{S},\bm{T}]{\bm{TS}}&nbsp;\qquad &nbsp;&nbsp;&nbsp;&nbsp;\tikzset{xhat&nbsp;line/.append&nbsp;style={line&nbsp;width=3pt}} &nbsp;&nbsp;&nbsp;&nbsp;\xhat[\bm{S},\bm{T}]{\bm{TS}} &nbsp;&nbsp;\] \end{example*} \end{document}</pre><p><br/></p><p></p><p></p>
  • 在命令行编译加了-shell-escape成功了, 总之非常感谢!(一条评论好像有字数限制,笑哭.jpg) – Catjazz 2020-05-10 08:57 回复
  • 非常抱歉, 现在才看到, 因为那段时间学习张量分析的时候用户registor给出了一个回答, 也就用了一下, 今天发现这个确实好用, 但是第一次编译没有成功, 在命令行编译并加了-shell-esca – Catjazz 2020-05-10 08:55 回复
  • 非常感谢! – Catjazz 2020-05-10 08:32 回复
  • 回复 registor :我不清楚这种「上标」的应用场景和涉及到的学科知识,无法给出有意义的回应。 – Carcino 2019-08-31 11:43 回复
  • 用node[white,...] {\tiny #4}作圆形圈内符号标记。 – registor 2019-08-30 10:24 回复
  • 回复 Carcino :谢谢指点,另外我觉得可以再加一个参数\xhat { > {\SplitArgument{1}{,}} O{,} O{} m O{}},以用圈1等方式代替圆点标记。 – registor 2019-08-30 10:04 回复
  • 回复 registor :你私信里提到的,增加 tikz 选项 `line cap=round` 也是一种方法,回答已更新 – Carcino 2019-08-30 10:02 回复
  • 回复 registor :用于撑满宽度。\mathop 的上标,默认是左右居中的。如果没有那条白线,缩短后的横线会左右居中。 – Carcino 2019-08-30 09:24 回复
  • 非常好用,但\draw[white] (0, 0) -- (\wd\xhat@box, 0);这一句话的作用,我不太理解,能不能说明一下呢? – registor 2019-08-29 14:50 回复
1
<p>可以使用Ti<em>k</em>Z画一个标志,附件是其它类似的一个参考代码:</p><p style="line-height: 16px;"><img src="https://wenda.latexstudio.net/static/js/neweditor/dialogs/attachment/fileTypeImages/icon_rar.gif"><a style="font-size:12px; color:#0066cc;" href="/data/ueditor/php/upload/file/20190827/1566915287215681.zip" title="tikzmark4math.zip">tikzmark4math.zip</a></p><p><br></p>
  • 标注位置有直接的 `tikzmark` 包可以用,用法与你附件中定义的 `\tikzmark` 相仿。 – Carcino 2019-08-28 16:39 回复
  • 好的,目前只能用这种方法了,非常感谢!!!! – Catjazz 2019-08-28 14:37 回复

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。