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.

In the below link


the author highlights anything which is important using a greyish color background. For example, if you see Equation 1.5.3 (which on page 22 of the book) it is highlighted in grey. I would like to know the TeX commands for producing similar output.

share|improve this question
check out the mdframed package. –  Harish Kumar Mar 5 '12 at 3:53
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Tobi Mar 5 '12 at 4:03
In addition to Harish’s comment I recommend to define commands and environments for those thing you want to highlight. So all of them look the same but can be change easily afterword if necessary. After checking mdframed you may post a minimal working example (MWE) to show, what you’ve tried so far … –  Tobi Mar 5 '12 at 4:06

2 Answers 2

up vote 16 down vote accepted

As mentioned in the comments, mdframed is perfect for this. You can combine it with your favourite theorem package too- in the MWE below I've used it with ntheorem, but there's nothing to stop you from using amsthm or something similar.

enter image description here

This example is very simple, but you can get very sophisticated using tikz or pstricks as the engine, as shown in the excellent documentation


\usepackage{xcolor}     % for colour
\usepackage{lipsum}     % for sample text
\usepackage{ntheorem}   % for theorem-like environments
\usepackage{mdframed}   % for framing



\section{mdframed for the win}

share|improve this answer
This is not working for me due to some reason. I am not getting the output. –  chandrasekhar Mar 5 '12 at 8:30
@chandrasekhar add \listfiles immediately before your \begin{document}- it sounds like your system needs to be updated –  cmhughes Mar 5 '12 at 16:57

With tcolorbox:

\usepackage[breakable, theorems, skins]{tcolorbox}

\begin{tcolorbox}[   %% Adjust the following parameters at will.
        enlarge left by=0mm,
        arc=0pt,outer arc=0pt,



enter image description here

tcolorbox integrates flawlessly with theorem packages and math. Further, it can produce more fancier boxes than one can imagine. I feel that this is the best option to adopt when one has to highlight text / math / theorems. Though I have defined a command, new environments can also be defined with tcolorbox. For details, texdoc tcolorbox or visit www.texdoc.net.

A sample preposition:



\begin{Proposition}{This is my proposition}{}

Earlier attempt:

Sorry for joining late. I would like to add to cmhughes's excellent answer. Though his reply is already accepted as the answer, I wish to share mine. My method is simple and direct where colors can be changed very easily.

\section{First section}

enter image description here

share|improve this answer
this won't break across pages though... –  cmhughes Mar 5 '12 at 16:58
@cmhughes Correct. But the file provided above by the OP does not require breaking across pages. It is for just highlighting small bits of text (like a line or two. I also go with mdframed for things like these. (as I commented above) My answer is added just for fun. –  Harish Kumar Mar 5 '12 at 22:52
@HarishKumar:Very nice way of doing it! –  Thanos Oct 7 '12 at 11:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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