GeneralChapters, headings, spellchecking, oh my...

LaTeX specific issues not fitting into one of the other forums of this category.
QuantumDeng
Posts: 6
Joined: Sun Nov 07, 2010 5:08 am

Chapters, headings, spellchecking, oh my...

Post by QuantumDeng »

Hi Stefan_K,

My document class is report. I am learning how to post a minimal example, but it might take a while.

The problem is: the pdf document shows

1 Introduction to superconductivity

However, what I want is:

Chapter 1 Introduction to superconductivity

And I also want to ask you another three questions:

1) You said by writing "hspace{1cm}", we can increase the space between "chapter" and "1", how can I increase the space between "1" and "introduction to superconductivity".

2) How to change "Chapter 1" into "TcSUH 1"?
3) How to make "Chapter 1" And " Introduction...." show in different lines:

Chapter 1
Introduction to superconductivity

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Chapters, headings, spellchecking, oh my...

Post by Stefan Kottwitz »

Try this in your preamble, it's a redefinition of the headings made by report.cls:

Code: Select all

\makeatletter
\renewcommand*{\@makechapterhead}[1]{%
  %\vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\renewcommand*{\@makeschapterhead}[1]{%
  %\vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother
The space is reduced by commenting out those \vspace lines, everything else remains the same. You could remove the % sign and modify the \vspace argument like you wish.

Generally customization of the headings is much easier with the titlesec package.

Stefan
LaTeX.org admin
QuantumDeng
Posts: 6
Joined: Sun Nov 07, 2010 5:08 am

Re: Chapters, headings, spellchecking, oh my...

Post by QuantumDeng »

Thank you so much, Stefan! I finally solved the problem with your help,which I tried several hours by myself but failed.

I found out by changing "\vskip 40\p@" to vskip 20, I can reduce the space between the title of the chapter and the following text.

Can I ask you one more question? How can I reduce or control the space before and after the title of section and subsection?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Chapters, headings, spellchecking, oh my...

Post by Stefan Kottwitz »

You may adjust the lengths within these redefinitions, use it also between \makeatletter and \makeatother like the redefinitions above:

Code: Select all

\renewcommand\section{\@startsection {section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
  {-3.25ex\@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus .2ex}%
  {\normalfont\large\bfseries}}
An explanation of the arguments can be found here: Changing the Section Headings.

Stefan
LaTeX.org admin
QuantumDeng
Posts: 6
Joined: Sun Nov 07, 2010 5:08 am

Re: Chapters, headings, spellchecking, oh my...

Post by QuantumDeng »

Thank you so much!!!
Last edited by QuantumDeng on Mon Nov 08, 2010 8:36 pm, edited 1 time in total.
QuantumDeng
Posts: 6
Joined: Sun Nov 07, 2010 5:08 am

Re: Chapters, headings, spellchecking, oh my...

Post by QuantumDeng »

Hey Stefan,

How can I make the title of chapters like "Chpater 1" and index of sections and subsections invisible?

Thanks a lot.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Chapters, headings, spellchecking, oh my...

Post by Stefan Kottwitz »

What exactly do you mean? Do you wish to hide those headings
  • in the table of contents
  • or in the page headers
  • or in the body text?
Stefan
LaTeX.org admin
QuantumDeng
Posts: 6
Joined: Sun Nov 07, 2010 5:08 am

Re: Chapters, headings, spellchecking, oh my...

Post by QuantumDeng »

In the body text,like
Chapter 1 Introduction ------change to------------ Introduction
1.1 Background ------change to------------ Background
1.1.1 Data analysis ------change to------------ Data analysis
Post Reply