I use a modified version of the TikZ-solution in another question to draw rounded rectangles around some text to mark it as a button of a program. It's no problem for single characters, but if I use longer terms (as the buttons are named in my program) I get problems with Overfull \hboxes.
MWE:
\documentclass[a4paper,10pt]{scrartcl}
\usepackage{tikz}
\newcommand*\rectangled[1]{\tikz[baseline=(char.base)]{
\node[shape=rectangle,draw,inner sep=2pt, rounded corners=4pt, thick] (char) {\sffamily{#1}};}}
\begin{document}
A rectangled number \rectangled{1}: No problem normally as it is used as normal charakter and TeX can set it in the right position.
A button with a longer name is marked using the same command and \rectangled{creates an Overfull \textbackslash hbox} if it is set to the end of a line.
\end{document}
The produced output looks like this:

Is there a better solution to avoid such Overfull \hboxes than rearrange the sentence until it produces no problem anymore?


\usepackage{microtype}. – Astrinus Dec 09 '14 at 22:13\sloppyto your document orsloppyparto the paragraph. – Steven B. Segletes Dec 09 '14 at 23:53