Text over picture with white space

I'd like to label some level curves with values that are superimposed over the level curves, creating white space around the labels so that the underlying curves appear "broken". I figured a simple \mbox would work, but the curves pass right through .

\documentclass{article}

\begin{document}

\setlength{\unitlength}{1in}
\begin{picture}(0,0)(0,0)
\qbezier(0,0)(.5,-.5)(1,0)
\put(.45,-.3){\makebox{-8}}
\end{picture}

\end{document}


You need to add color to the background of the box, with the \colorbox macro from the xcolor package.

\documentclass{article}
\usepackage{xcolor}

\begin{document}

\setlength{\unitlength}{1in}
\begin{picture}(0,0)(0,0)
\qbezier(0,0)(.5,-.5)(1,0)
\put(.45,-.3){\colorbox{white}{-8}}
\end{picture}

\end{document}


• I added the xcolor package to my MikTeX installation, and ran the suggested code. It compiled fine, but appears exactly as it did with \makebox. Am I doing something wrong? – steven_nevets Aug 29 '13 at 21:05
• @user35910 I edited my result to show the figure that my LaTeX produces. Is that not what you get? Did you change the \makebox{-8} to \colorbox{white}{-8} – Steven B. Segletes Aug 29 '13 at 21:08
• I don't see the figure on this page, I'm sorry. I copied your code directly into a new latex document, and compiled. The image appears the same as it did with \makebox. The level curve passes through the -8. – steven_nevets Aug 29 '13 at 21:16
• @user35910 Oops. It's there now. – Steven B. Segletes Aug 29 '13 at 21:21
• I get it now! I needed to set my Yap rendering method to Dvips rather than Pk. Your solution is perfect. Thank you, Steven. – steven_nevets Aug 29 '13 at 22:00