I am searching a way to highlight in a particular way a text in latex. I know already the existence of the command \hl; however, it does not provide the result that I want.

Actually, I would like to add a vertical tick grey line on the left of a given paragraph. As I cannot go beyond the authorized margin of the document, the line should move somehow the text in the paragraph slightly on the right.

Do you know how to do that?

4 Answers 4


An alternative answer, making boxes breakable accross pages

\usepackage{tcolorbox,tikz, lipsum}
\begin{tcolorbox}[breakable, enhanced,colback=yellow!10!white,boxrule=0pt,frame hidden,
borderline west={1mm}{-2mm}{black}]

enter image description here


You also can use the leftbarenvironment from the framed package. It can break across pages. Here is an example, with a customised environment:

\usepackage{framed} %
\usepackage[table, svgnames]{xcolor}
\usepackage{lipsum} %

\def\FrameCommand{{\color{barcolour}\vrule width 4pt} \hspace{0.25em}}%{\dimexpr\parindent-3pt-\fontdimen2\font \relax}
\MakeFramed {\advance\hsize-\width \FrameRestore}\noindent\hspace{-\fontdimen2\font}}%




enter image description here


Please find mdframed based reply. Advantage of this is if paragraph is longer, then page breaks are smooth. This is given as a reply to some question in this forum.


\usepackage{mdframed} % Add easy frames to paragraphs
\usepackage{lipsum} % For dummy text
\usepackage{xparse} % Add support for \NewDocumentEnvironment
\definecolor{graylight}{cmyk}{.30,0,0,.67} % define color using xcolor syntax

\newmdenv[ % Define mdframe settings and store as leftrule

\NewDocumentEnvironment{parahigh}{O{{}}} % Define example environment



This approach cannot break across a page boundary.





enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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