# Analogue in TikZ for the command \psshadowbox of PSTricks

In PSTricks, the following code:

\documentclass{article}
\usepackage[usenames]{pstcol}
\usepackage{pst-plot}

\begin{document}

\noindent
gradmidpoint=1]%{$\mathcal{P}_{113}$}\\[2.9cm]
{\huge{\textbf{P 113}}}\\
gradmidpoint=1]%{$\mathcal{P}_{113}$}\\[2.9cm]
{\Large{\textbf{P 113}}}\\

\end{document}

generates the following figure (300% zoom):

Is there any way to make the same figure with TikZ? I found a template with which I could do something similar, but with fixed width:

\documentclass[svgnames]{article}
\usepackage{tikz}
\usepackage{array}
\newcommand{\pbox}[4]{%
\begin{tikzpicture}
\node[#3] {\begin{minipage}[t][#2][t]{#1}%
#4
\end{minipage}};
\end{tikzpicture}}

\begin{document}

\pbox{0.21 \textwidth}{}{rectangle,drop shadow, fill=Red,rounded corners=5pt,inner sep=6pt,
{\centering{\Huge{\textbf{P 113}}}}
\pbox{0.13 \textwidth}{}{rectangle,drop shadow, fill=Red,rounded corners=5pt,inner sep=6pt,
{\centering{\Large{\textbf{P 113}}}}

\end{document}

What I want is that the width of the box to automatically adapt the text (as with \psshadowbox) without having to vary the fraction \textwidth individually. On the other hand, I would change the color of the shadow made with TikZ to be the most similar to done with PSTricks block.

By default, the width of a TikZ \node is the natural width of its contents plus some inner sep padding on both sides, so basically all you had to do was to get rid of the minipage:

\documentclass[svgnames]{article}
\usepackage{tikz}

\definecolor{topColor}{RGB}{0,250,0}
\definecolor{botColor}{RGB}{170,255,46}
\definecolor{shaColor}{RGB}{180,234,90}

\tikzset{
mybox/.style={
rectangle,
rounded corners=5pt,
inner sep=6pt,
draw=topColor,
top color=topColor,
bottom color=botColor,
draw=Green
}
}

\begin{document}

\begin{tikzpicture}
\node[mybox]
{\Huge\textbf{P 113}};
\node[mybox] at (0,2)
{Some other longer test};
\end{tikzpicture}

\end{document}

Or, defining a command:

\documentclass[svgnames]{article}
\usepackage{tikz}

\definecolor{topColor}{RGB}{0,250,0}
\definecolor{botColor}{RGB}{170,255,46}
\definecolor{shaColor}{RGB}{180,234,90}

\tikzset{
mybox/.style={
rectangle,
rounded corners=5pt,
inner sep=6pt,
draw=topColor,
top color=topColor,
bottom color=botColor,
draw=Green
}
}

\newcommand\MyBox[2][]{%
\tikz\node[mybox,#1] {#2};
}

\begin{document}

\MyBox{\Huge\textbf{P 113}}\par\medskip
\MyBox{Some other longer test}

\end{document}

By the way, \Huge is not a command with arguments; it's a font switch to be used as in {\Huge <text>} or {\Huge <text>\par}, if required.