I recently read a book Algorithm Design by Jon Kleinberg and Eva Tardos, which is written in a very unique style. This book doesn't have any typical LaTeX environments such as theorem, lemma, and corollary as in CLRS textbook. Instead, all these important blocks are numbered sequentially.

For example, this image is captured from page 7 in chapter 1 of the KT textbook, which is available from the publisher's website. (This page explains Gale-Shapley's algorithm for Stable Marriage Problem.)

enter image description here

As you can see, the block numbered (1.1) and (1.2) can be Lemma in the usual textbook and (1.3) can be theorem. I love their writing style and I want to mimic it.

My Question: What is the best way to mimic this style of writing? Let's say that I want to define an environment textblock which does the following to copycat KT style of writing.

  1. This environment can be either shaded or not. (As shown in the above picture, (1.3) block is shaded while (1.1) and (1.2) are not.)
  2. The numbering of this environment includes chapter number.
  3. I'd like this block spans across the entire textwidth.

How can I define such an environment?


Here's an implementation with amsthm and tcolorbox:


\usepackage{lipsum} % just for the example


 {\topsep}% space above
 {\topsep}% space below
 {\itshape}% body font
 {}% indent
 {\bfseries}% head font
 {}% punctuation
 {1em}% space between head and body


  frame empty,
  grow to left by=6pt,
  grow to right by=6pt,




Some text to see what happens,
some text to see what happens,
some text to see what happens,
some text to see what happens.


Other text that should be the statement of
an important theorem, so it is on a grey



enter image description here


One approach without any package except xcolor for the shaded block:


\usepackage[margin=1cm]{geometry} % little margin for MWE
\usepackage{lipsum} % dummy text for MWE
\usepackage{xcolor} % for shaded gray block
  \noindent\textbf{(\thesection.\thepara)}\quad{\em #1}
\def\blockg#1{ %

\section{Lore ipsum}    
\lipsum[11]         % normal text
\block{\lipsum[2]}  % block 1.1
\lipsum[3]          % normal text
\blockg{\lipsum[4]} % block 1.2
\lipsum[5]          % normal text
\section{Dolor sit amet}    
\lipsum[12]         % normal text
\block{\lipsum[13]} % block 2.1

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.