1

I've been trying to make a proper header for my lab reports, that uses a table with 2 pictures. Thing is, each cell in the table has a different length.

Using this online table generator I was kind of able to emulate the tables my university uses as headers.

The code I got is:

\documentclass[12pt,letterpaper]{article} 
\usepackage[spanish]{babel}                                     
\usepackage[utf8]{inputenc} 
\batchmode
\usepackage{blindtext}
\usepackage{graphicx}                       
\usepackage{geometry}                                                       
\geometry{left=13mm,right=13mm,top=21mm,bottom=21mm}

\usepackage{float}                                                                          
\usepackage{multicol}   
\usepackage{array}
\usepackage{adjustbox}                                                  


\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{tabularx}


\begin{document}
\resizebox{\textwidth}{!}{
\begin{tabular}{|c|c|l|l|c|}
\hline
    \multicolumn{4}{|c|}
       {\tiny \textsc{\begin{tabular}[c]{@{}c@{}}Universidad de Costa Rica\\ 
        Escuela de Ingeniería Eléctrica\\ Departamento de Electrónica Y 
        Telecomunicaciones\end{tabular}}}   
       & 
       {\tiny \textsc{\begin{tabular}[c]{@{}c@{}}\hfill \adjustbox{valign=t] 
       {\includegraphics[width=1cm, height=1.10cm]{images/escudo}
        \includegraphics[width=2cm, height=1.10cm]{images/eie}}
       \hfill Pág.\thepage \\ \end{tabular}}}  \\

        \hline

        {\tiny \textsc{\begin{tabular}[c]{@{}c@{}}Preparado por: \\
        Author, ID\\ Author, ID\\ Author, ID \end{tabular}}  }    
        & \multicolumn{4}{c|}
        {{\tiny \textsc{\begin{tabular}[c]{@{}c@{}}IE|0307 Electromagnetismo
          I - I Ciclo 2018\\ Laboratorio de Electromagnetismo y 
          Radiofrecuencia|Reporte Práctica Experimental 01\\ 
         \end{tabular}}}} \\ 

        \hline

    \end{tabular}%
} 
\blindtext[25]
\end{document}

And with that the result I get is this:

Table Obtained

The thing is that I'm not familiar to the facyheader package, and I haven't been able to put that table as a header.

Also, I'm supposed to put the date beneath the page count, but I'm not able to, because of how the table is structured.

I've seen similar posts such as Table as Header and Footer and Table as Header - How to? but none are quite the same, and I've been hard stuck with this. I would greatly appreciate if you could help me understand this one.

1

enter image description here

based on my answer to question Table as Header - How to?:

\documentclass[12pt,letterpaper]{article}
\usepackage[top=5cm,headheight=2cm]{geometry}
%\geometry{left=13mm,right=13mm,top=21mm,bottom=21mm}

\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
%\batchmode
\usepackage{makecell,multirow,tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[demo]{graphicx}
\usepackage[export]{adjustbox}

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{%
    \tiny
    \scshape
    \setlength\extrarowheight{3pt}
\noindent\begin{tabularx}{\linewidth}{|C|C|}
    \hline
Universidad de Costa Rica\newline
Escuela de Ingeniería Eléctrica\newline
Departamento de Electrónica Y\newline
Telecomunicaciones
    &   \hfill%
        \includegraphics[width=1cm, height=1.10cm, valign=t, margin=0pt 3pt 0pt 0pt]{images/escudo}
        \quad
        \includegraphics[width=2cm, height=1.10cm, valign=t,margin=0pt 3pt 0pt 0pt]{images/eie}
        \hfill Pág.\thepage \\
    \hline
    \end{tabularx}      \\[-1pt]
    \begin{tabularx}{\linewidth}{|>{\hsize=0.25\hsize}C
                                  |>{\hsize=0.75\hsize}C|}
\makecell{Preparado por: \\
Author, ID\\
Author, ID\\
Author, ID}
    & \makecell{Electromagnetismo I - I Ciclo 2018\\
      Laboratorio de Electromagnetismo y Radiofrecuencia
          -- Reporte Práctica Experimental 01}                   \\
    \hline
    \end{tabularx}%
            }

\usepackage{blindtext}

\begin{document}
\pagestyle{fancy}
\blindtext[25]
\end{document}

in real document please remove graphicx's option demo.

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.