# how to obtain in node style definition size of shadow xshift?

drop shadows use transform canvas, consequently node's shadow is not inside picture bounding box. if i like to draw a node from left to right border of the tex area such, that shadow not spill out of text border, i need to reduce node width for amount of shadow xshift size. I wonder, how to obtain its size in definition of node style.

so far i try the following:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,

%------------- show page layout. don't use this in real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\vspace*{5ex}
\noindent\begin{tikzpicture}[
},
A/.style = {draw, fill=yellow!30, % my node
text width=\linewidth-2*\pgfkeysvalueof{/pgf/inner xsep}% this work
align=center,
},
]
\node (a) [DS=12pt/-4pt, inner sep=12 pt, A] {my annotated text};
\end{tikzpicture}
\end{document}


which gives:

as you can see, my attempt was unsuccessful. the question is, where is the error in using of the \pgfkeysvalueof{...}. did i at use of \pgfkeysvalueof{...} miss something or is my attempt to determine the size of the shadow xshift incorrect?

or is my expectation, that on this way is possible to obtain size of shadow xshift naive?

• Why do you want to cast a shadow? Are you a groundhog? – user121799 Mar 10 '18 at 22:52
• @marmot, good question :-) i had some (crazy) ideas about composing shapes styles from predefined building blocks. another reason was to learn a bit more about tikz. and not on the end, i'm not groundhog :-). – Zarko Mar 11 '18 at 9:11

As a workaround you could perhaps use .store in to save #2 in the DS style to a macro, and subsequently use that macro in A.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,

%------------- show page layout. don't use this in real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\vspace*{5ex}
\noindent\begin{tikzpicture}[

• thank you for answer (+1). since i'm not familiar with .store in i will first search/read in tikz manual to find more information. on the first sight it seem to be very promising. – Zarko Mar 10 '18 at 22:57