2

I want to create exams. Therefore I will use the exam package.

How can I create emtpy boxes at the right page margin? I need this for adding up the earned points of each question.

My current document looks like this:

\documentclass[
%answers,
a4paper,ngerman,addpoints,12pt]{exam}
\usepackage[]{graphicx}
\usepackage[]{csquotes}
\usepackage[]{amsmath}
\usepackage{tikz}
\usepackage[tikz]{bclogo}
\usepackage[]{xcolor}
\usepackage[ngerman]{babel}
\colorgrids
\definecolor{GridColor}{gray}{.2}


\setlength{\parindent}{0pt} 
\setlength\dottedlinefillheight{.8cm}
\extrawidth{2cm}
%Sprachliche Anpassungen
\pointpoints{Punkt}{Punkte}
\bonuspointpoints{Bonuspunkt}{Bonuspunkte}
\renewcommand{\solutiontitle}{\noindent\textbf{L\"osung:}\enspace}
\renewcommand{\questionlabel}{\textbf{Aufgabe \thequestion.}}

\chqword{Frage}
\chpgword{Seite}
\chpword{Punkte}
\chbpword{Bonus Punkte}
\chsword{Erreicht}
\chtword{Gesamt}
\hpword{Punkte:} % Punktetabelle
\hsword{Ergebnis:}
\hqword{Aufgabe:}
\htword{Summe:}
%\thequestiontitle
%\qformat{\textbf{Aufgabe \thequestion} \hfill \quad(\thepoints / \makebox[1cm]{\hrulefill})}
%\pointsinrightmargin
%\pointsinmargin
%\boxedpoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Layout
\newcommand{\Lehrer}{\textbf{Hr. Hauser}}
\newcommand{\fach}{\textbf{Bauelemente}}
\newcommand{\Titel}{\textbf{1. Stegreifaufgabe im Lernfeld}}
\pagestyle{headandfoot}
%\firstpageheadrule
\runningheadrule
\firstpageheader{\large\bfseries \Titel \\ \fach}
{}
{
  \textbf{\normalsize{Punkte: \fbox{\rule{1.cm}{0pt}\rule[-1ex]{0pt}{1.cm}}}}
  \textbf{\normalsize{Note: }}\fbox{\rule{1.cm}{0pt}\rule[-1ex]{0pt}{1.cm}}
}
\runningheader{}{\Titel{} \fach}{}
\firstpagefooter{}
{\vspace{2ex}\thepage\,/\,\numpages}
{\vspace{2ex} \makebox[1cm]{\hrulefill} / $\sum$ \pointsonpage{\thepage} }
\firstpagefootrule
%\extrafootheight{1cm}
\runningfootrule
\runningfooter{}
{\vspace{2ex}\thepage\,/\,\numpages}
{\vspace{2ex} \makebox[1cm]{\hrulefill} / $\sum$ \pointsonpage{\thepage} }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}
%
\makebox[\textwidth]{Vor- und Nachname: \dotfill\rule[1ex]{0pt}{.1cm}}
\makebox[.5\textwidth]{Klasse:\dotfill\rule[1ex]{0pt}{.7cm}}
\makebox[.5\textwidth]{Datum:\dotfill\rule[1ex]{0pt}{.7cm}}
\begin{center}
\fbox{\parbox{6in}{\footnotesize
  \vspace{.5ex}
  \textbf{Erlaubte Hilfsmittel:} Taschenrechner, Tabellenbuch\\
  Alle Ergebnisse sind, sofern nicht anders angegeben, auf zwei Stellen nach dem Komma zu runden.\\ 
  \textbf{M\"ogliche Gesamtpunktezahl:} \numpoints{} \points
}}
\end{center}
\hrule

\begin{questions}
\question Berechne das Ergebnis von $1+1$.
\fillwithdottedlines{2cm}
\end{question}

\vspace*{\fill}
\begin{center}
\fbox{\parbox{4cm}{
  \centering
  \vspace{.5ex}
 \bctrefle \textbf{Viel Erfolg!}
}}
\end{center}
      \end{document}
1

Is this what you were looking for?

Note: \linewidth is the amount of space left after the environment is done indenting. \dimen0 - \dimen9 are unused by LaTeX, but is still safer to make changes local (hence \bgroup ... \egroup). The \raisebox aligns the bottom of the \fbox to the baseline.

\documentclass[
%answers,
a4paper,ngerman,addpoints,12pt]{exam}
\usepackage[]{graphicx}
\usepackage[]{csquotes}
\usepackage[]{amsmath}
\usepackage{tikz}
\usepackage[tikz]{bclogo}
\usepackage[]{xcolor}
\usepackage[ngerman]{babel}
\colorgrids
\definecolor{GridColor}{gray}{.2}


\setlength{\parindent}{0pt} 
\setlength\dottedlinefillheight{.8cm}
\extrawidth{2cm}
%Sprachliche Anpassungen
\pointpoints{Punkt}{Punkte}
\bonuspointpoints{Bonuspunkt}{Bonuspunkte}
\renewcommand{\solutiontitle}{\noindent\textbf{L\"osung:}\enspace}
\renewcommand{\questionlabel}{\textbf{Aufgabe \thequestion.}}

\chqword{Frage}
\chpgword{Seite}
\chpword{Punkte}
\chbpword{Bonus Punkte}
\chsword{Erreicht}
\chtword{Gesamt}
\hpword{Punkte:} % Punktetabelle
\hsword{Ergebnis:}
\hqword{Aufgabe:}
\htword{Summe:}
%\thequestiontitle
%\qformat{\textbf{Aufgabe \thequestion} \hfill \quad(\thepoints / \makebox[1cm]{\hrulefill})}
%\pointsinrightmargin
%\pointsinmargin
%\boxedpoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Layout
\newcommand{\Lehrer}{\textbf{Hr. Hauser}}
\newcommand{\fach}{\textbf{Bauelemente}}
\newcommand{\Titel}{\textbf{1. Stegreifaufgabe im Lernfeld}}
\pagestyle{headandfoot}
%\firstpageheadrule
\runningheadrule
\firstpageheader{\large\bfseries \Titel \\ \fach}
{}
{
  \textbf{\normalsize{Punkte: \fbox{\rule{1.cm}{0pt}\rule[-1ex]{0pt}{1.cm}}}}
  \textbf{\normalsize{Note: }}\fbox{\rule{1.cm}{0pt}\rule[-1ex]{0pt}{1.cm}}
}
\runningheader{}{\Titel{} \fach}{}
\firstpagefooter{}
{\vspace{2ex}\thepage\,/\,\numpages}
{\vspace{2ex} \makebox[1cm]{\hrulefill} / $\sum$ \pointsonpage{\thepage} }
\firstpagefootrule
%\extrafootheight{1cm}
\runningfootrule
\runningfooter{}
{\vspace{2ex}\thepage\,/\,\numpages}
{\vspace{2ex} \makebox[1cm]{\hrulefill} / $\sum$ \pointsonpage{\thepage} }

\newcommand{\emptybox}[2]% #1=width, #2=height
{\bgroup
  \dimen0=\dimexpr #1-2\fboxsep-2\fboxrule\relax
  \dimen1=\dimexpr #2-2\fboxsep-2\fboxrule\relax
  \raisebox{\dimexpr \depth+\fboxsep+\fboxrule}[0pt]{\fbox{\rule{0pt}{\dimen1}\rule{\dimen0}{0pt}}}%
\egroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}
%
\makebox[\textwidth]{Vor- und Nachname: \dotfill\rule[1ex]{0pt}{.1cm}}
\makebox[.5\textwidth]{Klasse:\dotfill\rule[1ex]{0pt}{.7cm}}
\makebox[.5\textwidth]{Datum:\dotfill\rule[1ex]{0pt}{.7cm}}
\begin{center}
\fbox{\parbox{6in}{\footnotesize
  \vspace{.5ex}
  \textbf{Erlaubte Hilfsmittel:} Taschenrechner, Tabellenbuch\\
  Alle Ergebnisse sind, sofern nicht anders angegeben, auf zwei Stellen nach dem Komma zu runden.\\ 
  \textbf{M\"ogliche Gesamtpunktezahl:} \numpoints{} \points
}}
\end{center}
\hrule

\begin{questions}
\question Berechne das Ergebnis von $1+1$.\\
\parbox[b]{\dimexpr\linewidth-2cm-\columnsep}{\fillwithdottedlines{2cm}}\hfill
\emptybox{2cm}{2cm}
\end{questions}

\vspace*{\fill}
\begin{center}
\fbox{\parbox{4cm}{
  \centering
  \vspace{.5ex}
 \bctrefle \textbf{Viel Erfolg!}
}}
\end{center}
      \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.