Here's a method that doesn't require loading TikZ explicitly. (Although mdframed
uses tikz behind the scenes. This is, however, the package for framing boxes.
\documentclass{article}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\begin{document}
\begin{mdframed}[roundcorner=10pt]
\lipsum[1]
\end{mdframed}
\end{document}
If you don't even want to use TikZ as a backend, you could use PSTricks:
\documentclass{article}
\usepackage[framemethod=PStricks]{mdframed}
\usepackage{lipsum}
\begin{document}
\begin{mdframed}[roundcorner=10pt]
\lipsum[1]
\end{mdframed}
\end{document}
[Note this doesn't seem to be working for me at the moment.]
You can use TikZ
with the overlay
option and a correct anchor. That would look like this:
\documentclass{article}
\usepackage{tikz}
\newcommand\mybox[2][]{\tikz[overlay]\node[fill=blue!20,inner sep=2pt, anchor=text, rectangle, rounded corners=1mm,#1] {#2};\phantom{#2}}
\begin{document}
\noindent
this is some text \mybox[fill=blue!20]{box} text\\
this is some text box text
\end{document}
You can specify extra options (like I have done here for the color). By using the overlay
option and the text
anchor we ensure correct placement and no influence on spacing. The phantom
is added to get the normal spacing for the content of the box. This is the result of the example code:

Edit: To show that the vertical spacing is not affected either, consider the following:
\documentclass{article}
\usepackage{tikz}
\newcommand\mybox[2][]{\tikz[overlay]\node[fill=blue!20,inner sep=2pt, anchor=text, rectangle, rounded corners=1mm,#1] {#2};\phantom{#2}}
\begin{document}
\begin{minipage}{0.4\textwidth}
\noindent
this is some text \mybox[fill=blue!20]{box} text\\
this is some text box text
\end{minipage}
\begin{minipage}{0.4\textwidth}
\noindent
this is some text box text\\
this is some text box text
\end{minipage}
\end{document}
Which results in:

Best Answer
Have a look at the
mdframed
package: