# background framed box with newenvironment “encadre”

I want to use a floating framed box that could be nicely placed in the text. \fbox needs to be placed by hand. I wrote this code which was exactly what I want to get...but with a floating object.

\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{lipsum}
\usepackage{caption}
\usepackage[usenames,dvipsnames]{color}
\usepackage{framed}
\usepackage{hyperref}
{\par\vspace{0.2cm}}
\begin{document}
\lipsum
\fcolorbox{Black}{Gray}{
\begin{minipage}{\linewidth}
blabla
\lipsum[10]
\end{minipage}
}
\end{document}


So I use framed (impossible to install mdframed on my LaTeX version of 2009 on Ubuntu 12.04)

My question : Where must I define \defineshadecolor as it is said in the framed documentation?

framed doc p2 :"In fact, the “shaded” environment just redefines \FrameCommand to be \colorbox{shadecolor} (and you have to define the color “shadecolor”: \definecolor{shadecolor}...)."

I tried to put it as an option or to write it like directly in the preamble, but it does not work. Here is the framed code, but without background.

\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{hyperref}

{\par\vspace{0.3cm}}

\begin{document}
\lipsum [50]

\begin{framed}
\lipsum[15]
\end{framed}

l'encadré \ref{enc} est à la page \pageref{enc}

\lipsum
\end{document}

• shadecolor will only have effect if the shaded environment from framed is used, since you are not using it, shadecolor will do nothing in your code. In any case, you can define it using \definecolor (as in \definecolor{shadecolor}{RGB}{123,45,67}) or \colorlet (as in \colorlet{shadecolor}{red}) .See the package xcolor documentation for details. – Gonzalo Medina Feb 18 '14 at 14:25
• Thanks a lot; I try that, putting \definecolor{shadecolor}{RGB}{123,45,67} in the preambule...but it has no effect, it is my problem. perhaps isn't it the write place to put it? – catindri Feb 18 '14 at 14:33
• I try also \usepackage[shaded]{framed} but does not work – catindri Feb 18 '14 at 14:41
• OK!! I just find it [tex.stackexchange.com/questions/86205/… – catindri Feb 18 '14 at 14:43
• Yes, as I said in my comment, you need to use the shaded environment. – Gonzalo Medina Feb 18 '14 at 14:44

Here the solution, thanks a lot to Gonzalo

 \documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{lipsum, caption, xcolor, framed}
{\par\vspace{0.3cm}}

\begin{document}
\lipsum [50]
\begin{framed}
\lipsum[15]
\end{framed}
\lipsum
\end{document}


Here and example of "Encadré" box with package tcolorbox. I do not know why, but it needs the package to be in the same folder than the .tex file. It does not work if the tcolorbox.sty is the usual location (for me /usr/share/texmf/tex/latex)

documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{lipsum, xcolor}
\usepackage{tcolorbox}
\newtcolorbox[auto counter,number within=chapter]{encbox}[2][]{%
colback=blue!5!white,colframe=blue!75!black,fonttitle=\bfseries,