[Tex/LaTex] Customizing the first page of each \chapter of a {book}

chapterssectioning

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}

Best Answer

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

Related Question