# how can I make an fbox like command with certain color, shape and width of border?

I am using a style file that has a certain color for section headers.

I want to create a macro, which will behave the same like fbox, only:

1. There will be some (predefined) padding below, above, left and right of the border.

2. The border will have a certain (predefined) width, which is thicker than the default.

3. The color of the border will be the same color as the section headers (is there a variable that denotes section header text color?)

4. The shape of the border will be oval on the corners, and not pointy.

How would I go on in defining such a macro?

• See package tcolorbox Dec 18 '13 at 14:09
• apart from 4 the standard \fcolorbox does exactly that but for rounded corners you will need a pstricks or tikz based box macro (or at least, it's simpler that way) Dec 18 '13 at 14:23

As show in the comments, an easy solution is the tcolorbox package using tikz in the background. Another is the mdframed package. Both give highly configurables environments of the same names. See texdoc tcolorbox and texdoc mdframed for the options.

\documentclass[twocolumn,a5paper]{article}

\usepackage{tcolorbox}
\tcbset{%
colframe=blue!25,
colback=blue!10,
fonttitle=\bfseries,
coltitle=black,
}

\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{MyFrame}{%
backgroundcolor=blue!10,
frametitlebackgroundcolor=blue!25,
middlelinecolor=blue!25,
linewidth=1.5pt,
roundcorner=4pt,
innertopmargin=1ex,
innerbottommargin=.5\baselineskip,
innerrightmargin=1.5em,
innerleftmargin=1em
}

\begin{document}

\begin{tcolorbox}[title=The title]
This is a tcolorbox
\end{tcolorbox}

\begin{mdframed}[style=MyFrame,frametitle=The title]
This is a mdframed box
\end{mdframed}

\end{document}