0

I want to have a section style like in the below picture.

The size of corners should be flexible with the length of the section title.

enter image description here

  • 1
    what you try so far? – Zarko Mar 26 '17 at 19:34
4

You can use tikz to draw the corners and titlesec to customize the format of headings:

\documentclass{article}
\usepackage{tikz}
\usepackage{titlesec}

\newcommand{\sectionformat}[1]{%
    \begin{tikzpicture}[baseline=(title.base)]
        \node (title) {\thesection\hspace{1em}#1};
        \draw[double] (title.west) |- (title.south) (title.north) -| (title.east);
    \end{tikzpicture}
}

% default values copied from titlesec documentation page 23
% parameters of \titleformat command are explained on page 4
\titleformat%
    {\section}% <command> is the sectioning command to be redefined, i. e., \part, \chapter, \section, \subsection, \subsubsection, \paragraph or \subparagraph.
    {\normalfont\Large\bfseries}% <format>
    {}% <label> the number
    {0em}% <sep> length. horizontal separation between label and title body
    {\sectionformat}% code preceding the title body  (title body is taken as argument)

\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}

screenshot

Edit: Please note that long headings will not break automatically. If you add a [align=left] after the \node you can insert line breaks by hand with \\.

|improve this answer|||||

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.