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.

Possible Duplicate:
Is there an \arrayrulecolor-like command to change the rule color of \fbox?

I'm using an \fbox to have a border around a minipage.

\fbox{
\begin{minipage}{0.25\textwidth}
my content
\end{minipage}
}

Is there any way to set the border color of the \fbox?

share|improve this question

marked as duplicate by lockstep, Werner, topskip, egreg, Count Zero Mar 2 '12 at 9:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You can also use the package tcolorbox. –  Marco Daniel Mar 1 '12 at 20:10
    
Note that the line break after the first { will add a space there. You should add a % direct after it to avoid that. The same might be required after \end{minipage}. –  Martin Scharrer Mar 1 '12 at 20:18
2  
@lockstep: I see the connection to the linked question, but because it is not a very good phrased question with only minimalistic answers I'm against closing this question as a duplicate. –  Martin Scharrer Mar 1 '12 at 20:20

3 Answers 3

up vote 11 down vote accepted

The xcolor package provides \fcolorbox{<frame color>}{<background color>}{<text>}. You can also use my adjustbox package with the cfbox=<color> and minipage=<width> keys:

\usepackage{xcolor}
\usepackage{adjustbox}

% ...

\adjustbox{minipage=0.25\textwidth,cfbox=<color>}{<content>}

% or, if the whole thing should be 0.25\textwidth wide, including the border:

\adjustbox{minipage=0.25\textwidth-2\fboxsep-2\fboxrule,cfbox=<color>}{<content>}

You can define your own command using:

\newcommand\myfbox{\adjustbox{<keys>}}
% usage: \myfbox{<content>}
share|improve this answer

I would recommend the mdframed package, which provides many options- you can frame your environment quite simply, or if you want complicated examples you can use tikz, pstricks.

The documentation has many examples, and you can find questions tagged with mdframed here

http://tex.stackexchange.com/questions/tagged/mdframed

enter image description here

\documentclass{article}

\usepackage{lipsum}
\usepackage[framemethod=default]{mdframed}

\newmdenv[linecolor=red,backgroundcolor=yellow]{myframe}

\begin{document}

\begin{myframe}
\lipsum[1]
\end{myframe}

\end{document}
share|improve this answer
\documentclass{article}
\usepackage{xcolor,lipsum}
\begin{document}    
\fcolorbox{red}{yellow}{\parbox{\dimexpr \linewidth-2\fboxsep-2\fboxrule}{%
\lipsum[1]}}

\end{document}

enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.