TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would one achieve an "raised-text-box-effect (with added shadows)" like in the picture below for G(V, E) (the \raisebox command apparently isn't meant for this task):

raised text-box

share|improve this question
@adn Thank you for allowing the image! – Blaz Jan 3 '12 at 8:46
You can use a simple LaTeX-Command \shadowbox. Alternativ you use tikz or pstricks. – Marco Daniel Jan 3 '12 at 9:11
@MarcoDaniel You've meant \shadowbox from the fancybox package? Because (using MikTeX 2.7 and TeXworks) I can only use \shabox (not \shadowbox) from the \usepackage{shadow}. Also, even with \shabox "working", I don't know how to set, say, the box's size. – Blaz Jan 3 '12 at 9:43
The package fanycybox uses only simple rule commands to provide the shadowbox-command. This was the command I meant. Here an example: \documentclass[12pt]{article} \usepackage{fancybox} \begin{document} Text \shadowbox{$G(V,e)$} Text \end{document} – Marco Daniel Jan 3 '12 at 10:47
fancybox has no option to "soft" the shadow. You can define your own shadobox with tikz to set such an environment. An example is given on texample. In relation to the link (UNTESTED):\documentclass[12pt]{article} \usepackage{tikz}\usetikzlibrary{shapes,arrows,shadows} \tikzstyle{shadownode}{draw,fill=blue!20,dropshadow,anchor=west} \begin{document}Text\tikz[baseline=current bounding box.west]\node[shadownode]{$G(V,e)$};\end{document} – Marco Daniel Jan 3 '12 at 12:35
up vote 11 down vote accepted

    [baseline=(X.base)]\node [drop shadow,fill=white,draw,very thin] (X) {#1};

Text \raisedtext{Hello World!} Text

enter image description here

share|improve this answer
No document class? – doncherry Jan 3 '12 at 15:10
@doncherry Whatever one likes, actually; I added one. – egreg Jan 3 '12 at 15:11
Replaced the image with one that is not jagged, and removed related comment. – Peter Grill Jan 3 '12 at 15:13
@PeterGrill Thanks – egreg Jan 3 '12 at 15:15
Very useful snippet, thank you. – Blaz Jan 3 '12 at 16:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.