Girish
In the following code the arc drawn is overlapping on the text. I searched for the solution and tried ` every node/.append style={transform shape}` in place of `transform canvas={yshift=1em}` but it didn't work. I just want proper overarc on the text, `{yshift=1em}` is just to produce an output to give an idea of what I am looking for.
```
\documentclass{article}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\ExplSyntaxOn
\tl_new:N \l_aa_tl
\tl_new:N \l_bb_tl
\tl_new:N \l_cc_tl
\int_new:N \l_counter_int
\tl_const:Nx \c_colon_tl { \token_to_str:N : }
\tl_new:N \l_names_tl
\tl_put_right:Nx \l_names_tl {abcdefghijklmnopqrstuvwxyz}
\NewDocumentCommand\foo{m}
{
\tl_set:Nn \l_aa_tl {#1}
\int_set:Nn \l_counter_int {1}
\int_while_do:nNnn {\l_counter_int}<{6}
{
\tl_set:Nx \l_bb_tl {\tl_item:Nn \l_names_tl{\l_counter_int}}
\tl_set:Nx \l_cc_tl {\tl_item:Nn \l_names_tl{\l_counter_int+1}}
\exp_args:NNnx \tl_replace_once:Nnn \l_aa_tl {<} { \exp_not:N \tikzmark{\l_bb_tl} }
\exp_args:NNnx \tl_replace_once:Nnn \l_aa_tl {>} { \exp_not:N \tikzmark{\l_cc_tl} }
\tikz[remember~picture,overlay,baseline=0pt,transform~canvas={yshift=1em}] \draw (pic~cs \c_colon_tl \l_bb_tl) edge[bend~left](pic~cs \c_colon_tl \l_cc_tl );
\int_add:Nn \l_counter_int{2}
}
\tl_use:N \l_aa_tl
}
\ExplSyntaxOff
\begin{document}
Meow Meow MeowMeowMeowMeow Meow Meow MeowMeowMeow MeowMeow MeowMeowMeowMeow Meow \foo{ab<dsdsddcdd>efgh<ifgfgfjk>lmnop}
\end{document}
```
Top Answer
user 3.14159
There are two problems:
1. `overlay` does not provide us with a bounding box.
2. You iterate over the list in a hard-coded way, i.e. `\tikz` gets called three times even though there are only two arcs.
The first problem can be solved by measuring the height of the arc and inserting the respective vertical space. The second problem requires a change of strategy from your side, but I was able to suppress the problem using `\ifdim\pftvert<10pt ...\fi`. (The distance between the top of the arc and the line above is set to `2pt`.)
```
\documentclass{article}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc,tikzmark}
\ExplSyntaxOn
\tl_new:N \l_aa_tl
\tl_new:N \l_bb_tl
\tl_new:N \l_cc_tl
\int_new:N \l_counter_int
\tl_const:Nx \c_colon_tl { \token_to_str:N : }
\tl_new:N \l_names_tl
\tl_put_right:Nx \l_names_tl {abcdefghijklmnopqrstuvwxyz}
\NewDocumentCommand\foo{m}
{
\tl_set:Nn \l_aa_tl {#1}
\int_set:Nn \l_counter_int {1}
\int_while_do:nNnn {\l_counter_int}<{6}
{
\tl_set:Nx \l_bb_tl {\tl_item:Nn \l_names_tl{\l_counter_int}}
\tl_set:Nx \l_cc_tl {\tl_item:Nn \l_names_tl{\l_counter_int+1}}
\exp_args:NNnx \tl_replace_once:Nnn \l_aa_tl {<} { \exp_not:N \tikzmark{\l_bb_tl} }
\exp_args:NNnx \tl_replace_once:Nnn \l_aa_tl {>} { \exp_not:N \tikzmark{\l_cc_tl} }
\tikz[remember~picture,overlay,baseline=0pt,transform~canvas={yshift=1em}] \draw (pic~cs \c_colon_tl \l_bb_tl)
to[bend~left] coordinate[pos=0.5] (aux)
(pic~cs \c_colon_tl \l_cc_tl );
\begin{tikzpicture}[baseline=0pt]
\path[overlay,remember~picture] let \p1=($(aux)-(pic~cs \c_colon_tl \l_bb_tl)$)
in \pgfextra{\xdef\pftvert{\y1}};
\ifdim\pftvert<10pt%<- because of your hard-coded iterations
\path (0,1em+\pftvert+2pt);
\fi
\end{tikzpicture}
\int_add:Nn \l_counter_int{2}
}
\tl_use:N \l_aa_tl
}
\ExplSyntaxOff
\begin{document}
Meow Meow MeowMeowMeowMeow Meow Meow MeowMeowMeow MeowMeow MeowMeowMeowMeow Meow
\foo{ab<dsdsddcdd>efgh<ifgfgfjk>lmnop}
\end{document}
```
![Screen Shot 2020-07-10 at 10.06.31 AM.png](/image?hash=9970f94910d03ebf1e611eb9ade2d30bb7024eb4414cf9f9529f5bb22f243dce)