Hi!
I would like to add a horizontal line after all my Chapter headings and also after the TOC title, so it looks this way:
Contents
--------------------------------------------------------------
Chapter 4
--------------------------------------------------------------
Title of the Chapter 4
I cannot figure out how to do it! I can't simply add a Horizontal Line (as a special character) before the title of the chapter, because it will appear in TOC, and the line will also be printed far away from the words "Chapter 4".
Any ideas?
Thank you very much!
marta.
LyX ⇒ How to add a horizontal line after Chapter and TOC headings?
NEW: TikZ book now 40% off at Amazon.com for a short time.
Re: How to add a horizontal line after Chapter and TOC headings?
Hi,
I think I solved it, so I am going to post how I did it in case someone has the same problem XD.
I work with a book class of document, so if we want a horizontal line appearing after the title "Contents" in the ToC, we must add in the preamble:
\usepackage{tocloft}
\renewcommand{\cftaftertoctitle}{
\vspace{5pt}
\hrule}
And, if we wish to modify our chapter headings style, we must use: (I insert example)
1. For NOT NUMBERED chapters
\renewcommand{\@makeschapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\interlinepenalty\@M
\Huge \textbf {#1}\par % Prints the Chapter title (#1)
% in Huge bold font
\vspace{4pt}% % adds vertical space
\hrule % adds horizontal line
\nobreak
\vskip 40\p@ % also adds vertical space
}}
2. For NUMBERED chapters
\renewcommand{\@makechapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\Large\textbf \@chapapp\space \textbf \thechapter. % Adds the line
% "Chapter #." with
% # being the
% Chapter number
% \vspace{5pt}% % adds vrtical space
\par\nobreak
\vskip 5\p@
\fi
\interlinepenalty\@M
\Huge \textbf {#1}\par % chapter title
\vspace{4pt}% % adds vrtical space
\hrule % horizontal line
\nobreak
\vskip 40\p@
}}
If you want for example, small caps instead of normal font in the title, you can use \scshape instead of \textbf, for instance. But after it you will have to use \rm if you want the rest of the words to become low case again.
I think I solved it, so I am going to post how I did it in case someone has the same problem XD.
I work with a book class of document, so if we want a horizontal line appearing after the title "Contents" in the ToC, we must add in the preamble:
\usepackage{tocloft}
\renewcommand{\cftaftertoctitle}{
\vspace{5pt}
\hrule}
And, if we wish to modify our chapter headings style, we must use: (I insert example)
1. For NOT NUMBERED chapters
\renewcommand{\@makeschapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\interlinepenalty\@M
\Huge \textbf {#1}\par % Prints the Chapter title (#1)
% in Huge bold font
\vspace{4pt}% % adds vertical space
\hrule % adds horizontal line
\nobreak
\vskip 40\p@ % also adds vertical space
}}
2. For NUMBERED chapters
\renewcommand{\@makechapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\Large\textbf \@chapapp\space \textbf \thechapter. % Adds the line
% "Chapter #." with
% # being the
% Chapter number
% \vspace{5pt}% % adds vrtical space
\par\nobreak
\vskip 5\p@
\fi
\interlinepenalty\@M
\Huge \textbf {#1}\par % chapter title
\vspace{4pt}% % adds vrtical space
\hrule % horizontal line
\nobreak
\vskip 40\p@
}}
If you want for example, small caps instead of normal font in the title, you can use \scshape instead of \textbf, for instance. But after it you will have to use \rm if you want the rest of the words to become low case again.