# Latex Text Box with colored background that breaks as normal text

I want to define a command, lets say

\quote{
This is a .... very long quote
}


that has a solid colored (in my case light gray) background, and ideally a colored line on the left side.

however, it should allow formatting and should break pages just like normal text. At the moment, I am using a colorbox that just continues on the same page on and on until there is no "paper" left.

\NewEnviron{myquote}{
\colorbox{medium}{
\parbox{\dimexpr\linewidth-2\fboxsep\relax}{%
\BODY
}
}
}

\newcommand\quote[1]{
\begin{myquote}
#1
\end{myquote}
}

• I think you need \usepackage{tcolorbox}. – Sigur Feb 19 at 17:58

Here you have an example with tcolorbox. Colors and margins can be easily adapted.

\documentclass{article}
\usepackage[most]{tcolorbox}

\newtcolorbox{myquote}[1][]{%
colback=black!5,
colframe=black!5,
notitle,
sharp corners,
borderline west={2pt}{0pt}{red!80!black},
enhanced,
breakable,
}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{myquote}
\lipsum[1-5]
\end{myquote}

\end{document}


• @Tobi Thank you for accepting my answer. I've changed it after your acceptance because the new solution doesn't show the frame artifact behind the box. Hope it helps. – Ignasi Feb 19 at 18:25