3

I'm writing my thesis in LaTeX using ShareLaTeX but my university gives very specific format rules. I improved my chapter page with Styling the \part page but I still have two problems:

  • I need to have "1 Introduction" all in the same line. I deleted "Chapter" and tried by adding negative vertical space between them but when it's correct in one chapter, in the next one they are unaligned.
  • The page number appears (only in the first page of each \chapter) at the bottom and I have to show it (as I have in the rest of the document), in the top right part (as it is always an odd page).

I leave the code I'm using for the moment. Hope it's clear and thanks a lot.

\documentclass[a4paper,12pt]{book} 
\usepackage[utf8]{inputenc}
\usepackage[english,spanish]{babel}
\usepackage{titlesec}

\titleformat{\chapter}
[display]
{\normalfont\huge\bfseries}
{\thechapter}
{-45.7pt} %Here's where I modify the vertical space
{\hspace{20pt}\huge}
\titlespacing*{\chapter}{0pt}{0pt}{30pt}

\begin{document}

\chapter{Introduction}
Here it starts the text of my introduction.

\end{document}
2

Just use the block style, not display and re-define the plain page style with pagestyles option for titlesec (note it is incompatible with fancyhdr):

\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[english,spanish]{babel}

\usepackage[pagestyles]{titlesec}
\newpagestyle{headplain}{%
\sethead[\thepage][][]{}{}{\thepage}}

\titleformat{\chapter}
[block]
{\normalfont\huge\bfseries}
{\thechapter}
{0pt} %
{\hspace{20pt}\huge}
\titlespacing*{\chapter}{0pt}{0pt}{30pt}

\pagestyle{headplain}

\begin{document}

\chapter{Introduction}
Here it starts the text of my introduction.

\end{document} 

enter image description here

  • Thanks a lot! That solves the problem perfectly! But, can you explain how to re-define the plain pagestyle with pagestyles? Many thanks – Hitch Jul 31 '17 at 12:33
  • @Hitch: I see now I had forgotten to update my code. Please take a look at the new version, corresponding to the image. Setting headers and footers with titleps is much simpler than with fancyhdr, as you do not have to use the markssystem (but you can, if you want). – Bernard Jul 31 '17 at 13:02
  • Hi @Bernard! Thanks for your help and time. Now I have the title of the chapter in both header and foot (only in the first page of each chapter) and I don't want that... Besides, I would also like that in every page odd page, in the header, instead of appearing "Chapter 1. Introduction", I'd rather had "1 Introduction", without the word "Chapter" and the point. But this last one is not a big deal. Do you know a way to solve these things? Mostly the first one, but if you know also the second, it would be great! Thanks again! – Hitch Aug 4 '17 at 20:00
  • @Hitch: In this case I think the simplest is to define a new custom pages style (always with titleps). But what would you like to have on even pages? – Bernard Aug 4 '17 at 20:52
  • even just the number of the page is ok, but {book} automatically puts also the name of the section, which is good looking, but not necessary. I only need it to be consistent, every page the same format. So, in conclusion: I have two parts: First part: Numeration in roman numbers and in the bottom center. Second part: I want the number of the page in the bottom center part or in the upper exterior part of each page (odd pages: up left, even pages: up right). Normally I had the roman numbers correct, but with your new code it changed also to the top part! Thanks! – Hitch Aug 6 '17 at 17:49

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.