# How to shift a tikzmark?

I'd like the tikzmark to be centered on the line of the tabular, the optional argument seems not working or I missuse it :

\documentclass{article}
\usepackage{tikz,array}

\usetikzlibrary{tikzmark}

\begin{document}

\renewcommand{\arraystretch}{1.2}

\begin{tabular}{|c|}\noalign{\tikzmark[yshift=-5pt]{Z0}}\hline
foo
\end{tabular}

\tikz[overlay,remember picture]
\fill[orange] (pic cs:Z0) circle (.5pt) ;

\begin{tabular}{|c|}\noalign{\tikzmark[yshift=-5pt]{Z1}}
foo
\end{tabular}

\tikz[overlay,remember picture]
\fill[orange] (pic cs:Z1) circle (.5pt) ;

\end{document}


I guess it's the same reason why \begin{tikzpicture}[yshift=-5pt] wouldn't move a tikzpicture down. The option is applied to the content of the tikzpicture in the coordinate system of the diagram, but it doesn't affect the position of the tikzpicture on the baseline/page.

On the other hand, foo\raisebox{5pt}{\tikzmark{Z0}}\tikzmark{Z1}bar \tikz[overlay,remember picture] \draw[orange] (pic cs:Z0) -- (pic cs:Z1); works, because the \raisebox moves the tikzmark itself on the page, like it would the letter x for example.

Putting a \raisebox in the \noalign didn't work, but a slightly roundabout way could be to do this:

\documentclass{article}
\usepackage{tikz,array}

\usetikzlibrary{tikzmark}

\begin{document}

\renewcommand{\arraystretch}{1.2}

\begin{tabular}{|c|}\noalign{\tikzmark{top}}\hline
\raisebox{5pt}{\tikzmark{baseline}}foo
\end{tabular}

\begin{tikzpicture}[overlay,remember picture]
% if you want to use the same coordinate multiple times
% it makes sense to define a named \coordinate
\coordinate (foo) at ({pic cs:top} |- {pic cs:baseline});