Jump to content

LaTeX/Teacher's Corner

From Wikibooks, open books for an open world

LaTeX

Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing
  19. Initials

Mechanics

  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Text

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher's Corner
  5. Curriculum Vitae
  6. Academic Journals (MLA, APA, etc.)

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics

Programming

  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Creating Package Documentation
  5. Themes

Miscellaneous

  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks

Appendices

  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this boxedit the TOC

Intro

[edit | edit source]

LaTeX has specific features for teachers. We present the exam class[1] which is useful for designing exams and exercises with solutions. Interested people could also have a look at the probsoln package[2], the mathexm document class[3], or the exsheets package[4].

The exam class

[edit | edit source]

We present the exam class. The exam class is well suited to design exams with solutions. You just have to specify in the preamble if you want the solutions to be printed or not. You can also count the number of points.

Preamble

[edit | edit source]

In the preamble you can specify the following lines :

\documentclass[a4paper,11pt]{exam}
\printanswers % If you want to print answers
% \noprintanswers % If you don't want to print answers
\addpoints % if you want to count the points
% \noaddpoints % if you don't want to count the points
% Specifies the way question are displayed:
\qformat{\textbf{Question\thequestion}\quad(\thepoints)\hfill}
\usepackage{color} % defines a new color
\definecolor{SolutionColor}{rgb}{0.8,0.9,1} % light blue
\shadedsolutions % defines the style of the solution environment
% \framedsolutions % defines the style of the solution environment
% Defines the title of the solution environment:
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}

You can replace the 3 first lines with the following :

\documentclass[a4paper,11pt,answers,addpoints]{exam}

Document

[edit | edit source]
  • The exam is included in the questions environment.
  • The command \question introduces a new question.
  • The number of points is specified in squared brackets.
  • The solution is given in the solution environment. It appears only if \printanswers or answers as an option of the \documentclass are specified in the preamble.

Here is an example :

\begin{questions} % Begins the questions environment
\question[2] What is the solution? % Introduces a new question which is worth 2 points
\begin{solution} 
Here is the solution 
\end{solution}
\question[5] What is your opinion?
\begin{solution}
This is my opinion
\end{solution}
\end{questions}

It is also possible to add stuff only if answers are printed using the \ifprintanswers command.

\ifprintanswers
Only if answers are printed
\else
Only if answers are not printed
\fi

Introduction

[edit | edit source]

The macro \numquestions gives the total number of questions. The macro \numpoints gives the total number of points.

\begin{minipage}{.8\textwidth}
This exam includes \numquestions\ questions. The total number of points is \numpoints.
\end{minipage}

The backslash after \numquestion prevents the macro from gobbling the following whitespace as it normally would.

Exsheets

[edit | edit source]

Package exsheets is an alternative to the exam class. It can be used to create exam papers, text books including solutions etc. Many options are available to style the output. Following a demonstrative example.

\documentclass{article}
\usepackage{booktabs}
\usepackage{exsheets}
\usepackage{tasks}
\SetupExSheets[question]{type=exam}
\SetupExSheets{
	counter-format=se.qu,
	counter-within=section,
	headings=runin,
}
\begin{document}
\section{Chemistry}
\begin{question}{2}
	Which one of the entries does not fit with the others?
	\begin{tasks}(4)
		\task mercury
		\task iron
		\task lead
		\task zinc
	\end{tasks}
\end{question}
\begin{question}{4}
	Explain your decision for the answer above.

	\blank[width=5\linewidth,linespread=1.5]{}
\end{question}

\section{Physics}
\settasks{
	counter-format=(tsk[r]),
	label-width=4ex
}
\begin{question}{1}
	What is a funkyton?
	\begin{tasks}(2)
		\task A dancing electron
		\task A dancing proton
		\task A dancing neutron
		\task A Dixie Dancing Duck
	\end{tasks}
\end{question}

\begin{center}
\begin{tabular}{l*{\numberofquestions}{c}c}\toprule
	Question & \ForEachQuestion{\QuestionNumber{#1}\iflastquestion{}{&} } & Total \\ \midrule
	Points   & \ForEachQuestion{\GetQuestionProperty{points}{#1}\iflastquestion{}{&} } & \pointssum* \\ 
	Reached  & \ForEachQuestion{\iflastquestion{}{&} } & \\ \bottomrule
\end{tabular}
\end{center}
\end{document}

A sample exam sheet

Successor of exsheets will be package xsim.

References

[edit | edit source]
  1. examdoc Using the exam document class
  2. Probsoln Creating problem sheets optionally with solutions
  3. mathexm documentation
  4. exsheets documentation Create exercise sheets and exams


Previous: Presentations Index Next: Curriculum Vitae