Notes about open source software, computers, other stuff.

LaTeX is a document preparation system that I used for most texts I’ve written since my Master’s thesis, the largest project being my PhD thesis.

Recently a friend of mine asked me if I could help him creating a boxed abstract. Normally a \framebox{} would have done the trick, but he wanted the word “Abstract” in the top left corner of the box. I tried a few variations on his start, but in the end I realised I could try my newly developped tikz skills on it. Together with Google I came up with the following solution that loads the tikz package and then defines the \boxabstract{} command.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 \usepackage{tikz} \usetikzlibrary{shapes,shadows} \tikzstyle{abstractbox} = [draw=black, fill=white, rectangle, inner sep=10pt, style=rounded corners, drop shadow={fill=black, opacity=1}] \tikzstyle{abstracttitle} =[fill=white]   \newcommand{\boxabstract}[2][fill=white]{ \begin{center} \begin{tikzpicture} \node [abstractbox, #1] (box) {\begin{minipage}{0.80\linewidth} % \setlength{\parindent}{2mm} \footnotesize #2 \end{minipage}}; \node[abstracttitle, right=10pt] at (box.north west) {Abstract}; \end{tikzpicture} \end{center} }

The resulting PDF looks like this:

Note that since the actual text is set in a minipage normal indentation is not set. This can be circumvented by uncommenting the line that sets the \parindent.

1. Ana

Hi,
Thanks for the post, it looks great. You saved me a lot of time…
Ana

Thanks for the post…. Really great….

• Kaveh Bazargan

Thanks, but the command is \boxabstract{}, right? Not \abstractbox{} 😉

• LCK

You’re right Kaveh. Thanks for pointing that out. I’ve updated the post accordingly.