Page 1 of 1

Full article here : Creating Professional Exams with LaTeX: A Complete Guide




% Typeset exams with solutions in LaTeX
\documentclass[answers,addpoints, 12pt, a4paper]{exam}
\usepackage[left=1.5cm,right=0.5cm,top=0cm,bottom=1cm]{geometry}   % Set page margins
%\usepackage[french]{babel}
\usepackage{calligra} % For calligraphy font
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb}
\usepackage{tikz} % For drawing the vertical line
\usepackage{xcolor}

\pointname{}
\pointformat{\textbf{\textit{(\thepoints)}}}

% Exam settings
\pointsinmargin
%\colorfillwithlines
%\definecolor{FillWithLinesColor}{gray}{0.8}
\colorfillwithdottedlines
\definecolor{FillWithDottedLinesColor}{gray}{0.7}
\unframedsolutions
\renewcommand{\solutiontitle}{\noindent\textbf{}\enspace}
\SolutionEmphasis{\itshape\small}
\SolutionEmphasis{\color{red}}

% Redefine the points display format in margin
\newcommand{\borders}{%
  \tikz[remember picture, overlay, xshift=-0.5cm]{
    \draw[gray, thick] (0,-1.2) -- (0,-27);
    \draw[gray, thick] (0,-1.2) -- (\textwidth,-1.2);
    \node[] at (0.5,-0.25) {\textbf{1\textsuperscript{er} bac S.E}};
    \node[magenta] at (1.1,-0.6) {\textbf{www.mosaid.xyz}};
    \node[xshift=-2cm] at (\textwidth,-0.25) {\textbf{\today}};
    \node[xshift=-5.5cm] (A) at (\textwidth,-0.9)  {\textbf{Name :}};
    \node[xshift=-0.5cm] at (0.5\textwidth,-0.5) {\textbf{English Test n$^\circ$1 /2h}};
    \draw[gray, thick] (A.south west) -- ++(0,0.7) -- ++(6.4,0) ;
    \node[magenta] at (0.9\textwidth,-1.4) {\textbf{www.mosaid.xyz}};
  }%
}


% Redefine \exo command to avoid spacing issues
\newcommand{\exo}[1]{%
    \begin{tikzpicture}
        % Node for the text
        \node[] (text) at (0,0) {\textbf{#1}};
        % Shadow (calculated based on the text width)
        \fill[black] ([xshift=0.1cm, yshift=-0.1cm]text.south west)
                     rectangle ([xshift=0.1cm, yshift=-0.1cm]text.north east);
        % Main box (calculated based on the text width)
        \draw[fill=white] (text.south west) rectangle (text.north east);
        % Text inside the box
        \node[] at (text) {\textbf{#1}};
    \end{tikzpicture}%
}

\footer{}{Page \thepage\ of \numpages}{}

\begin{document}
\borders\\[1cm]

\noindent\hspace*{0.1cm}
\exo{Whatever Subjects English teachers teach \hspace{2mm} (10pts)}

\begin{questions}

\question[2]
This question has one correct answer. Mark it.
\begin{checkboxes}
	\choice The correct answer is after the second wrong answer.
	\choice The correct answer is after this answer.
	\choice This is the correct answer.
	\CorrectChoice Previous answers are false.
\end{checkboxes}

\question[1]
Which of the following is not a Greek philosopher?\\
\begin{oneparcheckboxes}
	\choice Socrates
	\choice Plato
	\choice Pythagoras
	\CorrectChoice You
\end{oneparcheckboxes}

\question[2] Fill in the blank using the following words:\\
\parbox{0.9\textwidth}{%
  \colorbox{gray!30}{\parbox{\dimexpr\linewidth-2\fboxsep}{%
	  \centering
      \textbf{\textit{Helium ~$-$~ Sir Isaac Newton ~$-$~ Alpha Centuri ~$-$~ Einstein}}
  }}
}\\[1ex]
\fillin[Helium] is the second element of the periodic table.\\
\fillin[Sir Isaac Newton][2in] discovered the first gravitational law.\\
The answer to \fillin[life, the universe and everything][3in] is 42\\

\noindent \hspace*{-0.6cm}
\exo{Language, writing and other english stuff \hspace{2mm} (10pts)}
\setcounter{question}{0}
\question[5]
In no more than one paragraph, explain why the earth is round.
%\fillwithlines{1.5in}
%\fillwithdottedlines
\begin{solutionordottedlines}[1.5in]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla
et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer
sapien est, iaculis in, pretium quis, viverra ac, nunc.
\end{solutionordottedlines}
\question
\begin{parts}
\part[2]
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\begin{solutionordottedlines}[1in]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna. Donec vehicula augue eu neque.
\end{solutionordottedlines}
\part[3]
Where should the field generator be constructed if you want one of
the vertices to be located at the Royal Observatory at Greenwich?
\begin{solutionordottedlines}[1in]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo.
\end{solutionordottedlines}
\end{parts}
\end{questions}

%\begin{center}
%\hsword{text}
%\gradetable[h][questions]
%\end{center}

\begin{center}
        {\scalebox{3}{\textbf{\textcolor{blue}{\calligra Good Luck!}}}}
\end{center}

\end{document}

Leave a comment if you like this content أترك تعليقا إن أعجبك المحتوى
Class: Templates
Views:  134




0 Comments, Latest

No comments yet. Be the first to Comment

Most viewed courses: