I'm trying to draw rounded rectangles with solid or dotted lines and a shadow around arbitrary text in LaTeX. I was hopeful that my answer was in How to draw rounded corners around box with shadow, but those don't work for me because both tcolorbox and mdframed want a new environment, and I want to keep the rounded rectangles inline like \fbox does.
Right now I'm using the following TikZ code:
\newcommand{\solidButton}[1]{\begin{tikzpicture}[baseline=(char.base)]
\node(char)[draw,rounded corners=0.75mm,fill=white,
shape=rectangle, inner ysep=3pt, inner xsep=2pt,
drop shadow={opacity=.6,shadow xshift=2pt, shadow yshift=-1pt},
minimum width=0.6cm, minimum height=0.35cm]
{#1};
\end{tikzpicture}}
\newcommand{\dottedButton}[1]{\begin{tikzpicture}[baseline=(char.base)]
\node(char)[draw,dotted,rounded corners=0.75mm,fill=white,
shape=rectangle, inner ysep=3pt, inner xsep=2pt,
drop shadow={opacity=.6,shadow xshift=2pt, shadow yshift=-1pt},
minimum width=0.6cm, minimum height=0.35cm]
{#1};
\end{tikzpicture}}
This looks the way I'd like it to:
... but all the TikZ (I use it 10-20 times/page) is making my document really slow to compile. Is there a more efficient way to do what I want?
dashbox
package. For rounded corners, try the\ovalbox
or\Ovalbox
commands fromfancybox
.tcolorbox
has thehbox
option, which allows you to have the box inline.\renewcommand\SolidButton{\textbf}
while you are writing the document, and then commenting it out in the final runs (maybe adding saving to mimic the final boxing) - you get the idea.