7

I am trying to make a header of an exam page but with logo. Below is my code.

\usepackage{graphicx}

\begin{document}

\firstpageheadrule
\begin{figure}[]
\includegraphics[width=20mm]{logo.png}
\label{overflow}
\end{figure}
\chead{Department of Mathematics}

\begin{questions}
Question one
\end{questions}

\end{document}

I am trying to make something like enter image description here

But my code does not give a desired output. I have little clue why my code is not working. I am wondering how can I fix the code.

Helps are really appreciated. Many thanks!

Henry
  • 1,115
  • Don't use figure environment. Use only \includegraphics. –  Feb 05 '14 at 02:19
  • @HarishKumar thanks. But the very top line will still be 'Department of Mathematics' and the logo will be inserted below. I would like to have the logo and the 'Department of Mathematics' on the same line. – Henry Feb 05 '14 at 02:22
  • 1
    Please post compilable code. We don't even know which class you are using! – cfr Feb 05 '14 at 02:29
  • If I may, that's a very odd place to put a logo. It should probably go in the top-left corner, if you have a choice in the matter. See http://tex.stackexchange.com/a/44183/17423 for a how-to on that. – Sean Allred Feb 05 '14 at 03:20

3 Answers3

7

Adjust the settings according to your needs:

\documentclass{exam}  
\usepackage[demo]{graphicx}

\begin{document}

\begin{center}
\includegraphics[width=20mm]{logo.png}\quad Department of Mathematics\par
AAA School\par\bigskip
Class A\par
First Exam--Functions\par
\end{center}

\vspace{0.8cm}

\noindent\begin{tabular}{@{}p{.35\textwidth}@{\hspace{4cm}}p{.20\textwidth}@{}}
Name:\enspace\hrulefill & Marks:\enspace\hrulefill \\[2ex]
Time: 60 minutes\hfill & Date:\enspace\hrulefill 
\end{tabular}\par\bigskip

\noindent\hrulefill

\vspace{0.5cm}

\begin{questions}
\question Question one
\end{questions}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

Gonzalo Medina
  • 505,128
7

Let us add some spice! Here is a not so minimal template which you can adjust to have another design with some bling.

\documentclass[11pt,addpoints,answers]{exam}
\usepackage{graphicx,lastpage}
\hyphenpenalty 10000
\usepackage[paperheight=5.8in,paperwidth=8.27in,bindingoffset=0in,left=0.8in,right=1in,
top=0.7in,bottom=1in,headsep=.5\baselineskip]{geometry}
\flushbottom
\usepackage[normalem]{ulem}
\renewcommand\ULthickness{2pt}   %%---> For changing thickness of underline
\setlength\ULdepth{1.5ex}%\maxdimen ---> For changing depth of underline
\renewcommand{\baselinestretch}{1}
\pagestyle{empty}

\pagestyle{headandfoot}
\headrule
\newcommand{\continuedmessage}{%
\ifcontinuation{\footnotesize Question \ContinuedQuestion\ continues\ldots}{}%
}
\runningheader{\footnotesize Physcis}
{\footnotesize Physics --- Sixth semester}
{\footnotesize Page \thepage\ of \numpages}
\footrule
\footer{\footnotesize Student's name:}
{}
{\ifincomplete{\footnotesize Question \IncompleteQuestion\ continues
on the next page\ldots}{\iflastpage{\footnotesize End of exam}{\footnotesize Please go on to the next page\ldots}}}
%
\usepackage{cleveref}
\crefname{figure}{figure}{figures}
\crefname{question}{question}{questions}
%
%
%==============================================================
\begin{document}
%%
%% \thispagestyle{empty}
%
\noindent
\begin{minipage}[l]{.1\textwidth}%
\noindent
\includegraphics[width=\textwidth]{example-image-a}
\end{minipage}%
%
\hfill
\begin{minipage}[r]{.68\textwidth}%
\begin{center}
 {\large \bfseries DEPARTMENT OF PHYSICS \par
 \Large Institute\\[2pt]
 \large Subject {(\normalsize Sixth semester)}  \par}
%  \vspace{0.5cm}
\end{center}
\end{minipage}%
%
\fbox{\begin{minipage}[l]{.175\textwidth}%
\noindent
{\bfseries Your name}\\
Professor\\
{\footnotesize Date: {17.01.2013}}
\end{minipage}}%
%
\par
\noindent
\uline{Time: 1 hour   \hfill \normalsize\emph{\underline{Internal Assessment test - I}} \hfill        Maximum Marks: 20}
%
\begin{questions}

\pointsinrightmargin
\pointsdroppedatright
\marksnotpoints
% \marginpointname{mark}
\pointpoints{mark}{marks}
\pointformat{\boldmath\themarginpoints}
\bracketedpoints
%
\question[08]
\label{Q:perunit}
Some question here
\droppoints
\question[08]
\label{Q:zbus}
Some question here
\droppoints
%
\newpage
\question[08]
\label{Q:ybus}
Some question here
\droppoints
\question[02]
\label{Q:puq}
Some question here
\droppoints
%%
%
\question[02]
\label{Q:power}
Some question here
\droppoints

%
\end{questions}
 \begin{center}
  \rule{.5\textwidth}{1pt}
 \end{center}
\end{document}

enter image description here

enter image description here

5

For the logo, I would use two adjacent minipages, in this way:

\documentclass{exam}
\usepackage{graphicx}

\begin{document}

\begin{center}
\begin{minipage}{2.5cm}
\includegraphics[width=20mm]{logo.png}
\end{minipage}%
\begin{minipage}{4.5cm}
Department of Mathematics\\
AAA School
\end{minipage}
\end{center}

\bigskip

\begin{questions}
\question Question one
\end{questions}

\end{document} 

enter image description here

karlkoeller
  • 124,410