2

I'm developing a business procedure template, and I noticed that by applying the title (with all its features) to the page, the fancyhead disappears on the page where the title has been applied. Probably due to the overlap of two or more rules.

This is my markup:

%   ╔═╗┬─┐┌─┐┌─┐┌┬┐┌┐ ┌─┐┬  ┌─┐
%   ╠═╝├┬┘├┤ ├─┤│││├┴┐│ ││  │ │
%   ╩  ┴└─└─┘┴ ┴┴ ┴└─┘└─┘┴─┘└─┘

% setto il tipo di documento come articolo
\documentclass[a4paper,12pt]{article}

% gestione del titolo centrale
\title{Titolo della procedura}
\usepackage{titling}
\renewcommand\maketitlehooka{\null\mbox{}\vfill}
\renewcommand\maketitlehookd{\vfill\null}

% formattazione per italico, bold, etc..
\usepackage[T1]{fontenc}

% documento in italiano, quindi i capitoli in italiano
\usepackage[italian]{babel}

% imposto il garamond su tutto il documento 
\usepackage{ebgaramond}

% conto il numero di pagine 
\usepackage{lastpage}

% genera il famoso testo casuale in latino
\usepackage{lipsum}

% colore giallo della tabella 
\usepackage[table]{xcolor} 

% serve per definire lo spessore della tabella, necessario perchè indefinita
\usepackage{array}

% stile della 
\usepackage{fancyhdr}

% setta i margini pari da tutte le parti
\usepackage[hmargin=2cm]{geometry} 

% viene settato il tipo di stile (fancy)
\pagestyle{fancy}

% serve per aggiustare la tabella degli allegati
%\usepackage{adjustbox}

% aggiunge le multirow ad una tabella
\usepackage{multirow}

%
% DIMENSIONE HEADER 
%

% serve per adattare l'header alla grandezza delle cose che ha dentro
\setlength{\headheight}{90pt}

%
% DIMENSIONE HEADER
%

% non vedo sbavature sulla linea bassa della tabella 
\renewcommand{\headrulewidth}{0pt}

% clear out all headers
\fancyhead[CE,CO,LE,LO,RE,RO]{} %
\fancyhead[C]{%
    \setlength\arrayrulewidth{1pt}
    \begin{tabular}{|>{\centering}m{3.0cm}|>{\centering}m{10.0cm}|>{\centering}m{2.6cm}|} % <---
        \hline codice di riparto \\ ed un'altra info
        & \cellcolor{yellow}{Titolo della procedura\\ primo a capo \\ secondo a capo \\ terzo a capo} % <---
        & \tiny Pag. \thepage\ di \pageref{LastPage}\\Data: 17/05/2013\\Rev. 0\tabularnewline
        \hline
    \end{tabular}
}   

\thispagestyle{fancy}

%---------------- show page layout don't use in a real document!
\usepackage{showframe}
%---------------------------------------------------------------%

\usepackage[hidelinks]{hyperref} % <--- moved to last place in preamble

%   ╦┌┐┌┬┌─┐┬┌─┐  ╔╦╗┌─┐┌─┐┬ ┬┌┬┐┌─┐┌┐┌┌┬┐┌─┐
%   ║││││┌─┘││ │   ║║│ ││  │ ││││├┤ │││ │ │ │
%   ╩┘└┘┴└─┘┴└─┘  ═╩╝└─┘└─┘└─┘┴ ┴└─┘┘└┘ ┴ └─┘

\begin{document}
\begin{titlingpage}
    \maketitle

    \begin{table}[htbp] 
        \setlength\arrayrulewidth{1pt}
        \begin{tabular}{|p{3.8cm}|p{3.8cm}|p{3.8cm}|p{3.8cm}|}
            \hline
            \rowcolor{yellow}
            Fasi & Nomi & Funzioni & Data \\ \hline

            % inizio colonna multipla

            \multirow{2}{*}{Testo} & 0 & 6 & 230 \\ \cline{2-4}
            & 1 & 5 & 195  \\ \hline

            % fine colonna multipla 

            A & B & C & D \\    

            \hline
        \end{tabular}
    \end{table}
\end{titlingpage}
\newpage

\tableofcontents
\begin{table}[ht]
        \begin{tabular}{|p{4.5cm}|p{11.6cm}|}%{width=1\textwidth}
                    \hline
                    \multicolumn{2}{|l|}{\textbf{\textsc{Country List}}} \\
                    \hline
                    Afghanistan  & AF\\
                    \hline
                    Aland Islands&   AX\\
                    \hline
                    Albania &AL\\
                    \hline
                    Algeria    &DZ\\
                    \hline
                    American Samoa&   AS\\
                    \hline
                    Andorra& AD\\
                    \hline
                    Angola& AO\\
                    \hline
        \end{tabular}
\end{table}

\section{Titolo del primo capitolo}
\lipsum[1-10]
\subsection{Titolo del sottocapitolo}
\end{document}

and this is what I see (and I don't see):

Missed Fancy

Fancy good

Not only the fancyhead is removed from the first page, but it seems to be interpreted only from the second page...! At this point I think it is the title that overwrites the rules.

My question is ... is it possible to keep the title centered on the first page and use the fancyhead at the same time? Next, even the page title should not be counted from the second page onwards.
Thanks in advance.

5
  • A header on the title page goes against all typographical rules… – Bernard Oct 28 '19 at 11:09
  • I understand... Unfortunately, the procedures of Italian healthcare companies are done in this way... – Memmo Oct 28 '19 at 11:15
  • Maybe adding \thispagestyle{fancy}? If it doesn't work, emulating the header with the tools provided by titling? (That's a crime against Garamond ;o)) – Bernard Oct 28 '19 at 11:25
  • I will try ... but I think so ... it is a crime against the garamond! Instead you can't use a similar structure instead of the title that should be centralized on the page? – Memmo Oct 28 '19 at 12:05
  • It's only a personal opinion – and a joke. I'm very pernickety as to typography (fonts, margins and the like…) – Bernard Oct 28 '19 at 12:12
3

The titlingpage environment sets \thispagestyle{empty} and you need to patch it.

I added the setting of the page number to 0, so the header will display some more sensible info (and you also avoid an anchor error for the hyperlinks).

I also reorganized the preamble dividing it into

  1. packages
  2. settings
  3. personal commands

In the last category, I added code for computing the table column widths without guessing.

Note that you don't need to pack the tabular environments in floating table environments: you actually shouldn't if the tables have a fixed position. I left the “countries” table in a floating environment, you can decide whether it's needed or not.

\documentclass[a4paper,12pt]{article}

\usepackage{geometry}

\usepackage[T1]{fontenc}
\usepackage[italian]{babel}

\usepackage{titling}
\usepackage{lastpage}
\usepackage[table]{xcolor} 

\usepackage{multirow}
\usepackage{array}
%\usepackage{adjustbox}
\usepackage{etoolbox} % we need to patch \end{titlingpage}

\usepackage{fancyhdr}

% per l'esempio
\usepackage{lipsum}
\usepackage{showframe}

\usepackage{ebgaramond}

\usepackage[hidelinks]{hyperref} % <--- ultimo dei pacchetti


% Impostazioni

% 1. pagina
\geometry{
  hmargin=2cm,
  headheight=90pt,
}

% 2. titolo
\renewcommand\maketitlehooka{\null\mbox{}\vfill}
\renewcommand\maketitlehookd{\vfill\null}
\patchcmd{\endtitlingpage}{empty}{fancy}{}{}

% 3. testatina e piede

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\fancyhf{} % annulla tutto
\fancyhead[C]{%
  \setlength\arrayrulewidth{1pt}%
  \settablemodulus{156}{3}%
  \begin{tabular}{
  |>{\centering}m{30\tablemodulus}|
   >{\centering}m{100\tablemodulus}|
   >{\centering}m{26\tablemodulus}|
  }
    \hline codice di riparto \\ e un'altra info
    & \cellcolor{yellow}{Titolo della procedura\\ primo a capo \\ secondo a capo \\ terzo a capo}
    & \tiny Pag. \thepage\ di \pageref{LastPage}\\Data: 17/05/2013\\Rev. 0\tabularnewline
    \hline
  \end{tabular}% <---
}

% comandi personali

\newlength{\tablemodulus}
\newcommand{\settablemodulus}[2]{%
  % #1 = ripartizione, #2 = numero di colonne
  \setlength{\tablemodulus}{\dimexpr(\textwidth-2\tabcolsep*(#2)-\arrayrulewidth*(#2+1))/(#1)}
}

% Metadati

\title{Titolo della procedura}
\author{Memmo}

\begin{document}

\begin{titlingpage}

\setcounter{page}{0}

\maketitle

\setlength\arrayrulewidth{1pt}
\settablemodulus{4}{4}

\noindent
\begin{tabular}{|*{4}{p{\tablemodulus}|}}
  \hline
  \rowcolor{yellow}
  Fasi & Nomi & Funzioni & Data \\ \hline
  % inizio colonna multipla
  \multirow{2}{*}{Testo} & 0 & 6 & 230 \\ \cline{2-4}
  & 1 & 5 & 195  \\ \hline
  % fine colonna multipla 
  A & B & C & D \\    
  \hline
\end{tabular}

\end{titlingpage}

%\newpage

\tableofcontents
\begin{table}[ht]
        \begin{tabular}{|p{4.5cm}|p{11.6cm}|}%{width=1\textwidth}
                    \hline
                    \multicolumn{2}{|l|}{\textbf{\textsc{Country List}}} \\
                    \hline
                    Afghanistan  & AF\\
                    \hline
                    Aland Islands&   AX\\
                    \hline
                    Albania &AL\\
                    \hline
                    Algeria    &DZ\\
                    \hline
                    American Samoa&   AS\\
                    \hline
                    Andorra& AD\\
                    \hline
                    Angola& AO\\
                    \hline
        \end{tabular}
\end{table}

\section{Titolo del primo capitolo}
\lipsum[1-10]
\subsection{Titolo del sottocapitolo}
\end{document}

enter image description here

A final recommendation: we say impostare, decidere or stabilire in Italian, not the abominable settare.

1
  • You're right... if I have to put a comment in a typographic composition in Italian, it's right that I use an Italian word! Not an Italianized word! Thanks! – Memmo Oct 29 '19 at 8:58
2

First page uses empty pagestyle. If this pagestye is defined the same way as fancy style, the header appears

%   ╔═╗┬─┐┌─┐┌─┐┌┬┐┌┐ ┌─┐┬  ┌─┐
%   ╠═╝├┬┘├┤ ├─┤│││├┴┐│ ││  │ │
%   ╩  ┴└─└─┘┴ ┴┴ ┴└─┘└─┘┴─┘└─┘

% setto il tipo di documento come articolo
\documentclass[a4paper,12pt]{article}

% gestione del titolo centrale
\title{Titolo della procedura}
\usepackage{titling}
\renewcommand\maketitlehooka{\null\mbox{}\vfill}
\renewcommand\maketitlehookd{\vfill\null}

% formattazione per italico, bold, etc..
\usepackage[T1]{fontenc}

% documento in italiano, quindi i capitoli in italiano
\usepackage[italian]{babel}

% imposto il garamond su tutto il documento 
\usepackage{ebgaramond}

% conto il numero di pagine 
\usepackage{lastpage}

% genera il famoso testo casuale in latino
\usepackage{lipsum}

% colore giallo della tabella 
\usepackage[table]{xcolor} 

% serve per definire lo spessore della tabella, necessario perchè indefinita
\usepackage{array}

% stile della 
\usepackage{fancyhdr}

% setta i margini pari da tutte le parti
\usepackage[hmargin=2cm]{geometry} 

% viene settato il tipo di stile (fancy)
\pagestyle{fancy}

% serve per aggiustare la tabella degli allegati
%\usepackage{adjustbox}

% aggiunge le multirow ad una tabella
\usepackage{multirow}

%
% DIMENSIONE HEADER 
%

% serve per adattare l'header alla grandezza delle cose che ha dentro
\setlength{\headheight}{90pt}

%
% DIMENSIONE HEADER
%

% non vedo sbavature sulla linea bassa della tabella 
\renewcommand{\headrulewidth}{0pt}

\fancypagestyle{empty}{
\fancyhead[C,CO,L,LO,R,RO]{} %
\fancyhead[C]{%
    \setlength\arrayrulewidth{1pt}
    \begin{tabular}{|>{\centering}m{3.0cm}|>{\centering}m{10.0cm}|>{\centering}m{2.6cm}|} % <---
        \hline codice di riparto \\ ed un'altra info
        & \cellcolor{yellow}{Titolo della procedura\\ primo a capo \\ secondo a capo \\ terzo a capo} % <---
        & \tiny Pag. \thepage\ di \pageref{LastPage}\\Data: 17/05/2013\\Rev. 0\tabularnewline
        \hline
    \end{tabular}
}
}

% clear out all headers
\fancyhead[C,CO,L,LO,R,RO]{} %
\fancyhead[C]{%
    \setlength\arrayrulewidth{1pt}
    \begin{tabular}{|>{\centering}m{3.0cm}|>{\centering}m{10.0cm}|>{\centering}m{2.6cm}|} % <---
        \hline codice di riparto \\ ed un'altra info
        & \cellcolor{yellow}{Titolo della procedura\\ primo a capo \\ secondo a capo \\ terzo a capo} % <---
        & \tiny Pag. \thepage\ di \pageref{LastPage}\\Data: 17/05/2013\\Rev. 0\tabularnewline
        \hline
    \end{tabular}
}   
\thispagestyle{fancy}




%---------------- show page layout don't use in a real document!
\usepackage{showframe}
%---------------------------------------------------------------%

\usepackage[hidelinks]{hyperref} % <--- moved to last place in preamble

%   ╦┌┐┌┬┌─┐┬┌─┐  ╔╦╗┌─┐┌─┐┬ ┬┌┬┐┌─┐┌┐┌┌┬┐┌─┐
%   ║││││┌─┘││ │   ║║│ ││  │ ││││├┤ │││ │ │ │
%   ╩┘└┘┴└─┘┴└─┘  ═╩╝└─┘└─┘└─┘┴ ┴└─┘┘└┘ ┴ └─┘

\begin{document}
\begin{titlingpage}
    \maketitle

    \begin{table}[htbp] 
        \setlength\arrayrulewidth{1pt}
        \begin{tabular}{|p{3.8cm}|p{3.8cm}|p{3.8cm}|p{3.8cm}|}
            \hline
            \rowcolor{yellow}
            Fasi & Nomi & Funzioni & Data \\ \hline

            % inizio colonna multipla

            \multirow{2}{*}{Testo} & 0 & 6 & 230 \\ \cline{2-4}
            & 1 & 5 & 195  \\ \hline

            % fine colonna multipla 

            A & B & C & D \\    

            \hline
        \end{tabular}
    \end{table}
\end{titlingpage}
\newpage

\tableofcontents
\begin{table}[ht]
        \begin{tabular}{|p{4.5cm}|p{11.6cm}|}%{width=1\textwidth}
                    \hline
                    \multicolumn{2}{|l|}{\textbf{\textsc{Country List}}} \\
                    \hline
                    Afghanistan  & AF\\
                    \hline
                    Aland Islands&   AX\\
                    \hline
                    Albania &AL\\
                    \hline
                    Algeria    &DZ\\
                    \hline
                    American Samoa&   AS\\
                    \hline
                    Andorra& AD\\
                    \hline
                    Angola& AO\\
                    \hline
        \end{tabular}
\end{table}

\section{Titolo del primo capitolo}
\lipsum[1-10]
\subsection{Titolo del sottocapitolo}
\end{document}
2
  • Quite ingenious! – Bernard Oct 28 '19 at 12:02
  • Good... but the page number gets busted... – Memmo Oct 28 '19 at 12:05

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.