2

I want my chapter titles to be separated by two lines of different widths and thickness (and everything centerd on the page) like so:

 1 Some Chapter
     ----
 ############

This question probably actually boils down to how to achieve those differing centering lines in general, since that's what I'm struggling with. Searches for "double rule" and similar terms on google did not turn up anything meeting my specific needs. Following is a MWE of my somewhat best shot so far:

\documentclass{book}
\usepackage{titlesec}

\titleformat{\chapter}[block]{\centering\Large\sffamily\bfseries}{\Huge\ttfamily\thechapter}{0.25em}{}[{\rule[1em]{0.5\textwidth}{0.4pt}\vspace{1pc}\begin{center}\makebox{\rule[2\baselineskip]{0.8\textwidth}{0.6pt}}\end{center}}]


\begin{document}

\chapter{Lorem Ipsum}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\end{document}

Actually simple \hrule and \vspace commands probably come closer, but then the rules are not centered. When I searched for "center hrule" the solutions made use of \rule and so I ended up using that. Now however getting them below each other and with proper vertical spacing has become a pain. I'm at my wits end and would be grateful for some guidance.

  • Welcome to TeX SE! Thanks for the code. It would be helpful if you explained how the lines are going to be created. For example: in your code, the two lines are very apart from each other, do you want to reduce that space? Also, different lengths and widths, but how, depending on the title length? The more details you give about what you want, the better. Maybe even posting an additional mock-up picture of your desired result would be helpful. – Alenanno Sep 9 '16 at 10:39
  • Thanks for the quick comment. Yes I want that space between the lines to be smaller, much smaller. Probably something on the order of a few points. In general I would like a fairly generic answer, I'm not working off some reference or template so I'd like room to play around. However if you'd put a gun to my head I'd say the lines should be a few pt below the chapter title, with a spacing of a few point between them. The bottom line should be say 30% larger than the top and roughly double as thick. The width of the (top) line(s) should depend on \textwidth as in my MWE. – Daniel Sep 9 '16 at 11:03
2

titlesec has support for this kind of rules, check the documentation for \titlewidth. You can try to adjust this example to your needs:

\documentclass{book}
\usepackage[calcwidth]{titlesec}

\titleformat{\chapter}[block]
  {\filcenter\Large\sffamily\bfseries}
  {\Huge\ttfamily\thechapter}
  {0.25em}
  {}
  [{
    \begingroup
      \setlength{\titlewidth}{0.5\titlewidth}
      \titleline*[c]{\titlerule[.3pc]}
    \endgroup
    \addvspace{9pt}
    \begingroup
      \setlength{\titlewidth}{1.5\titlewidth}
      \titleline*[c]{\titlerule[.6pc]}
    \endgroup
    \addvspace{9pt}
    \begingroup
      \setlength{\titlewidth}{\columnwidth}
      \titleline*[c]{\titlerule[.6pc]}
    \endgroup  
  }]

\begin{document}

\chapter{Lorem Ipsum}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet.

\end{document}

enter image description here

  • Thank you very much that seems to do it. I read the titlesec doc extensively but did not realize this solution. – Daniel Sep 9 '16 at 11:41

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.