Text Formattingfancyhdr | Unwanted Indentation

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Mattep
Posts: 2
Joined: Tue Mar 27, 2012 7:31 pm

fancyhdr | Unwanted Indentation

Post by Mattep »

Hi everyone!

I'm using fancyhdr package and I don't know why chapters without numbers (i.e. \chapter*{}) have their titles indented...but I do not want it!

I state that I've modified chapter heading to avoid that word "Chapter" appears, in the following way

Code: Select all

\usepackage{titlesec}
\titleformat{\chapter}
  {\bfseries\LARGE} 
  {\filright\thechapter}
  {0pt}
  {\quad}
Anyway if I write \chapter{Chapter_Title} I get

# Chapter_Title

If I write \chapter*{Chapter_title} I get instead

[BlankSpace]Chapter_Title

But I don't want that blank space at the very beginning of my chapters! :D

Thank you so much

Cheers

Matteo

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

fancyhdr | Unwanted Indentation

Post by localghost »

For an adequate problem description please prepare a minimal example to clarify the extent to which the fancyhdr package influences the format of the customized chapter headings. Due to missing information the problem is not comprehensible at the moment.

By the way, the titlesec package also manages pages styles with customized headers and footers. So you should perhaps decide to use the package for this purpose, too. Finally I don't think that the problem is related to fancyhdr.

An interesting alternative might be to use a corresponding class from the KOMA-Script bundle. The chapter heading format that you want to achieve is default setting in those classes.

Code: Select all

\documentclass[paper=letter]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\begin{document}
  \chapter{Foo}
    \lipsum[1]

  \addchap{Bar}
    \lipsum[2]
\end{document}
For customized headers and footers you then should use the »scrpage2« package that is part of the bundle.


Best regards and welcome to the board
Thorsten
Mattep
Posts: 2
Joined: Tue Mar 27, 2012 7:31 pm

fancyhdr | Unwanted Indentation

Post by Mattep »

Yes, I'm sorry! :oops:
Here you are some examples and what I get.

Example1:

Code: Select all

\documentclass[12 pt, a4paper]{book}
\usepackage[a4paper,top=3.4cm,bottom=3.4cm,left=2.5cm,right=2.5cm,%
heightrounded,bindingoffset=5mm]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{graphicx, subfigure}}
\usepackage[font={small, it},format=hang]{caption}
\usepackage{wrapfig}
\usepackage{amsmath}
\usepackage{siunitx}
\setlength{\parindent}{0.5cm}
\titleformat{\chapter}
  {\bfseries\LARGE} 
  {\filright\thechapter}
  {0pt}
  {\quad}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO,LE]{\thepage}
\fancyhead[LE]{{\small \leftmark}} % even pages!
\fancyhead[RO]{{\small \rightmark}} % odd pages!

\begin{document}
\chapter*{Introduzione}
Al di l\`a delle loro importanti applicazioni tecnologiche ...
\end{document}
Example 1.pdf
(24.42 KiB) Downloaded 236 times
Example2:

Code: Select all

\documentclass[12 pt, a4paper]{book}
\usepackage[a4paper,top=3.4cm,bottom=3.4cm,left=2.5cm,right=2.5cm,%
heightrounded,bindingoffset=5mm]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{graphicx, subfigure}}
\usepackage[font={small, it},format=hang]{caption}
\usepackage{wrapfig}
\usepackage{amsmath}
\usepackage{siunitx}
\setlength{\parindent}{0.5cm}
\titleformat{\chapter}
  {\bfseries\LARGE} 
  {\filright\thechapter}
  {0pt}
  {\quad}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO,LE]{\thepage}
\fancyhead[LE]{{\small \leftmark}} % even pages!
\fancyhead[RO]{{\small \rightmark}} % odd pages!

\begin{document}
\chapter{Introduzione}
Al di l\`a delle loro importanti applicazioni tecnologiche ...
\end{document}
Example2.pdf
(24.54 KiB) Downloaded 160 times
But, even not using fancyhdr package as in Example3:

Code: Select all

\documentclass[12 pt, a4paper]{book}
\usepackage[a4paper,top=3.4cm,bottom=3.4cm,left=2.5cm,right=2.5cm,%
heightrounded,bindingoffset=5mm]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{graphicx, subfigure}}
\usepackage[font={small, it},format=hang]{caption}
\usepackage{wrapfig}
\usepackage{amsmath}
\usepackage{siunitx}
\setlength{\parindent}{0.5cm}
\titleformat{\chapter}
  {\bfseries\LARGE} 
  {\filright\thechapter}
  {0pt}
  {\quad}

\begin{document}
\chapter*{Introduzione}
Al di l\`a delle loro importanti applicazioni tecnologiche ...
\end{document}
I get
Example3.pdf
(24.42 KiB) Downloaded 154 times
that shows the same problem.

Thank you Thorsten
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

fancyhdr | Unwanted Indentation

Post by localghost »

None of your examples is minimal. And at the moment I'm not motivated to do your homework and reduce them just to test possible solutions. Perhaps you should give the suggested alternative a try.
Post Reply