Problem with chapter* and fancyhdr
up vote
7
down vote
favorite
I'm having a problem with chapter*{}
and fancyhdr
. I want to start the first chapter of my thesis with a introduction section, appearing in the TOC but without numeration, that's why I use:
chapter*{Introduccion}
and
addcontentsline{toc}{chapter}{Introduccion}
at the beginning of the Introduccion.tex
file, but I don't know why, the fancyhdr
header shows "list of tables" instead of "Introduccion"!
(the list of tables is immediately before the introduction).
Here is my code:
documentclass[a4paper,12pt,twoside]{book}
%
usepackage[bottom=25mm,top=25mm, left=30mm, right=25mm]{geometry}
%
parskip=8pt
%
widowpenalty=10000
clubpenalty=10000
%
usepackage[spanish, es-tabla]{babel}
usepackage[utf8x]{inputenc}
usepackage{morefloats}
%
setcounter{secnumdepth}{3}
usepackage{eurosym}
usepackage[pdftex]{graphicx}
usepackage{pdfpages}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
%
usepackage{fancyhdr}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
%
makeatletter
%
defcleardoublepage{clearpageif@twoside ifoddc@pageelse
hbox{}
thispagestyle{empty}
newpage
if@twocolumnhbox{}newpagefififi}
makeatother
%
begin{document}
%
pagenumbering{gobble} % Las primeras paginas no quiero que se numeren
%
includepdf[pages={-}]{./Archivos/Portada_PFCccompleto.pdf}
input{./Archivos/Capitulos/pfc_dedicatoria}
input{./Archivos/Capitulos/pfc_agradecimientos}
include{./Archivos/Capitulos/pfc_abreviaturas}
%
% FRONTMATTER: TOC, LOF, LOT
frontmatter
%
tableofcontents
listoffigures
listoftables
%
% MAINMATTER
%
mainmatter
include{./Archivos/Capitulos/pfc_intro}
include{./Archivos/Capitulos/pfc_main_010}
...
%
table-of-contents chapters fancyhdr
add a comment |
up vote
7
down vote
favorite
I'm having a problem with chapter*{}
and fancyhdr
. I want to start the first chapter of my thesis with a introduction section, appearing in the TOC but without numeration, that's why I use:
chapter*{Introduccion}
and
addcontentsline{toc}{chapter}{Introduccion}
at the beginning of the Introduccion.tex
file, but I don't know why, the fancyhdr
header shows "list of tables" instead of "Introduccion"!
(the list of tables is immediately before the introduction).
Here is my code:
documentclass[a4paper,12pt,twoside]{book}
%
usepackage[bottom=25mm,top=25mm, left=30mm, right=25mm]{geometry}
%
parskip=8pt
%
widowpenalty=10000
clubpenalty=10000
%
usepackage[spanish, es-tabla]{babel}
usepackage[utf8x]{inputenc}
usepackage{morefloats}
%
setcounter{secnumdepth}{3}
usepackage{eurosym}
usepackage[pdftex]{graphicx}
usepackage{pdfpages}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
%
usepackage{fancyhdr}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
%
makeatletter
%
defcleardoublepage{clearpageif@twoside ifoddc@pageelse
hbox{}
thispagestyle{empty}
newpage
if@twocolumnhbox{}newpagefififi}
makeatother
%
begin{document}
%
pagenumbering{gobble} % Las primeras paginas no quiero que se numeren
%
includepdf[pages={-}]{./Archivos/Portada_PFCccompleto.pdf}
input{./Archivos/Capitulos/pfc_dedicatoria}
input{./Archivos/Capitulos/pfc_agradecimientos}
include{./Archivos/Capitulos/pfc_abreviaturas}
%
% FRONTMATTER: TOC, LOF, LOT
frontmatter
%
tableofcontents
listoffigures
listoftables
%
% MAINMATTER
%
mainmatter
include{./Archivos/Capitulos/pfc_intro}
include{./Archivos/Capitulos/pfc_main_010}
...
%
table-of-contents chapters fancyhdr
3
This is a very common problem. Addmarkboth{Introduccion}{Introduccion}
afterchapter*{Introduccion}
. By the way, instead of redefiningcleardoublepage
, you can addusepackage{emptypage}
– egreg
Oct 20 '13 at 18:59
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– Andrew Swann
Oct 20 '13 at 19:19
It might already help if you move the introduction to thefrontmatter
and use a normalchapter
. An alternative could be to use a class and »scrpage2« from »KOMA-Script« and use itsaddchap
command.
– Thorsten Donig
Oct 21 '13 at 7:41
add a comment |
up vote
7
down vote
favorite
up vote
7
down vote
favorite
I'm having a problem with chapter*{}
and fancyhdr
. I want to start the first chapter of my thesis with a introduction section, appearing in the TOC but without numeration, that's why I use:
chapter*{Introduccion}
and
addcontentsline{toc}{chapter}{Introduccion}
at the beginning of the Introduccion.tex
file, but I don't know why, the fancyhdr
header shows "list of tables" instead of "Introduccion"!
(the list of tables is immediately before the introduction).
Here is my code:
documentclass[a4paper,12pt,twoside]{book}
%
usepackage[bottom=25mm,top=25mm, left=30mm, right=25mm]{geometry}
%
parskip=8pt
%
widowpenalty=10000
clubpenalty=10000
%
usepackage[spanish, es-tabla]{babel}
usepackage[utf8x]{inputenc}
usepackage{morefloats}
%
setcounter{secnumdepth}{3}
usepackage{eurosym}
usepackage[pdftex]{graphicx}
usepackage{pdfpages}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
%
usepackage{fancyhdr}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
%
makeatletter
%
defcleardoublepage{clearpageif@twoside ifoddc@pageelse
hbox{}
thispagestyle{empty}
newpage
if@twocolumnhbox{}newpagefififi}
makeatother
%
begin{document}
%
pagenumbering{gobble} % Las primeras paginas no quiero que se numeren
%
includepdf[pages={-}]{./Archivos/Portada_PFCccompleto.pdf}
input{./Archivos/Capitulos/pfc_dedicatoria}
input{./Archivos/Capitulos/pfc_agradecimientos}
include{./Archivos/Capitulos/pfc_abreviaturas}
%
% FRONTMATTER: TOC, LOF, LOT
frontmatter
%
tableofcontents
listoffigures
listoftables
%
% MAINMATTER
%
mainmatter
include{./Archivos/Capitulos/pfc_intro}
include{./Archivos/Capitulos/pfc_main_010}
...
%
table-of-contents chapters fancyhdr
I'm having a problem with chapter*{}
and fancyhdr
. I want to start the first chapter of my thesis with a introduction section, appearing in the TOC but without numeration, that's why I use:
chapter*{Introduccion}
and
addcontentsline{toc}{chapter}{Introduccion}
at the beginning of the Introduccion.tex
file, but I don't know why, the fancyhdr
header shows "list of tables" instead of "Introduccion"!
(the list of tables is immediately before the introduction).
Here is my code:
documentclass[a4paper,12pt,twoside]{book}
%
usepackage[bottom=25mm,top=25mm, left=30mm, right=25mm]{geometry}
%
parskip=8pt
%
widowpenalty=10000
clubpenalty=10000
%
usepackage[spanish, es-tabla]{babel}
usepackage[utf8x]{inputenc}
usepackage{morefloats}
%
setcounter{secnumdepth}{3}
usepackage{eurosym}
usepackage[pdftex]{graphicx}
usepackage{pdfpages}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
%
usepackage{fancyhdr}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
%
makeatletter
%
defcleardoublepage{clearpageif@twoside ifoddc@pageelse
hbox{}
thispagestyle{empty}
newpage
if@twocolumnhbox{}newpagefififi}
makeatother
%
begin{document}
%
pagenumbering{gobble} % Las primeras paginas no quiero que se numeren
%
includepdf[pages={-}]{./Archivos/Portada_PFCccompleto.pdf}
input{./Archivos/Capitulos/pfc_dedicatoria}
input{./Archivos/Capitulos/pfc_agradecimientos}
include{./Archivos/Capitulos/pfc_abreviaturas}
%
% FRONTMATTER: TOC, LOF, LOT
frontmatter
%
tableofcontents
listoffigures
listoftables
%
% MAINMATTER
%
mainmatter
include{./Archivos/Capitulos/pfc_intro}
include{./Archivos/Capitulos/pfc_main_010}
...
%
table-of-contents chapters fancyhdr
table-of-contents chapters fancyhdr
edited Oct 20 '13 at 18:55
Andrea L.
1,8271435
1,8271435
asked Oct 20 '13 at 18:33
Dave
362
362
3
This is a very common problem. Addmarkboth{Introduccion}{Introduccion}
afterchapter*{Introduccion}
. By the way, instead of redefiningcleardoublepage
, you can addusepackage{emptypage}
– egreg
Oct 20 '13 at 18:59
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– Andrew Swann
Oct 20 '13 at 19:19
It might already help if you move the introduction to thefrontmatter
and use a normalchapter
. An alternative could be to use a class and »scrpage2« from »KOMA-Script« and use itsaddchap
command.
– Thorsten Donig
Oct 21 '13 at 7:41
add a comment |
3
This is a very common problem. Addmarkboth{Introduccion}{Introduccion}
afterchapter*{Introduccion}
. By the way, instead of redefiningcleardoublepage
, you can addusepackage{emptypage}
– egreg
Oct 20 '13 at 18:59
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– Andrew Swann
Oct 20 '13 at 19:19
It might already help if you move the introduction to thefrontmatter
and use a normalchapter
. An alternative could be to use a class and »scrpage2« from »KOMA-Script« and use itsaddchap
command.
– Thorsten Donig
Oct 21 '13 at 7:41
3
3
This is a very common problem. Add
markboth{Introduccion}{Introduccion}
after chapter*{Introduccion}
. By the way, instead of redefining cleardoublepage
, you can add usepackage{emptypage}
– egreg
Oct 20 '13 at 18:59
This is a very common problem. Add
markboth{Introduccion}{Introduccion}
after chapter*{Introduccion}
. By the way, instead of redefining cleardoublepage
, you can add usepackage{emptypage}
– egreg
Oct 20 '13 at 18:59
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– Andrew Swann
Oct 20 '13 at 19:19
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– Andrew Swann
Oct 20 '13 at 19:19
It might already help if you move the introduction to the
frontmatter
and use a normal chapter
. An alternative could be to use a class and »scrpage2« from »KOMA-Script« and use its addchap
command.– Thorsten Donig
Oct 21 '13 at 7:41
It might already help if you move the introduction to the
frontmatter
and use a normal chapter
. An alternative could be to use a class and »scrpage2« from »KOMA-Script« and use its addchap
command.– Thorsten Donig
Oct 21 '13 at 7:41
add a comment |
2 Answers
2
active
oldest
votes
up vote
6
down vote
This is a very common problem. The chapter*
command doesn't update the marks that are used for the headers, while listoftables
does.
So the result is that after
mainmatter
chapter*{Introduccion}
The simplest and more effective remedy is to issue
markboth{Introduccion}{Introduccion}
since you're removing the usual uppercasing done by the book
class; you could also, for doing like the listof...
commands, type
markboth{MakeUppercase{Introduccion}}{MakeUppercase{Introduccion}}
so the style will be the same even if you eventually decide not to use fancyhdr
.
However, the best option, in my opinion, is to number also the introduction and forget about all these problems.
A couple of words about your style. I prefer to have a package loading section and then a setup section in the preamble. Also, pdftex
should not be passed to graphicx
. Instead of redefining cleardoublepage
it's simpler to load the emptypage
package.
I removed the settings to clubpenalty
and widowpenalty
to 10000, because this doesn't really solve the problems with club and widow lines. Reinstate them, if you prefer. Also setting a nonzero parskip should be avoided: it hinders readability rather than enhancing it, particularly in presence of short paragraphs, producing loads of white strips on the page.
Last, I added headheight=14.5pt
as requested by fancyhdr
.
Here's an edited version (kantlipsum
is just for producing some nonsense text).
documentclass[a4paper,12pt,twoside]{book}
usepackage[
bottom=25mm,
top=25mm,
left=30mm,
right=25mm,
headheight=14.5pt,
]{geometry}
usepackage[utf8]{inputenc}
usepackage[spanish, es-tabla]{babel}
usepackage{kantlipsum} % for populating the document
usepackage{morefloats}
usepackage{eurosym}
usepackage{graphicx}
usepackage{pdfpages}
usepackage{fancyhdr}
usepackage{emptypage}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
setcounter{secnumdepth}{3}
begin{document}
frontmatter
tableofcontents
listoffigures
listoftables
mainmatter
chapter*{Introduccion}
markboth{Introduccion}{Introduccion}
kant
chapter{Abc}
section{Def}
kant
begin{table}
caption{X}
end{table}
begin{figure}
caption{Y}
end{figure}
kant
end{document}
add a comment |
up vote
0
down vote
Try desactivating properties that you define of fancyhdr package, then put your chapter and your text and finally activates fancy properties again, but you have to be careful locating the lines to reactivate it:
listoftables
fancyhf{} % sets both header and footer to nothing
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}
chapter*{my-chapter-name}
blindtext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% NOTE: PAY ATTENTION HERE %%%%%%%%%%
%%%%
%%%% If the text after the 'chapter*{my-chapter-name}':
%%%% is more than one page, the lines after this note should
%%%% be exactly after the first paragraph of the second page
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pagestyle{fancy}
fancyfoot{}
fancyhead{}
fancyhead[L]{scriptsize leftmark}
fancyfoot[L]{scriptsize rightmark}
fancyhead[R]{thepage}
renewcommand{headrulewidth}{0.5pt}
renewcommand{footrulewidth}{0.5pt}
New contributor
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
This is a very common problem. The chapter*
command doesn't update the marks that are used for the headers, while listoftables
does.
So the result is that after
mainmatter
chapter*{Introduccion}
The simplest and more effective remedy is to issue
markboth{Introduccion}{Introduccion}
since you're removing the usual uppercasing done by the book
class; you could also, for doing like the listof...
commands, type
markboth{MakeUppercase{Introduccion}}{MakeUppercase{Introduccion}}
so the style will be the same even if you eventually decide not to use fancyhdr
.
However, the best option, in my opinion, is to number also the introduction and forget about all these problems.
A couple of words about your style. I prefer to have a package loading section and then a setup section in the preamble. Also, pdftex
should not be passed to graphicx
. Instead of redefining cleardoublepage
it's simpler to load the emptypage
package.
I removed the settings to clubpenalty
and widowpenalty
to 10000, because this doesn't really solve the problems with club and widow lines. Reinstate them, if you prefer. Also setting a nonzero parskip should be avoided: it hinders readability rather than enhancing it, particularly in presence of short paragraphs, producing loads of white strips on the page.
Last, I added headheight=14.5pt
as requested by fancyhdr
.
Here's an edited version (kantlipsum
is just for producing some nonsense text).
documentclass[a4paper,12pt,twoside]{book}
usepackage[
bottom=25mm,
top=25mm,
left=30mm,
right=25mm,
headheight=14.5pt,
]{geometry}
usepackage[utf8]{inputenc}
usepackage[spanish, es-tabla]{babel}
usepackage{kantlipsum} % for populating the document
usepackage{morefloats}
usepackage{eurosym}
usepackage{graphicx}
usepackage{pdfpages}
usepackage{fancyhdr}
usepackage{emptypage}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
setcounter{secnumdepth}{3}
begin{document}
frontmatter
tableofcontents
listoffigures
listoftables
mainmatter
chapter*{Introduccion}
markboth{Introduccion}{Introduccion}
kant
chapter{Abc}
section{Def}
kant
begin{table}
caption{X}
end{table}
begin{figure}
caption{Y}
end{figure}
kant
end{document}
add a comment |
up vote
6
down vote
This is a very common problem. The chapter*
command doesn't update the marks that are used for the headers, while listoftables
does.
So the result is that after
mainmatter
chapter*{Introduccion}
The simplest and more effective remedy is to issue
markboth{Introduccion}{Introduccion}
since you're removing the usual uppercasing done by the book
class; you could also, for doing like the listof...
commands, type
markboth{MakeUppercase{Introduccion}}{MakeUppercase{Introduccion}}
so the style will be the same even if you eventually decide not to use fancyhdr
.
However, the best option, in my opinion, is to number also the introduction and forget about all these problems.
A couple of words about your style. I prefer to have a package loading section and then a setup section in the preamble. Also, pdftex
should not be passed to graphicx
. Instead of redefining cleardoublepage
it's simpler to load the emptypage
package.
I removed the settings to clubpenalty
and widowpenalty
to 10000, because this doesn't really solve the problems with club and widow lines. Reinstate them, if you prefer. Also setting a nonzero parskip should be avoided: it hinders readability rather than enhancing it, particularly in presence of short paragraphs, producing loads of white strips on the page.
Last, I added headheight=14.5pt
as requested by fancyhdr
.
Here's an edited version (kantlipsum
is just for producing some nonsense text).
documentclass[a4paper,12pt,twoside]{book}
usepackage[
bottom=25mm,
top=25mm,
left=30mm,
right=25mm,
headheight=14.5pt,
]{geometry}
usepackage[utf8]{inputenc}
usepackage[spanish, es-tabla]{babel}
usepackage{kantlipsum} % for populating the document
usepackage{morefloats}
usepackage{eurosym}
usepackage{graphicx}
usepackage{pdfpages}
usepackage{fancyhdr}
usepackage{emptypage}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
setcounter{secnumdepth}{3}
begin{document}
frontmatter
tableofcontents
listoffigures
listoftables
mainmatter
chapter*{Introduccion}
markboth{Introduccion}{Introduccion}
kant
chapter{Abc}
section{Def}
kant
begin{table}
caption{X}
end{table}
begin{figure}
caption{Y}
end{figure}
kant
end{document}
add a comment |
up vote
6
down vote
up vote
6
down vote
This is a very common problem. The chapter*
command doesn't update the marks that are used for the headers, while listoftables
does.
So the result is that after
mainmatter
chapter*{Introduccion}
The simplest and more effective remedy is to issue
markboth{Introduccion}{Introduccion}
since you're removing the usual uppercasing done by the book
class; you could also, for doing like the listof...
commands, type
markboth{MakeUppercase{Introduccion}}{MakeUppercase{Introduccion}}
so the style will be the same even if you eventually decide not to use fancyhdr
.
However, the best option, in my opinion, is to number also the introduction and forget about all these problems.
A couple of words about your style. I prefer to have a package loading section and then a setup section in the preamble. Also, pdftex
should not be passed to graphicx
. Instead of redefining cleardoublepage
it's simpler to load the emptypage
package.
I removed the settings to clubpenalty
and widowpenalty
to 10000, because this doesn't really solve the problems with club and widow lines. Reinstate them, if you prefer. Also setting a nonzero parskip should be avoided: it hinders readability rather than enhancing it, particularly in presence of short paragraphs, producing loads of white strips on the page.
Last, I added headheight=14.5pt
as requested by fancyhdr
.
Here's an edited version (kantlipsum
is just for producing some nonsense text).
documentclass[a4paper,12pt,twoside]{book}
usepackage[
bottom=25mm,
top=25mm,
left=30mm,
right=25mm,
headheight=14.5pt,
]{geometry}
usepackage[utf8]{inputenc}
usepackage[spanish, es-tabla]{babel}
usepackage{kantlipsum} % for populating the document
usepackage{morefloats}
usepackage{eurosym}
usepackage{graphicx}
usepackage{pdfpages}
usepackage{fancyhdr}
usepackage{emptypage}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
setcounter{secnumdepth}{3}
begin{document}
frontmatter
tableofcontents
listoffigures
listoftables
mainmatter
chapter*{Introduccion}
markboth{Introduccion}{Introduccion}
kant
chapter{Abc}
section{Def}
kant
begin{table}
caption{X}
end{table}
begin{figure}
caption{Y}
end{figure}
kant
end{document}
This is a very common problem. The chapter*
command doesn't update the marks that are used for the headers, while listoftables
does.
So the result is that after
mainmatter
chapter*{Introduccion}
The simplest and more effective remedy is to issue
markboth{Introduccion}{Introduccion}
since you're removing the usual uppercasing done by the book
class; you could also, for doing like the listof...
commands, type
markboth{MakeUppercase{Introduccion}}{MakeUppercase{Introduccion}}
so the style will be the same even if you eventually decide not to use fancyhdr
.
However, the best option, in my opinion, is to number also the introduction and forget about all these problems.
A couple of words about your style. I prefer to have a package loading section and then a setup section in the preamble. Also, pdftex
should not be passed to graphicx
. Instead of redefining cleardoublepage
it's simpler to load the emptypage
package.
I removed the settings to clubpenalty
and widowpenalty
to 10000, because this doesn't really solve the problems with club and widow lines. Reinstate them, if you prefer. Also setting a nonzero parskip should be avoided: it hinders readability rather than enhancing it, particularly in presence of short paragraphs, producing loads of white strips on the page.
Last, I added headheight=14.5pt
as requested by fancyhdr
.
Here's an edited version (kantlipsum
is just for producing some nonsense text).
documentclass[a4paper,12pt,twoside]{book}
usepackage[
bottom=25mm,
top=25mm,
left=30mm,
right=25mm,
headheight=14.5pt,
]{geometry}
usepackage[utf8]{inputenc}
usepackage[spanish, es-tabla]{babel}
usepackage{kantlipsum} % for populating the document
usepackage{morefloats}
usepackage{eurosym}
usepackage{graphicx}
usepackage{pdfpages}
usepackage{fancyhdr}
usepackage{emptypage}
usepackage[pagebackref=true]{hyperref}
hypersetup{%
bookmarks=true, % barra de marcadores
unicode=false, % caracteres non-Latin en marcadores de Acrobat
pdftoolbar=true, % mostrar barra de herramientas de Acrobat
pdfmenubar=true, % mostrar menú de Acrobat
pdffitwindow=false, % ajustar ventana al ancho de página
pdfstartview={FitH}, % ajustar documento al ancho de página
pdftitle={Memoria PFC}, % título
pdfauthor={}, % autor
pdfsubject={}, % tema del documento
pdfcreator={}, % generador del documento
pdfproducer={}, % productor del documento
pdfkeywords={}, % lista de palabras clave
pdfnewwindow=true, % enlaces en una nueva ventana
colorlinks=true, % false: enlaces en caja; true: enlaces coloreados
linkcolor=blue, % color de enlaces internos
citecolor=green, % color de enlaces a bibliografía
filecolor=magenta, % color de enlaces a ficheros
urlcolor=blue % color de enlaces externos
}
pagestyle{fancy}
fancyhf{}
fancyhead[EL]{nouppercaseleftmark}
fancyhead[OR]{nouppercaserightmark}
fancyhead[ER,OL]{thepage}
setcounter{secnumdepth}{3}
begin{document}
frontmatter
tableofcontents
listoffigures
listoftables
mainmatter
chapter*{Introduccion}
markboth{Introduccion}{Introduccion}
kant
chapter{Abc}
section{Def}
kant
begin{table}
caption{X}
end{table}
begin{figure}
caption{Y}
end{figure}
kant
end{document}
answered Oct 20 '13 at 19:28
egreg
703k8618743151
703k8618743151
add a comment |
add a comment |
up vote
0
down vote
Try desactivating properties that you define of fancyhdr package, then put your chapter and your text and finally activates fancy properties again, but you have to be careful locating the lines to reactivate it:
listoftables
fancyhf{} % sets both header and footer to nothing
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}
chapter*{my-chapter-name}
blindtext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% NOTE: PAY ATTENTION HERE %%%%%%%%%%
%%%%
%%%% If the text after the 'chapter*{my-chapter-name}':
%%%% is more than one page, the lines after this note should
%%%% be exactly after the first paragraph of the second page
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pagestyle{fancy}
fancyfoot{}
fancyhead{}
fancyhead[L]{scriptsize leftmark}
fancyfoot[L]{scriptsize rightmark}
fancyhead[R]{thepage}
renewcommand{headrulewidth}{0.5pt}
renewcommand{footrulewidth}{0.5pt}
New contributor
add a comment |
up vote
0
down vote
Try desactivating properties that you define of fancyhdr package, then put your chapter and your text and finally activates fancy properties again, but you have to be careful locating the lines to reactivate it:
listoftables
fancyhf{} % sets both header and footer to nothing
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}
chapter*{my-chapter-name}
blindtext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% NOTE: PAY ATTENTION HERE %%%%%%%%%%
%%%%
%%%% If the text after the 'chapter*{my-chapter-name}':
%%%% is more than one page, the lines after this note should
%%%% be exactly after the first paragraph of the second page
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pagestyle{fancy}
fancyfoot{}
fancyhead{}
fancyhead[L]{scriptsize leftmark}
fancyfoot[L]{scriptsize rightmark}
fancyhead[R]{thepage}
renewcommand{headrulewidth}{0.5pt}
renewcommand{footrulewidth}{0.5pt}
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
Try desactivating properties that you define of fancyhdr package, then put your chapter and your text and finally activates fancy properties again, but you have to be careful locating the lines to reactivate it:
listoftables
fancyhf{} % sets both header and footer to nothing
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}
chapter*{my-chapter-name}
blindtext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% NOTE: PAY ATTENTION HERE %%%%%%%%%%
%%%%
%%%% If the text after the 'chapter*{my-chapter-name}':
%%%% is more than one page, the lines after this note should
%%%% be exactly after the first paragraph of the second page
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pagestyle{fancy}
fancyfoot{}
fancyhead{}
fancyhead[L]{scriptsize leftmark}
fancyfoot[L]{scriptsize rightmark}
fancyhead[R]{thepage}
renewcommand{headrulewidth}{0.5pt}
renewcommand{footrulewidth}{0.5pt}
New contributor
Try desactivating properties that you define of fancyhdr package, then put your chapter and your text and finally activates fancy properties again, but you have to be careful locating the lines to reactivate it:
listoftables
fancyhf{} % sets both header and footer to nothing
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}
chapter*{my-chapter-name}
blindtext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% NOTE: PAY ATTENTION HERE %%%%%%%%%%
%%%%
%%%% If the text after the 'chapter*{my-chapter-name}':
%%%% is more than one page, the lines after this note should
%%%% be exactly after the first paragraph of the second page
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pagestyle{fancy}
fancyfoot{}
fancyhead{}
fancyhead[L]{scriptsize leftmark}
fancyfoot[L]{scriptsize rightmark}
fancyhead[R]{thepage}
renewcommand{headrulewidth}{0.5pt}
renewcommand{footrulewidth}{0.5pt}
New contributor
New contributor
answered 29 mins ago
Cruz E
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f139758%2fproblem-with-chapter-and-fancyhdr%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
This is a very common problem. Add
markboth{Introduccion}{Introduccion}
afterchapter*{Introduccion}
. By the way, instead of redefiningcleardoublepage
, you can addusepackage{emptypage}
– egreg
Oct 20 '13 at 18:59
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– Andrew Swann
Oct 20 '13 at 19:19
It might already help if you move the introduction to the
frontmatter
and use a normalchapter
. An alternative could be to use a class and »scrpage2« from »KOMA-Script« and use itsaddchap
command.– Thorsten Donig
Oct 21 '13 at 7:41