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}
\newcounter{encadre}
\newenvironment{encadre}
\refstepcounter{encadre}\vspace{0.2cm}\textsc{\bfseries encadré \theencadre\ :}}
{\par\vspace{0.2cm}}
\begin{document}
\lipsum
\fcolorbox{Black}{Gray}{
\begin{minipage}{\linewidth}
\begin{encadre}\label{enc:metamere}
blabla
\end{encadre}
\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}
\newcounter{encadre}
\newenvironment{encadre} {\refstepcounter{encadre}
\vspace{0.3cm}\textsc{\bfseries encadré \theencadre\ :}}
{\par\vspace{0.3cm}}
\begin{document}
\lipsum [50]
\begin{framed}
\begin{encadre} test
\end{encadre}\label{enc}
\lipsum[15]
\end{framed}
l'encadré \ref{enc} est à la page \pageref{enc}
\lipsum
\end{document}
shadecolor
will only have effect if theshaded
environment fromframed
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 packagexcolor
documentation for details.\usepackage[shaded]{framed}
but does not workshaded
environment.