我想在页眉中放入一个表格。我以前将表格复制到每一页上,但浪费了很多时间。我尝试过 \lhead \chead \rhead 以及各种组合。
我需要在页眉左侧显示学院徽标,在右侧显示“评估编号”
这是我的 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
此代码将表格插入到标题的中心,但会使用 降低它\raisebox
,并使用 为标题添加额外的空间\extraheadheight[<1st page space>]{<other pages space>}
使用tabularx
允许将表格扩展至完整文本宽度而无需猜测。
% !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}