1

I'm working with reportand I'd like to change title format without titlesec, because my headers and footers are implemented using fancy style, and it produces errors.

By default, \chaptercommand gets:

Chapter 1

Chapter Title

I'd like to have:

1 Chapter title

Can someone please help me to get this result?

Thank you.

EDIT :

I tried with your code, and I almost get what i'm looking for, but it appears an error that place symbol @ before word chapter. I let my code in order to find the solution easier. Thank you again.

\documentclass[a4paper,openright,12pt]{report}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc} 
\usepackage{fancyhdr}%Temas de numeración de páginas
\usepackage{titling}
\usepackage{graphicx}%Introducir encabezados LaTex
\usepackage{hyperref}%Hiperlinks índices
\usepackage{vmargin}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[mathscr]{eucal}
\setlength{\parindent}{0pt}
\graphicspath{{../Figuras/}}
\date{date}
%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Modify chapter format
\makeatletter
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
    \huge\bfseries
    % \@chapapp\space % removed
    \thechapter
    ~% \par\nobreak\vskip 20\p@ % replaced
    \fi
    \interlinepenalty\@M
    \huge % \Huge % replaced
    \bfseries #1\par\nobreak
    \vskip 40\p@
}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Eliminar visualización hipervínculos índices
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}

%%%%%%%%%%%%%

%Definición de formato de hoja

\setmargins{2.5cm}        % margen izquierdo
{1.25cm}                  % margen superior
{16.5cm}                  % anchura del texto
{23.3cm}                  % altura del texto
{5pt}                     % altura de los encabezados
{1.5cm}                   % espacio entre el texto y los encabezados
{20pt}                    % altura del pie de página
{1.5cm}                   % espacio entre el texto y el pie de página

%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\headheight 40pt 
\headsep 30pt

% aqui definimos el encabezado de las paginas pares e impares.


\chead[\thedate \\ Título de Proyecto]{\thedate \\ title}
\rhead[\leftmark]{\leftmark}
\renewcommand{\headrulewidth}{0.5pt}

% aqui definimos el pie de pagina de las paginas pares e impares.
\cfoot[\thepage]{\thepage}
\renewcommand{\footrulewidth}{0.5pt}

\fancypagestyle{capitulo}{      
\fancyhead[C]{\thedate \\ title}
\fancyhead[R]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
}


%Encabezado especial índices
\fancypagestyle{especial}{
\fancyhead[R]{\nouppercase{\leftmark}}
}
\pagestyle{fancy}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%COMIENZO DOCUMENTO

\begin{document}

%%%%%%%%%%%%%

%CREACIÖN DE LOS ÍNDICES

\tableofcontents 
\thispagestyle{especial}

%%%%%%%%%%%%%


\chapter{Chapter}\label{capitulo}
\thispagestyle{capitulo}
bla bla bla


\section{Section}\label{seccion}
ble ble ble 

\end{document}

This is the way that currently is shown:

enter image description here

1

With a few modifications of the \@makechapterhead macro:

  • Remove \@chapapp\space to remove the Chapter word;
  • Replace \par\nobreak\vskip 20\p@ by \nobreakspace{} to replace the line break by a space (~ has a different meaning if babel is loaded);
  • Replace \Huge by \huge to get the size right (you could also replace \huge by \Huge to get a larger font size).

enter image description here

\documentclass{report}

\usepackage{lipsum}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries
        % \@chapapp\space % removed
        \thechapter
        \nobreakspace{}% \par\nobreak\vskip 20\p@ % replaced
    \fi
    \interlinepenalty\@M
    \huge % \Huge % replaced
    \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

\begin{document}

\chapter{Lorem Ipsum}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\end{document}
  • Thank you very much! Now it works perfectly with the last edit. – Daniel Jan 23 at 12:28
  • @Daniel You're welcome :) If it did solve your problem you can mark the question as "solved" by clicking the accept button (the checkmark ✓ to the left side) of the answer that solved the problem. – Phelype Oleinik Jan 24 at 10:16
0

Use scrreprt instead

\documentclass{scrreprt} 
\begin{document} 
\tableofcontents
\chapter{foo}
bar
\end{document}

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.