6

I'm using MiKTeX and when I use \chapter command, it starts a new page. I was wondering how to not start a new page.

My next concern is how can I align the text \chapter{*} where * is the text.

Lastly, I found a code online that right aligns at the top of the page the page number, but every time I get to a new chapter page, the page number is at the bottom center. Is there a way to change the position of the page number because every time I add a new chapter in my document which is set to report, it is at the bottom center instead of top right.

Thanks.

EDIT: I was able to change the size of the text in \chapter{*} where * is the text.

6

The chapter command is defined in report as

\newcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}

You'll notice that line 1 has the part that we need to comment out, which does the page breaking. Also note that when using \documentclass{article} you don't have access to the \chapter command.

So, in the MWE below, I've redefined \chapter and simply commented out the part with \clearpage and \cleardoublepage.

\documentclass{report}

\makeatletter
\renewcommand\chapter{%\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother

\begin{document}

\chapter{lions}

\chapter{zebras}
\end{document} 

For your question about headers and footers, I recommend the fancyhdr package.

In relation to your alignment of the chapter title, we'd need to see some more details. Almost certainly though, the titlesec package would be able to do the heavy lifting for us.

Just as a cautionary note, removing the clearpage and cleardoublepage command could cause some undesired consequences, especially concerning floats (figure, table, etc).

  • Thanks a lot! I don't think I would have come up with this. I couldn't find anything online to the best of my abilities on how to stop the page break when using \chapter{*}. – user178500 Nov 25 '12 at 4:13
  • @user178500 you're very welcome :) Happy TeXing :) – cmhughes Nov 25 '12 at 4:13

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.