2

I'd like to add in tikzcd some arrows pointing to a specific line (here the line JKL). However my code always point to the top of the cell (when it's even producing a meaningfull output):

enter image description here

I'm not sure why, but tikzmarknodes were reported to work here.

MWE:

\documentclass{article}
\usepackage{tikz-cd,amssymb}
\usetikzlibrary{tikzmark,quotes}
\usepackage{tabularx}
\newcolumntype{L}{>{$}l<{$}}

\begin{document}
\tikzset{
  point line/.style={
    to path={
      (#1-|{\tikztostart.east}) -- (#1-|{\tikztotarget.west})
      \tikztonodes
    }
  }
}

\begin{tikzcd}
  A \rar[point line=myline] & |[fill=green]| \tiny \begin{tabular}{@{}L@{}}
                                  ABC\\
                                  DEF\\
                                  GHI\\
                                  \tikzmarknode{myline}{JKL}\end{tabular}
\end{tikzcd}
\end{document}

1 Answer 1

5
\documentclass{article}
\usepackage{tikz-cd,amssymb}
\usetikzlibrary{tikzmark,quotes}
\usepackage{tabularx}
\newcolumntype{L}{>{$}l<{$}}

\begin{document}
\tikzset{
  point line/.style={
    to path={
      (#1-|{\tikztostart.east}) -- (#1-|{\tikztotarget.west})
      \tikztonodes
    }
  }
}

\begin{tikzcd}[overlay, remember picture]
  A \rar[point line=myline] & |[fill=green]| \tiny \begin{tabular}{@{}L@{}}
                                  ABC\\
                                  DEF\\
                                  GHI\\
                                  \tikzmarknode{myline}{JKL}\end{tabular}
\end{tikzcd}
\end{document}

Arrow pointing to line in array

1
  • Thanks for your answer. Unfortunately adding [overlay, remember picture] has another problem: the figure now takes zero height and width, and overlaps the text around. But adding only remember picture gives the appropriate result (compile twice or the result is really ugly, with an image going even in a different page)! Thanks a lot!
    – tobiasBora
    Commented Dec 6, 2021 at 7:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .