Using the anchors defined by tikzpagenodes
inside a minipage
produces unexpected results; this is not the case for the current page
family of anchors defined by standard TikZ as the following example shows.
Labels in cyan
correspond to the standard TikZ anchors which are correctly positioned ("cp" stands for "current page"); labels in orange correspond to tikzpagenodes
anchors which are correctly positioned ("ta" stands for "text area"); labels in red correspond to tikzpagenodes
anchors which are not correctly positioned since the anchors were called from withing a minipage
("ta" stands for "text area"). The showframe
package was used to have a visual guide of the page layout; the minipage
also was framed for reference
\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage{tikzpagenodes}
\usepackage{showframe}
\begin{document}
\centering
\begin{tikzpicture}[remember picture,overlay]
\foreach \Anchor in {north,west,south,east}
{
\node[font=\color{orange}] at (current page text area.\Anchor) {ta.\Anchor};
\node[font=\Huge\color{orange}] at (current page text area.\Anchor) {X};
}
\end{tikzpicture}%
\frame{\begin{minipage}[c][4cm][c]{.5\textwidth}
\begin{tikzpicture}[remember picture,overlay]
\foreach \Anchor in {north,west,south,east}
{
\node[font=\color{cyan}] at (current page.\Anchor) {cp.\Anchor};
\node[font=\Huge\color{cyan}] at (current page.\Anchor) {X};
\node[font=\color{red}] at (current page text area.\Anchor) {ta.area.\Anchor};
\node[font=\Huge\color{red}] at (current page text area.\Anchor) {X};
}
\end{tikzpicture}%
\end{minipage}}
\end{document}
How can the correct anchors defined by tikzpagenodes
be recovered when used inside a minipage
.