0

I want to put a table into the header. I have copied the table on to every page in the past, but wastes a lot of time. I have tried \lhead \chead \rhead, and various combinations.

I need the college logo on the left on the header and "Assessment Number" on the right

Here's my MWE

  % !TeX program = xelatex
% !TeX spellcheck = en_GB
\documentclass[12pt,addpoints]{exam}
\usepackage{graphicx}
\usepackage{color}
\definecolor{Red}{rgb}{0.8,0.0,0.0}

\header{    \includegraphics {nmtafe1.jpg}  
} {} { \large  \textbf{\textcolor{Red}{ Assessment Task 1}}}
 
 
\usepackage{xcolor}
\usepackage{colortbl}% need to colour table 
\usepackage{fontspec}% need for arail from top line
\setmainfont{Arial}% needed for arial from top line
\renewcommand{\arraystretch}{2}
\usepackage{array}% this is need to centre data
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} % this centres data
\globalcolorstrue
\setlength\arrayrulewidth{1.25pt}% so you can see table boarders at 100%
\usepackage{multicol}

\begin{document}

\begin{table}   
    \begin{tabular}{|l|l|}
        \hline
        \cellcolor{blue!20}Qualification national code and title    &  \multicolumn{1}{|p{11cm}|}{\centering ****** Certificate **   in General Education for Adults}  \\
        \hline
        \cellcolor{blue!20}Unit/s national code/s and title     & \multicolumn{1}{|p{10cm}|}{\centering ****** Investigate and Interpret shapes  and \\ measurements and related formula  }\\
        \hline
    \end{tabular}
\end{table}


    \begin {questions}
    
    \question
    This is question on
\newpage

\question 

This is question two    
    

    \end {questions}
    
    
\end{document}

1 Answer 1

1

This code will insert the table in the center of the header, but will lower it using \raisebox, and add extra space to the header with \extraheadheight[<1st page space>]{<other pages space>}

c

Using tabularx allowed to expand the table to full text width without guessing.

% !TeX program = xelatex
% !TeX spellcheck = en_GB

\documentclass[12pt,addpoints]{exam}

\usepackage{fontspec}% need for arial from top line
\setmainfont{Arial}% needed for arial from top line
\usepackage{array}% this is need to centre data
\renewcommand{\arraystretch}{2}
\newcolumntype{C}[1]{>{\centering\arraybackslash}X|} % this centres data

\setlength\arrayrulewidth{1.25pt}% so you can see table boarders at 100%

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{colortbl}% need to colour table 
\definecolor{Red}{rgb}{0.8,0.0,0.0}

\usepackage{tabularx}% added <<<<<<<<<<<<<<<

\header{ \includegraphics[scale=0.2] {example-image}}
 {\raisebox{-60pt}{\begin{tabularx}{\linewidth}{|l|C|} % added <<<<<<<<<<<<<<<<<
            \hline
            \cellcolor{blue!20}Qualification national code and title &   ****** Certificate **   in General Education for Adults \\
            \hline
            \cellcolor{blue!20}Unit/s national code/s and title     &  ****** Investigate and Interpret shapes  and  measurements and related formula \\
            \hline
 \end{tabularx}}}
 {\large \textbf{\textcolor{Red}{ Assessment Task 1}}}
 
 %move headers up or and down 
\extraheadheight[120pt]{120pt}% addded <<<<<<<<<<<<<<<<<<

\globalcolorstrue

\usepackage{multicol}

\begin{document}    
    \begin {questions}
    
    \question
    This is question one
    \newpage
    
    \question 
    
    This is question two        
    
    \end {questions}
    
\end{document}
2
  • You could put the tabular into a savebox so that the it doesn't have to be expanded on every page. Not to mention having access to its height, depth and width. Commented Jun 12, 2022 at 3:41
  • <<<<<< added, nice touch to show where necessary coded needed
    – Jon
    Commented Jun 12, 2022 at 8:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .