我要这个:
我懂了:
使用此代码:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
% overhead arrow
\newcommand{\arrowlefto}[2]{
\begin{tikzpicture}
\node (base) {#1};
\node (dir) [right=0.1cm of base] {$^{#2}$};
\draw[->] (dir.north) .. controls ++(0,.25) and ++(0,.25) .. (base.north);
\end{tikzpicture}}
\begin{document}
There is a mismatch in combination of the numbers. We have three different numbers: all of them are set in sequence except the leftmost digit, other positions have only one digit each. So the rest of digits will be forwarded in their preceding positions. Example: 36 $^85$ $^{31}9$ Or 36 \arrowlefto{6}{8}\arrowlefto{5}{31}9
\end{document}
如何?
仅关心:很多空格,漂亮的箭头,数字的基线(全部突出显示),而不是字体或大小
答案1
这就是我要做的:
- 按照 David Carlisle 的评论,删除 后面的空格
\newcommand{\arrowlefto}[2]{
。 - 修复
tikzpicture
相对于base
节点的基线。 - 减小箭头尺寸和/或添加线条之间的空间。
像这样:
\documentclass {article}
\usepackage {amsmath}
\usepackage {tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}% to reduce the arrow head
% overhead arrow
\newcommand{\arrowlefto}[2]{% <-- no need for a space here
\begin{tikzpicture}[baseline=(base.south)]% <-- fixing the baseline
\node[inner sep=0] (base) {#1};
\node[inner sep=0] (dir) [right=0.1cm of base] {$^{#2}$};
\draw[-{Latex[length=1mm]}] ([yshift=0.5ex]dir.north) to[out=150,in=30] ([yshift=0.5ex]base.north);
\end{tikzpicture}}
\renewcommand{\baselinestretch}{1.25}% we need a little more space between the lines because the arrows
\begin{document}
There is a mismatch in combination of the numbers. We have three different numbers: all of them are set in sequence except the leftmost digit, other positions have only one digit each. So the rest of digits will be forwarded in their preceding positions. Example: 36 $^85$ $^{31}9$ Or 36 \arrowlefto{6}{8}\arrowlefto{5}{31}9
\end{document}
答案2
关键字base
是的本机选项Tikz
,因此我将其重命名为X
(参见 17.5.1 使用锚点定位节点)。要连接两个节点,有一个称为edge
(参见 17.12 连接节点:使用边缘操作)
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta,bending}
% overhead arrow
\newcommand{\arrowlefto}[2]{%
\begin{tikzpicture}[% definition of styles
every node/.style={inner ysep=2pt,inner xsep=0pt},
every edge/.style={bend right=50,->,draw},
>={Latex[length=1.5pt 2]},
baseline=(X.base)]% end definition of style
\node (X) {#1};
\node (dir) [right=1ex of X] {$^{#2}$} edge (X.north);
\end{tikzpicture}}
\begin{document}
There is a mismatch in combination of the numbers. We have three different numbers: all of them are set in sequence except the leftmost digit, other positions have only one digit each. So the rest of digits will be forwarded in their preceding positions. Example: 36 $^85$ $^{31}9$ Or 36 \arrowlefto{6}{8}\arrowlefto{5}{31}9
\end{document}