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}
Here's a method that doesn't require loading TikZ explicitly. (Although
mdframed
[1] 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.]
[1] http://www.ctan.org/pkg/mdframedframemethod tikz
. - Marco Daniel
\usepackage[style=1]{mdframed}
instead. This is the old way of specifying using tikz. - Seamus
mdframed
, by the way. - Seamus
Although when seamus wrote his answer, tcolorbox
was not in CTAN, it was
announced
[1] just one month later. And as nobody has written an answer mentioning it, I do it.
So here you have a little code which shows how to declare a framed box with tcolorbox
. How to change it's width, frame color, background color, text alignment, space between text and frame border and rounded corners diameter.
For more funny options you can consult
tcolorbox
documentation
[2] or
dive here
[3]
\documentclass{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}
Here is some text
\end{tcolorbox}
\begin{tcolorbox}[width=5cm]
Here is some text
\end{tcolorbox}
\begin{tcolorbox}[width=.5\textwidth, colframe=red]
Here is some text
\end{tcolorbox}
\begin{tcolorbox}[width=8cm, colframe=red, colback=blue!30, halign=right]
Here is some text
\end{tcolorbox}
\begin{tcolorbox}[width=.5\linewidth, halign=center, colframe=red, colback=blue!30, boxsep=5mm, arc=3mm]
Here is some text
\end{tcolorbox}
\begin{tcolorbox}[width=7cm, colframe=red, colback=blue!30, arc=3mm, sharp corners=east]
Here is some text
\end{tcolorbox}
\end{document}
[1] http://ctan.org/ctan-ann/pkg/tcolorboxThis another option:
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[x=0.5mm,y=0.5mm]
\coordinate (a1);
\coordinate[right=150 of a1](a2);
\coordinate[below=90 of a1](a3);
\coordinate[right=150 of a3](a4);
%%
\draw[ultra thick,rounded corners=10] ($(a4)-(50,20)$) rectangle +(50*2,20*2);%Rectangle rounded
\end{tikzpicture}
\end{document}