1

I'm trying to visualize a table inside a fancyhead.

This table has only the yellow central column. The problem is that when I go to compile and open the document with Acrobat DC, I don't see the top line of the cell.

This is my markup:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage[hidelinks]{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{fancyhdr}
\usepackage[hmargin=2cm,top=4cm,headheight=65pt,footskip=65pt]{geometry}

\setlength{\parindent}{0.95cm}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{%
    \begin{tabular}{|m{3.0cm}|m{10.0cm}|m{2.5cm}|}
        \hline
        codice di riparto &
        \cellcolor{yellow}\centering
        TITLE \\ 
        vediamo cosa c'è\\ ma poi cosa succede &
        \centering
        \tiny{Pag. \thepage\ di \pageref{LastPage}\\
              Data: 17/05/2013\\
              Rev. 0}\tabularnewline
        \hline
    \end{tabular}
}
\thispagestyle{fancy}
\begin{document}

%\chapter{Chapter title}
%% add this if you want the fancy style also on the first page of a chapter:
\section{Section title}
\subsection{non lo so}
\lipsum[1-10]
\end{document}

And this is the rendering of the table (wrong): doc rendered on Acrobat DC

I wonder if I forgot something to define the table, or the color of its cell.

2

To long to be a comment:

Your code is just fine. Invisible part of line is consequence of pdf viewer artifact. For example with your code I obtain the following result in Sumatra pdf viewer:

enter image description here

Anyway, I suggest you the following small changes of your code (marked by % <---):

\documentclass[a4paper,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{array}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{fancyhdr}
\usepackage[hmargin=2cm,top=4cm,headheight=65pt,footskip=65pt]{geometry}
\usepackage[hidelinks]{hyperref} % <--- moved to last place in preamble

\setlength{\parindent}{0.95cm}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{%
    \begin{tabular}{|m{3.0cm}|>{\centering}m{10.0cm}|>{\centering}m{2.5cm}|} % <---
        \hline
        codice di riparto 
            &   \cellcolor{yellow}{TITLE \\ % <---
                vediamo cosa c'è\\ ma poi cosa succede} % <---
                &   \tiny % <---
                    Pag. \thepage\ di \pageref{LastPage}\\
                    Data: 17/05/2013\\
                    Rev. 0          \tabularnewline
        \hline
    \end{tabular}
}
\thispagestyle{fancy}
\begin{document}

%\chapter{Chapter title}
%% add this if you want the fancy style also on the first page of a chapter:
\section{Section title}
\subsection{non lo so}
\lipsum[1-10]
\end{document}

Edit: In comment you claim, that your problem gas source in size of page header. Let me add showframe package, which show your actual page layout. With it and small change of table width (that it will has width of text), the result is:

enter image description here

(red lines indicate page layout)

From above image clearly seen, that the height of page header much bigger than height of table. Above image is produced by the following MWE:

\documentclass[a4paper,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{array}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{fancyhdr}
\usepackage[hmargin=2cm,top=4cm,
            headheight=65pt,footskip=65pt]{geometry}
\usepackage[hidelinks]{hyperref} % <--- moved to last place in preamble

%---------------- show page layoutdon't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\setlength{\parindent}{0.95cm}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{\setlength\arrayrulewidth{0.5pt}%
    \begin{tabular}{|m{3cm}|
        >{\centering}m{\dimexpr\linewidth-5.5cm-6\tabcolsep-4\arrayrulewidth}|
        >{\centering}m{2.5cm}|} % <---
        \hline
        codice di riparto
            &   \cellcolor{yellow}{TITLE \\ % <---
                vediamo cosa c'è\\ ma poi cosa succede} % <---
                &   \tiny % <---
                    Pag. \thepage\ di \pageref{LastPage}\\
                    Data: 17/05/2013\\
                    Rev. 0          \tabularnewline
        \hline
    \end{tabular}
}
\thispagestyle{fancy}
\begin{document}

\section{Section title}
\subsection{non lo so}
\lipsum[1-10]
\end{document}
  • nothing... the problem remains... – Memmo Oct 22 '19 at 7:41
  • 1
    @Memmo The problem with colours overlapping rules in tabulars, is a well known problem, described several questions and answers on this site. The only solution I have fond that works, is to change to the package cals. – Sveinung Oct 22 '19 at 7:44
  • I don't think it's a color problem, but a fancyhead adaptation problem. The fancyhead must model itself according to the text it has inside, meanwhile it must not go above the titles and the text. For now the only way to adapt it is to do tuning with \setlength{\headheight}{90pt}, but I'd like to find a more universally automatic way to do... – Memmo Oct 22 '19 at 8:57
  • @Memmo, sorry, than your question is unclear. We can't help you than. – Zarko Oct 22 '19 at 10:20
  • I had started with a belief about a mistake concerning the color of the cell, but then I realized, thanks to the circumstance, that the problem was in the policy of the fancyhead (moreover, not easy!) – Memmo Oct 22 '19 at 10:42
1

The rules are there, but it may happen that a PDF viewer doesn't show it.

Some better code:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage[hidelinks]{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{fancyhdr}
\usepackage[hmargin=2cm,top=4cm,headheight=65pt,footskip=65pt]{geometry}

\setlength{\parindent}{0.95cm}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{%
    \begin{tabular}{|m{3.0cm}|m{10.0cm}|m{2.5cm}|}
        \hline
        codice di riparto &
        \cellcolor{yellow}\centering
        TITLE \\ 
        vediamo cosa c'è\\ ma poi cosa succede &
        \centering
        \tiny{Pag. \thepage\ di \pageref{LastPage}\\
              Data: 17/05/2013\\
              Rev. 0}\tabularnewline
        \hline
    \end{tabular}
}
\thispagestyle{fancy}
\begin{document}

%\chapter{Chapter title}
%% add this if you want the fancy style also on the first page of a chapter:
\section{Section title}
\subsection{non lo so}
\lipsum[1-10]
\end{document}

enter image description here

enter image description here

Depending on the resolution and the magnification factor, the rules may seem to disappear.

Not the answer you're looking for? Browse other questions tagged or ask your own question.