O cabeçalho e o rodapé do Fancyhdr desaparecem

O cabeçalho e o rodapé do Fancyhdr desaparecem

Assim como diz no título, meu cabeçalho e rodapé desaparecem aleatoriamente após minha segunda página numerada.

Este é o meu preâmbulo:

% !TeX spellcheck = hr_HR
\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[
 backend=bibtex      % biber or bibtex
,style=numeric-comp  % numerical-compressed
,sorting=none        % no sorting
,sortcites=true      % some other example options ...
,block=none
,indexing=false
,citereset=none
,isbn=true
,url=true
,doi=true            % prints doi
,natbib=true         % if you need natbib functions
]{biblatex}

\addbibresource{bibliografija.bib}
\nocite{*}

\usepackage{fancyhdr}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[croatian]{babel}

\ifx\l@croatian\@undefined
    \@nopatterns{Croatian}
    \adddialect\l@croatian0\fi

\captionscroatian

\usepackage{graphicx}
\graphicspath{ {img/} }

\renewcommand{\contentsname}{Sadržaj}

\title{MVC arhitektura unutar AngularJS razvojnog okvira}
\author{Marko Klobučar}
\date{Lipanj, 2017.}

Os comandos que emiti para iniciar o cabeçalho e rodapé são os seguintes:

\pagestyle{fancy}
\fancyhf{}

\lhead{Sveučilište Sjever - Multimedija, oblikovanje i primjena}
\rhead{Marko Klobučar}
\rfoot{Stranica \thepage~od~\pageref{lastpage}}

\pagenumbering{arabic}

E está tudo bem por duas páginas inteiras. E então, de repente, o cabeçalho e o rodapé desaparecem na minha sexta página real, mas na terceira página numerada.

Lamento muito se isso já foi respondido antes, procurei por uma hora e não consegui encontrar o que procurava. Também sou um iniciante em Latex e agradeceria qualquer ajuda.

Agradeço antecipadamente! Por favor, deixe-me saber se devo incluir algo que esqueci.

EDITAR: Aqui está o documento pequeno.

% !TeX spellcheck = hr_HR
\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
%\usepackage[
% backend=bibtex
%]{biblatex}

% \addbibresource{bibliografija.bib}
% \nocite{*}

\usepackage{fancyhdr}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[croatian]{babel}

\ifx\l@croatian\@undefined
    \@nopatterns{Croatian}
    \adddialect\l@croatian0\fi

\captionscroatian

\usepackage{graphicx}
\graphicspath{ {img/} }

\renewcommand{\contentsname}{Sadržaj}

\title{Title}
\author{Me}
\date{Now}

\begin{document}

\pagestyle{empty}
\pagenumbering{gobble}

\begin{titlepage}
    \maketitle
\end{titlepage}

\newpage
\tableofcontents
\newpage

\begin{spacing}{1.5}
\section*{Lorem ipsum.}
Lorem ipsum.

\newpage

\pagestyle{fancy}
\fancyhf{}

\lhead{Header left}
\rhead{John Doe}
\rfoot{Page \thepage~of~\pageref{lastpage}}

\pagenumbering{arabic}

\section{Sažetak}
Lorem ipsum dolor sit amet.
\newpage

\section{Uvod}
Lorem ipsum dolor sit amet.
\newpage

\section{Trouble!}
\subsection{This part is messed up.}
This section is where the header and footer disappear.

\subsection{Lorem ipsum.}
Lorem ipsum.

\end{spacing}
\newpage

\section{Popis literature}
\label{lastpage}
\vspace*{-1cm}
% \printbibliography[title=~]

\end{document}

Responder1

Aqui estão dois códigos simples possíveis:

  • Ou você usa o {spacing}{1.5}ambiente, e tem que colocar o último \newpagecomando logo antes \end{spacing}, e repetir \pagestyle{fancy}logo depois,
  • Ou você usa o \onehalfspacingcomando e substitui \end{spacing}por \singlespacing.

Aqui estão os códigos para a parte relevante:

Com o meio ambiente:

\begin{spacing}{1.5}
\section*{Predgovor}
Here's some text.

\newpage
\pagestyle{fancy}
\pagenumbering{arabic}

\section{Sažetak}
Lorem ipsum dolor sit amet.
\newpage

\section{Uvod}
Lorem ipsum dolor sit amet.
\newpage

\section{O tehnologiji}
\subsection{O pojmu arhitekture u softverskom razvoju}
Here's some text.

\subsection{Opis MVC arhitekture}
Here's some text.
\newpage
\end{spacing}

\pagestyle{fancy}

\section{Popis literature}
\label{lastpage}
\vspace*{-1cm}
\printbibliography[title=Bib]

Com os comandos:

\onehalfspacing

\section*{Predgovor}
Here's some text.
\newpage
\pagestyle{fancy}
\pagenumbering{arabic}

\section{Sažetak}
Lorem ipsum dolor sit amet.
\newpage

\section{Uvod}
Lorem ipsum dolor sit amet.
\newpage

\section{O tehnologiji}
\subsection{O pojmu arhitekture u softverskom razvoju}
Here's some text.

\subsection{Opis MVC arhitekture}
Here's some text.

\newpage
\singlespacing

\section{Popis literature}
\label{lastpage}
\vspace*{-1cm}
\printbibliography[title=Bib]

insira a descrição da imagem aqui

Responder2

Eu resolvi meu problema. O problema é que o cabeçalho e o rodapé terminavam logo após o término da seção de espaçamento, então fiz alguns ajustes manuais e agora funciona. Aqui está o código mínimo:

% !TeX spellcheck = hr_HR
\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[
 backend=bibtex
]{biblatex}

\addbibresource{bibliografija.bib}
\nocite{*}

\usepackage{fancyhdr}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[croatian]{babel}

\ifx\l@croatian\@undefined
    \@nopatterns{Croatian}
    \adddialect\l@croatian0\fi

\captionscroatian

\usepackage{graphicx}
\graphicspath{ {img/} }

\renewcommand{\contentsname}{Sadržaj}

\title{Here's some text.}
\author{Here's some text.}
\date{Lipanj, 2017.}

\fancyhf{}
\lhead{Here's some text.}
\rhead{Here's some text.}
\rfoot{Stranica \thepage~od~\pageref{lastpage}}

\begin{document}
\pagestyle{empty}
\pagenumbering{gobble}

\begin{titlepage}
    \maketitle

    \newpage

    \tableofcontents

    \newpage
\end{titlepage}

\begin{spacing}{1.5}
\section*{Predgovor}
Here's some text.
\newpage
\end{spacing}

\begin{spacing}{1.5}
\pagestyle{fancy}
\pagenumbering{arabic}

\section{Sažetak}
Lorem ipsum dolor sit amet.
\newpage

\section{Uvod}
Lorem ipsum dolor sit amet.
\newpage

\section{O tehnologiji}
\subsection{O pojmu arhitekture u softverskom razvoju}
Here's some text.

\subsection{Opis MVC arhitekture}
Here's some text.
\end{spacing}

\newpage
\pagestyle{fancy}

\section{Popis literature}
\label{lastpage}
\vspace*{-1cm}
\printbibliography[title=~]

\end{document}

Não é a coisa mais bonita, mas faz o que eu queria e isso é bom o suficiente para mim.

Responder3

Editar Agora vejo o problema. Veja se a seguinte solução é aceitável para você:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{fancyhdr}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[croatian]{babel}

\renewcommand{\contentsname}{Sadržaj}

\title{Title}
\author{Me}
\date{Now}

\fancyhf{}% head to be in preamble !
\lhead{Header left}
\rhead{John Doe}
\rfoot{Page \thepage~of~\pageref{lastpage}}

\begin{document}
\pagestyle{fancy}
\thispagestyle{empty}
\pagenumbering{gobble}

\begin{titlepage}
    \maketitle
\end{titlepage}

\newpage
\thispagestyle{plain}% or empty)
\tableofcontents

\newpage
\thispagestyle{plain}% or empty)
\begin{spacing}{1.5}
\section*{Lorem ipsum.}
Lorem ipsum.

\newpage
\section{Sažetak}
Lorem ipsum dolor sit amet.
\newpage

\newpage
\section{Uvod}
Lorem ipsum dolor sit amet.


\newpage
\section{Trouble!}
\subsection{This part is messed up.}
This section is where the header and footer disappear.

\subsection{Lorem ipsum.}
Lorem ipsum.

\end{spacing}

\newpage
%\thispagestyle{empty} % addin case if the Literature had not have fancypage style
\section{Popis literature}
\label{lastpage}
\end{document}

informação relacionada