Page Layouthow to change the chapter heading?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
muhammad alzaidi
Posts: 9
Joined: Thu Aug 26, 2010 5:54 pm

how to change the chapter heading?

Post by muhammad alzaidi »

Hi guys,

I am on the process of writing up my dissertation.. everything sems to be okay but I need to change the format of the chapter heading. I want the following format:
Chapter 1

Introduction

the problem I am facing now is the format that I always get is:

1 Introduction

I don't want this format>> I want to replace it with the earlie

Code: Select all

\documentclass[oneside,12pt]{scrbook}
\usepackage{graphicx}
\usepackage[round]{natbib}
\bibliographystyle{plainnat}
\usepackage[doublespacing]{setspace}
\usepackage{tipa}
\usepackage{t4phonet}
\usepackage{ugarite}
\usepackage{avm}
\usepackage{tikz}
\usepackage{sectsty}
\usepackage{amssymb}
\usepackage{covington}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{15.2pt}
\lhead{{\fancyplain{}{\textit{\leftmark}}}}
\chead{}
\rhead{\thepage}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\usepackage{amsmath}
\usepackage{accents}
\usepackage{minipage}
\usepackage{colortbl}
\usepackage{geometry}
\geometry{top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm}
\begin{document}
\frontmatter
\mainmatter
\chapter{Introduction}
\end{document}
r one??
Last edited by muhammad alzaidi on Sat Aug 28, 2010 4:01 pm, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

how to change the chapter heading?

Post by torbjorn t. »

Simply add

Code: Select all

headings=twolinechapter
as an option to the class, e.g

Code: Select all

\documentclass[oneside,12pt,headings=twolinechapter]{scrbook}
See the manual of KOMA-script, section 3.1, for a list of available options.
muhammad alzaidi
Posts: 9
Joined: Thu Aug 26, 2010 5:54 pm

Re: how to change the chapter heading?

Post by muhammad alzaidi »

thank you for your help

it is working now

I have another question :roll: I have divided my dissertation into different tex files but I failed to combine them by using

\include{chapter1}

I have tried to replace the previous command with
\input{chapter}

but it does not work
all the chapters files in one folder...??
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

how to change the chapter heading?

Post by torbjorn t. »

We will need more information. Are the chaperX.tex files in the same folder as your master file? If so, there should be no problem with \include{chapterX}. You will need one \include-command for each file, e.g.

Code: Select all

\include{chapter1}
\include{chapter2}
\include{chapter3}
...
\include{chapterN}
If the files are in a subfolder of the folder where your master file is, you will need to specify this, like \include{./chapters/chapterX.tex}.
muhammad alzaidi
Posts: 9
Joined: Thu Aug 26, 2010 5:54 pm

how to change the chapter heading?

Post by muhammad alzaidi »

I created a new tex file and I saved this file in the same folder and i input the following:

Code: Select all

\documentclass[oneside,12pt,headings=twolinechapter]{scrbook}
\begin{document}
\include{dissertation}
\end{document}
but it does not work and I receve the error which is:

Code: Select all

l.1 \documentclass
                  [oneside,12pt,headings=twolinechapter]{scrbook}
? 
I tries to use the first pages of the chapter where I designed a cover and abstract and acknowledgement pages and I tries to use the same code but I fails

by the way I save the files in D and inside I collected all the chapters in one folder titled dissertation files
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Re: how to change the chapter heading?

Post by torbjorn t. »

As stated above, if the chapterfiles are in a different folder than your master file (the one starting with \documentclass), you have to specify that. Also, I think you should avoid having spaces in the names of folders or files, that is, you should use something like "dissertationfiles" instead of "dissertation files".

Your example works fine for me.
muhammad alzaidi
Posts: 9
Joined: Thu Aug 26, 2010 5:54 pm

how to change the chapter heading?

Post by muhammad alzaidi »

Do I create a new tex file and input the commands?.. that's what I did I created a new tex file where I combine all the chapters...

Code: Select all

\documentclass[oneside,12pt,headings=twolinechapter]{scrbook}
\begin{document}
\include{chapter1}
\end{document}
I did what you recommended which is changing the names but unfortunalety it does not work

the information in the chapter 1 file is

Code: Select all

\documentclass[oneside,12pt,headings=twolinechapter]{scrbook}
\usepackage{graphicx}
\usepackage[round]{natbib}
\bibliographystyle{plainnat}
\usepackage[doublespacing]{setspace}
\usepackage{tipa}
\usepackage{t4phonet}
\usepackage{ugarite}
\usepackage{avm}
\usepackage{tikz}
\usepackage{sectsty}
\usepackage{amssymb}
\usepackage{covington}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{15.2pt}
\lhead{{\fancyplain{}{\textit{\leftmark}}}}
\chead{}
\rhead{\thepage}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\usepackage{amsmath}
\usepackage{accents}
\usepackage{minipage}
\usepackage{colortbl}
\usepackage{geometry}
\geometry{top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm}
\begin{document}
...anyway I am really sorry to bother you....
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

how to change the chapter heading?

Post by torbjorn t. »

Ah, I see where you have misunderstood.

When using \include or \input only one file, the master file, should have a preamble, and \begin/\end{document}. The preamble is where you load packages, define new commands etc. i.e everything from \documentclass{} to \begin{document}.

What happens when you are using \include, is that LaTeX will first add a \clearpage command, and then read the contents from the file.


An example of use:

Say you have a folder structure like this:

Code: Select all

F:/Project/chapters
In the Project folder, you have a file called master.tex, which contains the preamble, and a series of \include in the document environment. For instance:

Code: Select all

\documentclass{scrbook}

\begin{document}
\include{./chapters/chapter1}
\include{./chapters/chapter2}
\include{./chapters/chapter3}
\end{document}
In the chapters folder, you will have .tex-files called chapter1.tex, chapter2.tex and chapter3.tex, and they will look like this:

Code: Select all

\chapter{A title}
A lot of text.
When compiling, you have to compile the file master.tex, as that is the file with the preamble.


Did that make things any clearer?
muhammad alzaidi
Posts: 9
Joined: Thu Aug 26, 2010 5:54 pm

how to change the chapter heading?

Post by muhammad alzaidi »

I have chapter tex files and I have one tex file named master where I put the following:

Code: Select all

\documentclass[oneside,12pt,headings=twolinechapter]{scrbook}
\usepackage{graphicx}
\usepackage[round]{natbib}
\usepackage{natbib}
\bibliographystyle{plainnat}
\usepackage{tipa}
\usepackage{t4phonet}
\usepackage{ugarite}
\usepackage{avm}
\usepackage{tikz}
\usepackage{sectsty}
\usepackage{amssymb}
\usepackage{covington}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{15.2pt}
\lhead{{\fancyplain{}{\textit{\leftmark}}}}
\chead{}
\rhead{\thepage}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\usepackage{amsmath}
\usepackage{accents}
\usepackage{minipage}
\usepackage{colortbl}
\usepackage{geometry}
\geometry{top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm}
\begin{document}
\end{document}
Now I did two things to see which one is working:
1--I added the following commands in Master tex:

Code: Select all

\include{chapter1}
after \begin{document}
But this is not working

2--so I created a another tex named compile where I only put:

Code: Select all

\documentclass[oneside,12pt,headings=twolinechapter]{scrbook}
\begin{document}
\include{master}
\include{chapter1}
\end{document}
the first file is the preambl
but this is also does not work

I think this is quite complicated and I cannot deal with it :D
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

how to change the chapter heading?

Post by localghost »

Included (chapter) files must not have a preamble. I suggest that you do some basic reading [1]. These things are very important if you plan to work with LaTeX for future projects.

[1] View topic: LaTeX Resources for Beginners


Thorsten
Post Reply