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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a new section-like heading with TikZ. I basically want it to look like this (nevermind the funky background):

What I want

But I can only get something like this:

what I have

In my LaTeX document I call this with:


And here is the code I use to produce the (unsatisfactory) result above:


    \inheritanchor[from=rectangle]{north east} 
    \inheritanchor[from=rectangle]{south east} 
    \inheritanchor[from=rectangle]{north west} 
    \inheritanchor[from=rectangle]{south west} 
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y 
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y 
    \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} %left hand vertical line
    \pgfpathmoveto{\pgfpoint{\pgf@xb}{\pgf@yb}} %top vertical line

        \node[draw,shape=topbot,very thick, minimum width=\paperwidth, text width=.8\paperwidth] 
        {\large\textbf{Problems for Section~\thesection}}; 

I was trying to make the bottom left hand corner of the rectangle, and then make left hand side really thick.

Also, I'd like the rectangle to be the width of the page. (This will not be printed – hence I'm not too concerned about margins.)

share|improve this question
Does this have to be in tikz/pgf? – Werner Sep 7 '11 at 21:28
@Werner, nope but it should be something pdflatex can use. – Bart Snapp Sep 7 '11 at 21:39
Both answers below are fantastic!!! – Bart Snapp Sep 8 '11 at 18:00
up vote 10 down vote accepted

Here's a TikZ-free solution using the titlesec package (I wasn't sure about the length intended for the horizontal rule and its overhang, but you can easily change the dimensions):


  \chapter*{Problems for section~\thesection}


\setcounter{chapter}{1}\setcounter{section}{1}% just for the example


enter image description here

share|improve this answer
+1. This is probably The Correct Way to do it, particularly as it will almost certainly compile more quickly than anything done with TiKZ. – Niel de Beaudrap Sep 7 '11 at 22:53

You can do this best in TiKZ, I think, by using a simple \fill command and using relative co-ordinates, like so:



% Various lengths, vary to taste
\newlength\tablength        \setlength\tablength{20pt}
\newlength\ruledepth        \setlength\ruledepth{2pt}
\newlength\rulelength       \setlength\rulelength{0.95\textwidth}
\newlength\tabheight        \setlength\tabheight{0.25in} \addtolength\tabheight{-\ruledepth}
\newlength\raisetitle       \setlength\raisetitle{1ex}
\newlength\insettitle       \setlength\insettitle{1.5em}
\newlength\afterheadingskip \setlength\afterheadingskip{2ex}

    \node [inner sep=0pt] (title) at (0,0) {\bfseries Problems for Section~\thesection};
    \coordinate (inner corner) at ($(title.south west) + (-\insettitle,-\raisetitle)$);
    \coordinate (outer corner) at ($(inner corner) + (-\tablength,-\ruledepth)$);
    \fill [black] (outer corner) -- +(\rulelength,0) -- +(\rulelength,\ruledepth) 
                  -- (inner corner) -- +(0,\tabheight) -- +(-\tablength,\tabheight)
                  -- cycle;

\problems Text immediately following the section heading.


Customized section heading

share|improve this answer

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.