For a cheat sheet I am making I would like that \paragraph{title} does the following:

  1. Centre the text 'title',
  2. on a shaded (gray) line across the entire page ( column in my case ),
  3. start the actual text in the paragraph without an indent.

Is this possible? If so, how should I set this up?

  • \par{title} ????
    – user31729
    Oct 18, 2015 at 10:02
  • \paragraph or any name actually Oct 18, 2015 at 10:05
  • 1
    minimal example missing. A solution is dependent on the class in use.
    – Johannes_B
    Oct 18, 2015 at 10:20
  • Since this is a cheat sheet, you could define your own command, which is much much simpler than changing a sectioning command. Much simpler.
    – Johannes_B
    Oct 18, 2015 at 11:46

2 Answers 2


Assuming that you are not using any KOMA class and your paragraph titles don't run in to more than one line, here is an example with titlesec package.

\usepackage{showframe}   %% for demo
\usepackage{lipsum}      %% for demo
\newcommand{\mytitle}[1]{\colorbox{gray!40}{\makebox[\dimexpr\columnwidth-2\fboxsep\relax]{\filcenter #1\strut}}}
\titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1em}

enter image description here

  • This is exactly what I was looking for. Thanks. Oct 18, 2015 at 11:05

An alternative solution, assuming you are using a KOMA class.

I used section here, instead of paragraph.


    \section{Penguins and Dixie dancing ducks}
  • You may note that this needs a recent KOMA version. Am I right?
    – user11232
    Oct 19, 2015 at 2:40
  • @HarishKumar Yes, it does. But i am not sure how recent.
    – Johannes_B
    Oct 19, 2015 at 8:07

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.