我有一组方程式,总结如下:
产生该结果的代码如下:
\documentclass[12pt]{article}
\usepackage{empheq}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath}
\begin{document}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{subequations}
\begin{empheq}[box=\widefbox]{align}
%
\Aboxed{a = & b + c + d}
\nonumber \\
& d = f + g
\nonumber \\
& \qquad
f = m/4
\nonumber \\
&
d = j + k
\nonumber \\
& \qquad
j = n\cdot3/4
\nonumber \\
& d = l + o
\nonumber \\
\Aboxed{& d = m/4 + q + n\cdot 3/4 + k + l + 0 }
\nonumber \\
\Aboxed{&c = p + q}
\nonumber \\
& \qquad
p = h/2 + h/2
\nonumber \\
\Aboxed{&b = r + s}
\nonumber \\
\Aboxed{&t = u + w}
\nonumber \\ \nonumber\\
\Aboxed{a = & b + c + d}
\nonumber \\ \nonumber\\
\Aboxed{a = & zz + z'}
\nonumber \\ \nonumber\\
\end{empheq}
\end{subequations}
\end{document}
我想制作类似的东西:
有没有办法实现那些箭头、红框和带圆圈的数字 1、2 和 3?
更新:
按照@Ignasi 的方法,当我尝试将其应用到真实示例中时,遇到了很多困难,这是我能取得的最接近的结果:
在哪里:
1)带圆圈的数字和箭头出现在下一页,而不是方程式旁边(见图)
2)我无法使这些J[p]
方程对齐。
3)我无法把最后一个方程式框起来,
4)有没有办法为这个方案添加标题?
你能帮助我获得这个结果吗?
这是我目前到达的代码:
\documentclass[12pt]{article}
\usepackage{empheq}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning}
\begin{document}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{subequations}
\begin{empheq}[box=\widefbox]{align}
%
%
\tikzmark{1}\Aboxed{
E [\rho ] = & \underbrace{ T[\rho ] + V_{ee}[\rho ] }_{=\,\, F[\rho ]} + V_{ne}[\rho]
}
\nonumber \\
& %
\tikzmark{2}
V_{ne}[\rho ] = \int \rho \left ( \mathbf{r} \right ) v_{\text{ext}} \left ( \mathbf{r} \right ) \mathrm{d}\mathbf {r}
\nonumber \\
& \qquad \qquad
v_{\text{ext}}\left ( \mathbf{r}_{i} \right ) = - \sum_{A=1}^{M} \frac{Z_{A}}{r_{iA}}
\nonumber \\
&
\tikzmark{3}
V_{ne}[\rho ] = \int - \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \rho \left ( \mathbf{r}_{1} \right ) \mathrm{d}\mathbf {r}_{1}
\nonumber \\
& \qquad \qquad
\rho (\mathbf{r}) \equiv \rho_{\text{S}}(\mathbf{r}) = \sum_{i=1}^{N} \left | \varphi_{i} \left ( \mathbf{x} \right ) \right |^{2} = \rho_{0}(\mathbf{r})
\nonumber \\
& %
\tikzmark{4}
V_{ne}[\rho ] = \int - \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \sum_{i=1}^{N} \left | \varphi_{i} \left ( \mathbf{x}_{1} \right ) \right |^{2} \mathrm{d}\mathbf {r}_{1}
\nonumber \\
\tikzmark{5}
\Aboxed{
&V_{ne}[\rho ] = - \sum_{i=1}^{N} \int \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \left | \varphi_{i} \left ( \mathbf{x}_{1} \right ) \right |^{2} \mathrm{d}\mathbf {r}_{1}
}
\nonumber \\
\tikzmark{6}
\Aboxed{
&V_{ee}[\rho ] = J[\rho ] + V_{\text{non-classical}}[\rho ]
}
\nonumber \\
& \qquad \qquad J[\rho] = \frac{1}{2} \int \int \frac{\rho(\mathbf{r}_{1})\rho(\mathbf{r}_{2})}{r_{12}} \mathrm{d}\mathbf {r}_{1} \mathrm{d}\mathbf {r}_{2} \nonumber \\
& \qquad \qquad \qquad \rho (\mathbf{r}) \equiv \rho_{\text{S}}(\mathbf{r}) = \sum_{i=1}^{N} \left | \varphi_{i} \left ( \mathbf{x} \right ) \right |^{2} = \rho_{0}(\mathbf{r}) \nonumber \\
&
\Aboxed{
J[\rho] = \frac{1}{2} \sum_{i=1}^{N} \sum_{j=1}^{N} \int \int \left | \varphi_{i} (\mathbf{r}_{1}) \right |^{2} \frac{1}{r_{12}} \left | \varphi_{j} (\mathbf{r}_{2}) \right |^{2} \mathrm{d}\mathbf {r}_{1} \mathrm{d}\mathbf {r}_{2} }
\nonumber \\
\tikzmark{7}
\Aboxed{
&T[\rho ] = T_{\text{S}}[\rho ] + T_{\text{C}}[\rho ]
}
\nonumber \\
& \qquad \qquad T_{\text{S}}[\rho ] = -\frac{1}{2}\sum_{i=1}^{N} \expval{\nabla^{2}}{\varphi _{i}}
\nonumber \\
\tikzmark{8}
\Aboxed{
E_{\text{XC}} [\rho] &= \left ( T[\rho] - T_{\text{S}}[\rho] \right ) + \left ( E_{ee}[\rho] - J[\rho] \right ) = T_{\text{C}}[\rho] + V_{\text{non-classsical}}[\rho]
}
\nonumber \\
\tikzmark{9}
\Aboxed{
E [\rho ] = & T_{\text{S}}[\rho ] + J[\rho] + V_{ne}[\rho ] + E_{\text{XC}} [\rho]
}
\nonumber \\
%\begin{empheq}[box=\fbox]{align}
%\end{subequations}
%
\tikzmark{10}
E [\rho ] = & -\frac{1}{2}\sum_{i=1}^{N} \expval{\nabla^{2}}{\varphi _{i}} + \frac{1}{2} \sum_{i=1}^{N} \sum_{j=1}^{N} \int \int \left | \varphi_{i} (\mathbf{r}_{1}) \right |^{2} \frac{1}{r_{12}} \left | \varphi_{j} (\mathbf{r}_{2}) \right |^{2} \mathrm{d}\mathbf {r}_{1} \mathrm{d}\mathbf {r}_{2}
\nonumber \\
& + E_{\text{XC}} [\rho] - \sum_{i=1}^{N} \int \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \left | \varphi_{i} \left ( \mathbf{x}_{1} \right ) \right |^{2} \mathrm{d}\mathbf {r}_{1}\\
%}
%\end{empheq}
\end{empheq}
\end{subequations}
\begin{tikzpicture}[remember picture, overlay]
\foreach \i [count=\ni] in {1,9,10}
\node[draw, circle, inner sep=2pt, left=2mm of pic cs:\i, yshift=.5ex] (c\ni) {\ni};
\foreach \i in {2,...,4}
\draw[->] ([shift={(2mm,-4.pt)}]pic cs:1) |- ([shift={(-4pt,.5ex)}]pic cs:\i);
\foreach \i in {5,...,8}
\draw[->] ([shift={(2mm,-4.pt)}]pic cs:1) |- ([yshift=.5ex]pic cs:\i);
\end{tikzpicture}
答案1
一个简单的解决方案pstricks
。我定义了一个\Acolorboxed
命令,模仿\Aboxed
来自的命令mathtools
:
\documentclass[12pt]{article}
\usepackage{empheq}
\usepackage[margin=2.5cm]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{pst-node, multido}
\usepackage{auto-pst-pdf} % to compile with pdflatex
\makeatletter
\colorlet{framecolor}{Tomato}
\colorlet{bgcolor}{white}
\newcommand{\fcolorboxed}[3]{\fcolorbox{#1}{#2}{\m@th$\displaystyle#3$}}
\newcommand\Acolorboxed[1]{\let\bgroup{\romannumeral-`}\@Acolorboxed#1&&\ENDDNE}
\def\@Acolorboxed#1\ENDDNE{%
\ifnum0=`{}\fi \setbox \z@
\hbox{$\displaystyle#1{}\m@th$\kern\fboxsep \kern\fboxrule }%
\edef\@tempa {\kern \wd\z@ &\kern -\the\wd\z@ \fboxsep
\the\fboxsep \fboxrule \the\fboxrule }\@tempa \fcolorboxed{framecolor}{bgcolor}{#1#2}%
}
\makeatother
\def\ma-ht{\fontdimen22\textfont2}
\newcommand{\myeqlabel}[1]{\cput[linecolor=Tomato](-2em,0.7ex){\color{Tomato}#1}}
\begin{document}
\newcommand*\widefbox[1]{\hspace{2em}#1\hspace{2em}}
\begin{postscript}
\begin{subequations}
\begin{empheq}[box=\widefbox]{align}
\myeqlabel{1}\Acolorboxed{\rnode[b]{I}{a} = & b + c + d}
\nonumber \\
\pnode[0,\ma-ht]{E1}& d = \begin{aligned}[t]
& f + g \\
& f = m/4
\end{aligned} \nonumber\\
\pnode[0,\ma-ht]{E2}& d = \begin{aligned}[t]
& j + kr \\
& j = n\cdot3/4
\end{aligned} \nonumber \\
\pnode[0,\ma-ht]{E3} & d = l + o
\nonumber \\
\pnode[0,\ma-ht]{E4}\Aboxed{& d = m/4 + q + n\cdot 3/4 + k + l + 0 }
\nonumber \\
\pnode[0,\ma-ht]{E5}\Aboxed{&c = p + q}
\nonumber \\
& \phantom{c ={}}
p = h/2 + h/2
\nonumber \\
\pnode[0,\ma-ht]{E6}\Aboxed{&b = r + s}
\nonumber \\
\pnode[0,\ma-ht]{E7}\Aboxed{&t = u + w}
\nonumber \\[\baselineskip]
\myeqlabel{2}\Acolorboxed{a = & b + c + d}
\nonumber \\[\baselineskip]
\myeqlabel{3}\Acolorboxed{a = & zz + z'}
\nonumber \\ \nonumber\\
\end{empheq}
\end{subequations}
\psset{linewidth =0.4pt, linejoin=1, arrowinset=0.12, angleA=-90, angleB =-180, arrows=->, nodesepB=0.4em, nodesepA=1.44\fboxsep}
\multido{\i =1 + 1}{7}{\ncangle{I}{E\i}}
\end{postscript}
\end{document}
编辑:针对真实情况的代码。
注意,使用两个命令无法获得二重积分\int
(这会导致非常糟糕的间距),但使用\iint
可以获得二重积分。我们在加载包时有更紧密的间距esint
。
我还简化了数学部分的代码,定义\dd
积分中的微分符号(具有更好的间距),\abs
绝对值的命令,并且必须使用来自的命令进行定义\expval
(这不是标准的 LaTeX 命令)。最后说明:您不必在加载时加载,因为它会加载,而这会加载前者。\DeclarePairedDelimiterX
mathtools
amsmath
empheq
mathtools
\documentclass[11pt]{article}
\usepackage{empheq, nccmath}
\usepackage[margin=2.5cm]{geometry}
\usepackage{caption}
\usepackage[svgnames]{xcolor}
\usepackage{pst-node, multido}
\usepackage{auto-pst-pdf} % to compile with pdflatex
\makeatletter
\colorlet{framecolor}{Tomato}
\colorlet{bgcolor}{white}
\newcommand{\fcolorboxed}[3]{\fcolorbox{#1}{#2}{\m@th$\displaystyle#3$}}
\newcommand\Acolorboxed[1]{\setlength{\fboxrule}{0.8pt}\let\bgroup{\romannumeral-`}\@Acolorboxed#1&&\ENDDNE}
\def\@Acolorboxed#1\ENDDNE{%
\ifnum0=`{}\fi \setbox \z@
\hbox{$\displaystyle#1{}\m@th$\kern\fboxsep \kern\fboxrule }%
\edef\@tempa {\kern \wd\z@ &\kern -\the\wd\z@ \fboxsep
\the\fboxsep \fboxrule \the\fboxrule }\@tempa \fcolorboxed{framecolor}{bgcolor}{#1#2}%
}
\makeatother
\def\ma-ht{\fontdimen22\textfont2}
\newcommand{\myeqlabel}[1]{\cput[linecolor=Tomato](-1.5em,0.7ex){\color{Tomato}#1}}
\newcommand*{\dd}{\mathop{}\!\mathrm{d}} %
\usepackage{esint}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\DeclarePairedDelimiterX\expval[2]{\langle}{\rangle}%
{#1\,\delimsize\vert\,\mathopen{}#2\,\delimsize\vert\,\mathopen{}#1}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning}
\begin{document}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{postscript}
\begin{subequations}
\begin{empheq}[box=\widefbox]{align}
%
\myeqlabel{1}\Acolorboxed{\pnode[1em, -4.27ex]{I}%
E [\rho ]= & \underbrace{T[\rho ] + V_{ee}[\rho ] }_{=\,\, F[\rho ]} + V_{ne}[\rho]
}
\nonumber \\
& \begin{alignedat}{2}
\pnode[0,\ma-ht]{E1}V_{ne}[\rho ] & = & & \int \rho \left ( \mathbf{r} \right ) v_{\text{ext}} \left ( \mathbf{r} \right ) \dd\mathbf {r} \\
& & &\,v_{\text{ext}}\left ( \mathbf{r}_{i} \right ) = - \sum_{A=1}^{M} \frac{Z_{A}}{r_{iA}} \\[-1ex]
\pnode[0,\ma-ht]{E2}
V_{ne}[\rho ] & = & & \int - \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \rho \left ( \mathbf{r}_{1} \right ) \dd\mathbf {r}_{1} \\
& & & \, \rho (\mathbf{r}) \equiv \rho_{\text{S}}(\mathbf{r}) = \sum_{i=1}^{N}\abs{\varphi_{i} \left ( \mathbf{x} \right )}^{2} = \rho_{0}(\mathbf{r}) \\
\pnode[0,\ma-ht]{E3}
V_{ne}[\rho ] & = & & \int - \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \sum_{i=1}^{N} \abs{\varphi_{i} \left (\mathbf{x}_{1} \right) }^{2} \mathrm{d}\mathbf {r}_{1}
\end{alignedat}\nonumber \\
\pnode[0,\ma-ht]{E4} \Aboxed{
&V_{ne}[\rho ]= - \sum_{i=1}^{N} \int \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \abs{\varphi_{i} \left ( \mathbf{x}_{1} \right )}^{2} \dd\mathbf {r}_{1}
}
\nonumber\\
\pnode[0,\ma-ht]{E5}
\Aboxed{%
& V_{ee}[\rho ] = J[\rho ] + V_{\text{non-classical}}[\rho ]
} \nonumber \\
& \begin{aligned}\phantom{V_{ee}[\rho ] ={}} J[\rho] = {} & \mfrac{1}{2} \iint \frac{\rho (\mathbf{r}_{1})\rho (\mathbf{r}_{2})}{r_{12}} \dd\mathbf {r}_{1} \dd\mathbf {r}_{2} \\
& \rho (\mathbf{r}) \equiv \rho_{\text{S}}(\mathbf{r}) = \sum_{i=1}^{N} \abs{\varphi_{i} \left ( \mathbf{x} \right )}^{2} = \rho_{0}(\mathbf{r}) r \\
\Aboxed{
J[\rho]= & \mfrac{1}{2} \sum_{i=1}^{N} \sum_{j=1}^{N} \iint \abs*{\varphi_{i} (\mathbf{r}_{1})}^{2} \frac{1}{r_{12}} \abs*{\varphi_{j} (\mathbf{r}_{2})}^{2} \dd\mathbf {r}_{1} \dd\mathbf {r}_{2}}
\end{aligned}
\nonumber \\
\pnode[0,\ma-ht]{E6}
\Aboxed{
&T[\rho ] = T_{\text{S}}[\rho ] + T_{\text{C}}[\rho ]
}
\nonumber \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
&\phantom{T[\rho ] ={}} T_{\text{S}}[\rho ] = -\mfrac{1}{2}\sum_{i=1}^{N}\expval*{\nabla^{2}}{\varphi _{i}}%
\nonumber \\
\pnode[0,\ma-ht]{E7}
\Aboxed{
& E_{\text{XC}} [\rho] = \left ( T[\rho] - T_{\text{S}}[\rho] \right ) + \left ( E_{ee}[\rho] - J[\rho] \right ) = T_{\text{C}}[\rho] + V_{\text{non-classical}}[\rho]
}
\nonumber \\
\myeqlabel{2}
\Acolorboxed{
E [\rho ] &= T_{\text{S}}[\rho ] + J[\rho] + V_{ne}[\rho ] + E_{\text{XC}} [\rho]
}
\nonumber \\
\myeqlabel{3}
\Acolorboxed{E [\rho ] &=\begin{aligned}[t]-\mfrac{1}{2}\sum_{i=1}^{N} %
\expval*{\nabla^{2}}{\varphi _{i}} + \mfrac{1}{2} \sum_{i=1}^{N} \sum_{j=1}^{N} \iint \abs{\varphi_{i} (\mathbf{r}_{1})}^{2} \frac{1}{r_{12}} \abs*{\varphi_{j} (\mathbf{r}_{2})}^{2} \dd\mathbf {r}_{1} \dd\mathbf {r}_{2}
\\[-1.5ex]
+ E_{\text{XC}} [\rho] - \sum_{i=1}^{N} \int \sum_{A=1}^{M} \frac{Z_{A}}{r_{1A}} \abs{\varphi_{i} \left ( \mathbf{x}_{1} \right )}^{2} \dd\mathbf {r}_{1}
\end{aligned}\nonumber} \\
\end{empheq}
\end{subequations}
%
\psset{linewidth=0.6pt, linejoin=1, linecolor=LightSteelBlue, linearc=0.08, arrowinset=0, angleA=-90, angleB=-180, arrows=->, nodesepB=0.4em, nodesepA=1.44\fboxsep}
\multido{\i=1+1}{3}{\ncangle{I}{E\i}}
\psset{nodesepB=0em}
\multido{\i=4+1}{4}{\ncangle{I}{E\i}}
\captionof{figure}{Some nice equations}
\end{postscript}
\end{document}
答案2
tikzmarks
您可以在环境中使用empheq
,然后绘制数字和连接:
\documentclass[12pt]{article}
\usepackage{empheq}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning}
\begin{document}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{subequations}
\begin{empheq}[box=\widefbox]{align}
%
\tikzmark{1}\Aboxed{a = & b + c + d}
\nonumber \\
& \tikzmark{2} d = f + g
\nonumber \\
& \qquad
f = m/4
\nonumber \\
&
\tikzmark{3} d = j + k
\nonumber \\
& \qquad
j = n\cdot3/4
\nonumber \\
&\tikzmark{4} d = l + o
\nonumber \\
\tikzmark{5}\Aboxed{& d = m/4 + q + n\cdot 3/4 + k + l + 0 }
\nonumber \\
\tikzmark{6}\Aboxed{&c = p + q}
\nonumber \\
& \qquad
p = h/2 + h/2
\nonumber \\
\tikzmark{7}\Aboxed{&b = r + s}
\nonumber \\
\tikzmark{8}\Aboxed{&t = u + w}
\nonumber \\ \nonumber\\
\tikzmark{9}\Aboxed{a = & b + c + d}
\nonumber \\ \nonumber\\
\tikzmark{10}\Aboxed{a = & zz + z'}
\nonumber \\ \nonumber
\end{empheq}
\end{subequations}
\begin{tikzpicture}[remember picture, overlay]
\foreach \i [count=\ni] in {1,9,10}
\node[draw, circle, inner sep=2pt, left=2mm of pic cs:\i, yshift=.5ex] (c\ni) {\ni};
\foreach \i in {2,...,4}
\draw[->] ([shift={(2mm,-4.pt)}]pic cs:1) |- ([shift={(-4pt,.5ex)}]pic cs:\i);
\foreach \i in {5,...,8}
\draw[->] ([shift={(2mm,-4.pt)}]pic cs:1) |- ([yshift=.5ex]pic cs:\i);
\end{tikzpicture}
\end{document}
更新:红色添加。
和伯纳德Acolorboxed
定义并对圆形标签进行一点改变,很容易得到想要的结果:
\documentclass[12pt]{article}
\usepackage{empheq}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning}
\makeatletter
\colorlet{framecolor}{red}
\colorlet{bgcolor}{white}
\newcommand{\fcolorboxed}[3]{\fcolorbox{#1}{#2}{\m@th$\displaystyle#3$}}
\newcommand\Acolorboxed[1]{\let\bgroup{\romannumeral-`}\@Acolorboxed#1&&\ENDDNE}
\def\@Acolorboxed#1\ENDDNE{%
\ifnum0=`{}\fi \setbox \z@
\hbox{$\displaystyle#1{}\m@th$\kern\fboxsep \kern\fboxrule }%
\edef\@tempa {\kern \wd\z@ &\kern -\the\wd\z@ \fboxsep
\the\fboxsep \fboxrule \the\fboxrule }\@tempa \fcolorboxed{framecolor}{bgcolor}{#1#2}%
}
\makeatother
\begin{document}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{subequations}
\begin{empheq}[box=\widefbox]{align}
%
\tikzmark{1}\Acolorboxed{a = & b + c + d}
\nonumber \\
& \tikzmark{2} d = f + g
\nonumber \\
& \qquad
f = m/4
\nonumber \\
&
\tikzmark{3} d = j + k
\nonumber \\
& \qquad
j = n\cdot3/4
\nonumber \\
&\tikzmark{4} d = l + o
\nonumber \\
\tikzmark{5}\Aboxed{& d = m/4 + q + n\cdot 3/4 + k + l + 0 }
\nonumber \\
\tikzmark{6}\Aboxed{&c = p + q}
\nonumber \\
& \qquad
p = h/2 + h/2
\nonumber \\
\tikzmark{7}\Aboxed{&b = r + s}
\nonumber \\
\tikzmark{8}\Aboxed{&t = u + w}
\nonumber \\ \nonumber\\
\tikzmark{9}\Acolorboxed{a = & b + c + d}
\nonumber \\ \nonumber\\
\tikzmark{10}\Acolorboxed{a = & zz + z'}
\nonumber \\ \nonumber
\end{empheq}
\end{subequations}
\begin{tikzpicture}[remember picture, overlay]
\foreach \i [count=\ni] in {1,9,10}
\node[draw, red, circle, inner sep=2pt, left=2mm of pic cs:\i, yshift=.5ex] (c\ni) {\ni};
\foreach \i in {2,...,4}
\draw[->] ([shift={(2mm,-4.pt)}]pic cs:1) |- ([shift={(-4pt,.5ex)}]pic cs:\i);
\foreach \i in {5,...,8}
\draw[->] ([shift={(2mm,-4.pt)}]pic cs:1) |- ([yshift=.5ex]pic cs:\i);
\end{tikzpicture}
\end{document}