Fonts & Character SetsHow to change chapter title format

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
Diogo Remoaldo
Posts: 26
Joined: Mon Apr 06, 2015 8:24 pm

How to change chapter title format

Post by Diogo Remoaldo »

Hi I would like to make the chapters appear as the image in the appendix (Capítulo 1 - Introdução).

Thanks in advance for your time.

My code is as follows:

Code: Select all

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{epstopdf} 
\usepackage{float}
\usepackage{graphicx}
\usepackage[hidelinks]{hyperref}
\usepackage{url}
\usepackage[all]{hypcap}
\usepackage{caption}
\usepackage[paper=a4paper,top=3.5cm,bottom=2cm,right=1.5cm,left=3.0cm,twoside ,bindingoffset=1cm,marginparwidth=0in,marginparsep=0in]{geometry}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{indentfirst}
\usepackage[export]{adjustbox}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{enumitem}
\usepackage[titletoc]{appendix}
\usepackage{titlesec}
\usepackage{multirow}
\captionsetup[table]{position=above}
\usepackage{siunitx}
%\usepackage[stretch=10,shrink=10]{microtype}
\newcolumntype{C}{>{\centering\arraybackslash}m}
\sisetup{per-mode=symbol}
\usepackage{hhline}
\captionsetup[table]{position=above}
\setcounter{secnumdepth}{4}
\DeclareSIUnit{\year}{ano}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{1.5ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\usepackage{eurosym}
\usepackage{makeidx}
\usepackage{subcaption}
%\usepackage{afterpage}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{placeins}
\usepackage{appendix}
\usepackage{newtxtext,newtxmath}
\usepackage{times}
\usepackage{setspace}
\usepackage{lastpage}
%\usepackage{microtype}
\addto\captionsportuguese{
  \renewcommand\appendixname{Anexo}
  %\renewcommand\appendixpagename{Anexos}
}

\usepackage{titlesec}

\newcommand{\chapfnt}{\fontsize{12}{19}}
\newcommand{\secfnt}{\fontsize{12}{17}}
\newcommand{\ssecfnt}{\fontsize{12}{14}}

\titleformat{\chapter}[display]
{\normalfont\chapfnt\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\chapfnt}

\titleformat{\section}
{\normalfont\secfnt\bfseries}{\thesection}{1em}{}

\titleformat{\subsection}
{\normalfont\ssecfnt\bfseries}{\thesubsection}{1em}{}


\setlength{\belowcaptionskip}{-2pt}

\setlist{itemsep=2.0pt}

\setlength{\textfloatsep}{10pt plus 1.0pt minus 2.0pt}

\setlength{\floatsep}{5pt plus 1.0pt minus 2.0pt}
\setlength{\intextsep}{5pt plus 1.0pt minus 2.0pt}

\setlength{\parindent}{2.0em}
\setlength{\parskip}{0.5em}
%\renewcommand{\baselinestretch}{2.0}

\usepackage{fancyhdr}


\pagestyle{fancy}
  \fancyhf{}% Clear header/footer
\fancyhead[C]{\small\hfill Ordem dos Engenheiros-Região Norte\hfill\hbox{}\linebreak
Colégio de Engenharia Mecânica\hfill Relatório nº 1}
\fancyfoot[L]{\fontsize{10}{12} \selectfont Diogo Filipe Pereira Remoaldo}
\fancyfoot[R]{\fontsize{10}{12} \selectfont \thepage / \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}


\fancypagestyle{plain}{
  \fancyhf{}% Clear header/footer
\fancyhead[C]{\small\hfill Ordem dos Engenheiros-Região Norte\hfill\hbox{}\linebreak
Colégio de Engenharia Mecânica\hfill Relatório nº 1}
\fancyfoot[L]{\fontsize{10}{12} \selectfont Diogo Filipe Pereira Remoaldo}
\fancyfoot[R]{\fontsize{10}{12} \selectfont \thepage / \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\pagestyle{plain}% Set page style to plain.



\newgeometry{top=2cm,bottom=2cm,right=2.5cm,left=2.5cm,bindingoffset=0cm,marginparwidth=0in,marginparsep=0in}
\title{Desenvolvimento de um edifício tipo "PassivHaus" para clima temperado (Português) integrando painéis "sandwich" estruturais e fontes de energia renováveis}
\author{Diogo Filipe Pereira Remoaldo}


\begin{document}

\begin{titlepage}
\thispagestyle{empty}
\centering
%\includegraphics[width=.5\linewidth]{logofeupp}

\vspace*{0.5cm}
\large{Departamento de Engenharia Mecânica}

\vspace*{2.5cm}

\huge{Desenvolvimento de um edifício tipo "PassivHaus" para clima temperado (Português) integrando painéis "sandwich" estruturais e fontes de energia renováveis}

\vspace*{4cm} \Large{Diogo Filipe Pereira Remoaldo}

%  
\vfill \normalsize{Porto, Setembro de 2015}

\end{titlepage}

\addtocounter{page}{+1}






\renewcommand{\contentsname}{Índice}
\tableofcontents



\renewcommand\listfigurename{Índice de Figuras}

\listoffigures


\renewcommand\listtablename{Índice de Tabelas}
\listoftables





\chapter{Introdução}

\section{Apresentação do Candidato}
Attachments
mycode.png
mycode.png (4.63 KiB) Viewed 41780 times
Introdução.png
Introdução.png (9.06 KiB) Viewed 41918 times
Last edited by Johannes_B on Mon Aug 01, 2016 11:50 am, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to change chapter title format

Post by Johannes_B »

Since you have again not provided a minimal working example but rather a clutter of code, i will not present you with the ready made solution.
Just one hint: You are already changing the appearance of chapter headings in your code. So, you should be able to figure out how to change it to your needs.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

How to change chapter title format

Post by Stefan Kottwitz »

Hi Diogo,

you have this line for configuring the chapter heading:

Code: Select all

\titleformat{\chapter}[display]
{\normalfont\chapfnt\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\chapfnt}
Just change it. For example, remove the [display] option, similar to the following section line. The titlesec manual shows how to customize it.

Stefan
LaTeX.org admin
Diogo Remoaldo
Posts: 26
Joined: Mon Apr 06, 2015 8:24 pm

How to change chapter title format

Post by Diogo Remoaldo »

Hi,

I ended up doing it. Johannes I came from vacations today and could only reply now, I don't know what I did wrong, I sent you my full code plus images, it still has almost no text because I am first setting the layout and than I will start writting. What else do you want me to send the next time?

Hope I haven't offended you, but I think you were a bit unfair.

Now I have another problem. I corrected my problema doing the following

Code: Select all

\titleformat{\chapter}
{\normalfont\chapfnt\bfseries}{\chaptertitlename\ \thechapter-}{0em}{\chapfnt}
\titlespacing*{\chapter}{0pt}{0pt}{*2}
\titleformat{\section}
{\normalfont\secfnt\bfseries}{\thesection-}{0em}{}
\titleformat{\subsection}
{\normalfont\ssecfnt\bfseries}{\thesubsection-}{0em}{}
But the - doesn't appear in the índex, I would like to Capítulo - 1 appear as follows in the índex. How can I work it around?
Post Reply