I was wondering if there is a latex package to get pseudo-3D style "buttons" as are often seen on the web, or if not is there an easy way to draw them?
An example of what I mean:
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI was wondering if there is a latex package to get pseudo-3D style "buttons" as are often seen on the web, or if not is there an easy way to draw them?
An example of what I mean:
This is an example of a simple button created with tikz:
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[
button/.style={
rectangle,
minimum size=6mm,
very thick,
rounded corners,
draw=red!50!black!74,
top color=red!50!black!70,
bottom color=white,
}]
\node[button] (button) {A Button!};
\begin{scope}[opacity=.6, transparency group]
\draw[white,fill=white,rounded corners={2pt}] ($ (button.north west) + (3pt,-3pt) $) rectangle ($ (button.north east) + (-3pt,-8pt) $);
\draw[white,fill=white,rounded corners={.5pt}] ($ (button.north west) + (3pt,-5pt) $) rectangle ($ (button.north east) + (-3pt,-8pt) $);
\end{scope}
\draw[white,fill=white,opacity=.8,rounded corners={1pt}] ($ (button.south west) + (5pt,2pt) $) rectangle ($ (button.south east) + (-5pt,4pt) $);
\end{tikzpicture}
\end{document}
I then used pdfcrop to crop the file, and gimp to convert the pdf to png:
Basically you do the same you would do in Inkscape, except that you don't have very good support for things like fading etc, so it will be somewhat limited.
Here's a little playground for this inspirational question and answers (plain-tex format; adjust for latex etc.):
\input tikz
\usetikzlibrary{shapes.geometric,shapes.symbols,shadows}
\tikzpicture[
button/.style={text=white,draw=#1!50!black,
preaction={drop shadow={shadow scale=1.05,shadow xshift=0pt,shadow yshift=-1pt}},
top color=#1!10,bottom color=#1!50!black,inner xsep=2ex,inner ysep=1.6ex,
},
plastic/.style={button=#1,shape=rectangle,rounded corners=1.6ex},
oval/.style={button=#1,shape=rectangle,rounded corners=2.5ex,ball color=#1},
any size/.style={button=#1,shape=ellipse,inner xsep=1ex, inner ysep=1ex},
slick/.style={button=#1,shape=tape,tape bend height=1ex,inner sep=1ex},
candy wrap/.style={button=#1,shape=rectangle,rounded corners=5ex},
smooth/.style={button=#1,shape=rectangle,rounded corners=2ex,
top color=#1!50!black,shading angle=45,bottom color=#1!10}
]
\draw (0,0)
\foreach \color in {red,green,blue} {
\foreach \shape in {plastic,oval,any size,slick,candy wrap,smooth} {
node[\shape=\color] {\shape} ++(2.5,0)
}
++(-15,1)
};
\endtikzpicture
\bye