I'm trying to correctly align a tikzpicture
consisting of text inside an arrow that I put in the footer. My problem is that I want the arrow tip aligned with the eastern edge of the footer and I want the baseline of the text to align with the rest of the text in the other parts of the footer.
None of the anchoring options seem to yield what I want. If I use the base east
anchor, the text is correctly aligned but the arrowhead sticks out into the margin, as shown here:
I'm aware of how to add a manual shift. In the MWE below, I have a more or less working solution by using yshift
to pull the arrow up to the right place, but the value is one that I determined by eyeballing it. That solution looks like this:
However, it's obviously only valid for this one size. Is there a way to have tikz
calculate the shift automatically?
Here's my MWE:
\documentclass{memoir}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{positioning,calc,shapes.arrows}
\usepackage{showframe}
\usepackage{lipsum}
\renewcommand*{\ShowFrameColor}{\color{red}}
% This version correctly aligns the CONTINUE text to the baseline,
% but the arrow head sticks out into the margin.
\newcommand{\ContinueNotice}{%
\begin{tikzpicture}[remember picture,overlay, font={\large\sffamily\bfseries}]
\node[single arrow,single arrow head extend=3pt,fill=black,text=white,anchor=base east]
at (current page footer area.south east) {\enspace CONTINUE\enspace};
\end{tikzpicture}%
}
% This version is more or less correctly aligned, but the yshift is done by eye.
\newcommand{\ContinueNoticeAlt}{%
\begin{tikzpicture}[remember picture,overlay, font={\large\sffamily\bfseries}]
\node[single arrow,single arrow head extend=3pt,fill=black,text=white,anchor=east,yshift=-2pt]
at (current page footer area.east) {\enspace CONTINUE\enspace};
\end{tikzpicture}%
}
\makepagestyle{TestStyle}
\makeoddfoot{TestStyle}{\footnotesize Some Notice}{\thepage}{\ContinueNotice}
\makeevenfoot{TestStyle}{\footnotesize Some Notice}{\thepage}{\ContinueNoticeAlt}
\pagestyle{TestStyle}
\begin{document}
\lipsum
\end{document}