Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to simply draw a frame around a box which has rounded corners, and be able to control frame width, frame color, frame radius, box background colour (preferably without having to use the complex TikZ package)

eg. (this produces a framed box, but without the required rounded corners)

\documentclass{article}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancybox}
\begin{document}

\fboxsep=3pt
\fboxrule=2pt
\def\bordercolor{red}
\def\backgroundcolor{white}
\cornersize{0.9}
\fcolorbox{\bordercolor}{\backgroundcolor} {Here is some text}%

\end{document}
share|improve this question
2  
TikZ may be complex but a color box is very simple. Have, e.g., a look at Example: Boxes with text and math. –  Schweinebacke Nov 8 '11 at 11:27
    
It is reasonable simple to create a colored frame around a box with a colored background and control the parameters, but the rounded corners makes everything much more complicated, especially the background. For this you need TikZ or a similar package. –  Martin Scharrer Nov 8 '11 at 11:48
    
@Schweinebacke thanks, TikZ looks amazing but seems so complicated. Can you recommend a good tutorial on getting started with TikZ? –  Dan Nov 8 '11 at 12:16
    
@Dan: What's a good tutorial? IMHO this depends not only on the tutorial but also on the student. I like to read examples and usually use the package manuals to modify them. And I like the examples at the pgf manual. BTW: There are many more TikZ examples at texexample.net. –  Schweinebacke Nov 8 '11 at 12:32
    
@Schweinebacke: thanks, it seems the TikZ manual contains a tutorial media.texample.net/pgf/builds/pgfmanualCVS2010-09-28.pdf –  Dan Nov 8 '11 at 13:02

1 Answer 1

up vote 15 down vote accepted

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.]

share|improve this answer
    
I see there is a bug. –  Marco Daniel Nov 8 '11 at 11:31
    
At the moment I recommend framemethod tikz. –  Marco Daniel Nov 8 '11 at 11:36
    
@Seamus Looks like I have an old version of mdframed, as your example does not work for me. I'll update the package, and retry, thanks. –  Dan Nov 8 '11 at 12:19
    
Still have a problem after updating mdframed package to version: 2011-10-10 14:44:36... ! Package keyval Error: framemethod undefined. –  Dan Nov 8 '11 at 12:55
    
@Dan use \usepackage[style=1]{mdframed} instead. This is the old way of specifying using tikz. –  Seamus Nov 8 '11 at 13:09

Your Answer

 
discard

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.