# Strokes between cells of a tabular environment

I need what you see in the picture: these are cells from a tabular environment and I would like to draw strokes between cells, a bit in the manner of strokes in Xypic. I would have done it with xymatrix but I don't know how to align left, and furthermore the lower right cell would need an extra column in xymatrix and therefore also extra space between the 5th and 6th column of this table, while I rather would like it to be symmetric.

If I use tikz alone, I will spend ages making it look like a tabular environment (there are other tabulars in the document and I would like them all to look the same).

Therefore I think the easiest would be code that would allow to draw strokes between two cells of a tabular (or tabularx or longtable), in a manner similar to xymatrix. I.e., I first build the table, it looks like all other tables, and then I add the strokes without changing the table.

Has anyone done this?

Thanks to David Carlisle (thanks David, you are great!!) I managed to build this table. Here is what it looks like in XeLaTeX:

with the following code, after I installed the very new (only a few days old) package tikzmark and asked for \usetikzlibrary{tikzmark} right after calling package tikz:

\begin{tabular}{lccclcc}
\textsc{kanji}&
\tikzmarknode{a}{{\japanese 国}}&
\tikzmarknode{d}{{\japanese 道}}&
&\textsc{kanji}&
\tikzmarknode{g}{{\japanese 葡}}&
\tikzmarknode{j}{{\japanese 萄}}\\[6pt]
\textsc{phonology}&
\tikzmarknode{b}{/koku/}&
\tikzmarknode{e}{/dō/}&
&\textsc{phonology}&
\tikzmarknode{h}{/bu/}&
\tikzmarknode{k}{/dō/}\\[6pt]
\textsc{morphology}&
\tikzmarknode{c}{\{country\}}&
&\textsc{morphology}&
\multicolumn{2}{c}{\tikzmarknode{i}{\{grape\}}}
\end{tabular}

\begin{tikzpicture}[overlay,remember picture]
\draw [-,overlay,remember picture] (a.south) -- (b.north);
\draw [-,overlay,remember picture] (b.south) -- (c.north);
\draw [-,overlay,remember picture] (d.south) -- (e.north);
\draw [-,overlay,remember picture] (e.south) -- (f.north);
\draw [-,overlay,remember picture] (g.south) -- (h.north);
\draw [-,overlay,remember picture] (h.south) -- (i.north);
\draw [-,overlay,remember picture] (j.south) -- (k.north);
\draw [-,overlay,remember picture] (k.south) -- (i.north);
\end{tikzpicture}


Maybe someone can help me in adjust the lengths of the strokes? Notice that between the kanji and the second line the stroke is longer than between the second and the third line. How can I get strokes of equal length?

• Untested, but you could try adding a \strut in the text of each of the \tikzmarknodes. Unrelated sidenote: [-,overlay,remember picture] is not needed, as - is default and you have overlay,remember picture for the tikzpicture itself. – Torbjørn T. Oct 19 '19 at 19:42