I want a chapter style like this:

------chapter name-------------

      text text text text tex
      t text text text text t

I have come this far:







Text text text text


but I can not get it right. I want the horizontal line to be longer then the "normal" text and I want the line to be before and after the chapter name.

  • When you say "longer" do you mean all the page should be crossed by the line or only some cm on each side? – Ludovic C. Aug 7 '13 at 17:07

Her's an option using the explicit option for titlesec; the title is placed inside a varwidth environment of maximum width \textwidth; the left rule is drawn with a standard \rule command and the right rule uses \xrfill from the xhfill package. Long titles (spanning more than one line) are centered with respect to the rules:




\chapter{A short title}
\chapter{A long title spanning several lines just to see the format in this case}


An image of a short title:

enter image description here

An image of a long title:

enter image description here

  • Perfect. Shorter code and easier to follow! How to i do if i want say my abstract page to have this kind of style also? I copied your code and changed from Chapter to Section, but of course these changes every section in my document. Can i use different settings for the section in different part of the document or how to i solve this in an easy way? – Mike Aug 7 '13 at 18:19
  • @Mike hard to say if you don't provide precise information on the structure of your document. How are you producing your abstracta? Is your abstract a section produced with \section*? – Gonzalo Medina Aug 7 '13 at 18:23
  • I am using for my abstract \begin{abstract}, begin{notation} for notation page, \tableofcontents for table of content page. These pages i would like a similar style like the chapters. The sections in the different chapters will i probably want to use some ordinary style. Hope that helps with explaining my document. – Mike Aug 7 '13 at 18:33
  • @Mike no, it doesn't help much. In your question you mentioned the book document class, and this class doesn't provide an abstract environment nor a notation environment. You can use different styles for sections in your document, but I need to know the exact structure used to give you the most effective alternative. – Gonzalo Medina Aug 7 '13 at 18:42
  • The problem is that i am using a class made by my university. – Mike Aug 7 '13 at 18:47

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.