I'm having some difficulties to make something like that : I've been trying many things but I do not get anything like this...
Any ideas ?
Thanks

NEW: TikZ book now 40% off at Amazon.com for a short time.
Code: Select all
\documentclass{article}\usepackage{xcolor}\usepackage{titlesec}% \titleformat{command}[form]{layout}{label-layout}{skip}{before-code}[after-code]\renewcommand*\thesection{\arabic{section}.}\newcommand\secformat[1]{%\huge\colorbox{gray}{\parbox{\dimexpr\linewidth-6pt}{\bfseries\color{white}\thesection~#1}}}\titleformat{\section}[block]{\normalfont\rmfamily}{}{0pt}{\secformat}\usepackage{kantlipsum}% for some sample text\begin{document}\section{Introduction}\kant[1-3]\end{document}
\linewidth
is 6pt
too wide in the example above?You have to take the lengthcgnieder wrote:[…] PS: I'm sure I'm missing something obvious: does anybody know why\linewidth
is6pt
too wide in the example above?
\fboxsep
(default value 3pt) into account. It appears two times here so the width of your \parbox
should be \dimexpr\linewidth-2\fboxsep
.Of course! I feel stupid now ...localghost wrote:You have to take the length\fboxsep
(default value 3pt) into account.
\tableofcontent
?NEW: TikZ book now 40% off at Amazon.com for a short time.