1.6.12

How can I hide the chapter headings number on LaTeX and change the spacing?


I'm writing my Thesis but I have run into some layout troubles, I'm using the standard book document class, which results in my Chapters headings in the form of:
Chapter #
Name of my chapter
I was looking for a way to change it, removing the "Chapter #" from it to the form of:
Name of my chapter

Here's a possible solution using the titlesec package; setting the value of \aftertitleunit to\baselineskip, you can then use *2 in the fourth mandatory argument of \titlespacingto obtain the desired vertical spacing between the title and the following text. You didn't provide information on the spacing before the title so I used 50pt, but you can change this value to the one that best suits your needs. To maintain consistency between the numbered and unnumbered chapters I used two \titleformat commands with similar settings: one for the numbered chapters and another one, using the numberless key, for the unnumbered ones:
\documentclass{book}
\usepackage{titlesec}
\setlength\aftertitleunit{\baselineskip}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titleformat{name=\chapter,numberless}[display]
  {\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titlespacing*{\chapter}{0pt}{50pt}{*2}
\begin{document}
\chapter{Test Numbered chapter}
\chapter*{Test Unumbered chapter}
\end{document}
Taking into account the edit to the original question, you can add \normalsize just before\vskip2\baselineskip:
\makeatletter
\renewcommand{\@makechapterhead}[1]{\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\hrule                                        % horizontal line
\vspace{5pt}%                                 % add vertical space
\interlinepenalty\@M
\Huge \scshape #1\par                        % chapter title
\vspace{5pt}%                                 % add vertical space
\hrule                                        % horizontal rule
\nobreak\normalsize
\vskip 2\baselineskip
}}
\renewcommand{\@makeschapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\hrule                                        % horizontal line
\vspace{5pt}%                                 % add vertical space
\interlinepenalty\@M
\Huge \scshape #1\par                         % chapter title
\vspace{5pt}%                                 % add vertical space
\hrule                                        % horizontal line
\nobreak\normalsize
\vskip2\baselineskip
}}
\makeatother
And here's the same layout but using titlesec:
\documentclass{book}
\usepackage{titlesec}
\setlength\aftertitleunit{\baselineskip}
\titleformat{\chapter}[display]
  {\normalfont\Huge \scshape}{\titlerule}{-33pt}{\Huge}[\vspace{-4pt}\titlerule]
\titleformat{name=\chapter,numberless}[display]
  {\normalfont\Huge \scshape}{\titlerule}{-33pt}{\Huge}[\vspace{-4pt}\titlerule]
\titlespacing*{\chapter}{0pt}{50pt}{*2}
\usepackage{lipsum}
\begin{document}
\chapter{test}
\end{document}

No hay comentarios:

Publicar un comentario