\documentclass[
  % Babel language, also used to load translations
  english,
  % Use A4 paper size, you can change this to eg. letterpaper if you need
  % the letter format. The normal methods to modify the paper size should
  % be picked up by SDAPS automatically.
  % a4paper, % setting this might break the example scan unfortunately
  % letterpaper
  %
  % If you need it, you can add a custom barcode at the center
  %globalid=SDAPS,
  %
  % And the following adds a per sheet barcode at the bottom left
  %print_questionnaire_id,
  %
  % You can choose between twoside and oneside. twoside is the default, and
  % requires the document to be printed and scanned in duplex mode.
  %oneside,
  %
  % With SDAPS 1.1.6 and newer you can choose the mode used when recognizing
  % checkboxes. valid modes are "checkcorrect" (default), "check" and
  % "fill".
  %checkmode=checkcorrect,
  %
  % The following options make sense so that we can get a better feel for the
  % final look.
  pagemark,
  stamp]{sdaps}
\usepackage[utf8]{inputenc}
% For demonstration purposes
\usepackage{multicol}

\author{The Author}
\title{The Title}

\begin{document}
  % Everything you do should be done inside the questionnaire environment.

  % If you don't like the default text at the beginning of each questionnaire
  % you can remove it with the optional [noinfo] parameter for the environment 
  \begin{questionnaire}
    % There is a predefined "info" style to hilight some text.
    \begin{info}
      This document demonstrates the viability of doing custom question layouts.
      Note that it only shows how to manually generate the metadata.
    \end{info}

    % Use \addinfo to add metadata (which is printed on the report later on)
    \addinfo{Date}{10.03.2013}

    \section{Choice questions}

    For multiple choice questions we need the following metadata
    \begin{enumerate}
      \item a question text,
      \item positions of all boxes (either checkbox or textboxes), and
      \item an answer string for each of the boxes.
    \end{enumerate}
    Currently textboxes are not properly supported unfortunately (this is because
    the SDAPS class does not expose the box generation code for textboxes
    separately). To fix this the vertically/horizontally stretching textbox code
    needs to be separated out of the \textbackslash{}textbox and
    \textbackslash{}choiceitemtext commands.

    SDAPS does not care about the document itself. The only important thing is
    that it has the metadata. The position of the boxes is provided automatically
    by the \textbackslash{}checkbox command, you only need to provide the rest of
    the metadata. So the following works:


    % A text for the PDF/Questionnaire
    What do you think about SDAPS?

    % And the text for the SDAPS metadata
    \immediate\write\sdapsoutfile{\unexpanded{QObject-Choice=Opinion about SDAPS}}
    \checkbox~It is very good\newline
    \checkbox~It is adequate\newline
    \checkbox~It does not work for me

    % At this point we have not yet provided metadata for the answer texts. This
    % may be done at a later point, but the order needs to be the same.
    \immediate\write\sdapsoutfile{\unexpanded{Answer-Choice=good}}%
    \immediate\write\sdapsoutfile{\unexpanded{Answer-Choice=adequate}}%
    \immediate\write\sdapsoutfile{\unexpanded{Answer-Choice=bad}}%

    \section{Mark Question}

    We can also create a "mark" question. It is simply a scale from 1-N where the
    user is allowed to select exactly one item. This is later exported as 0 (no
    selection, multiple selection) or the number of the checkbox.

    % We can also switch to circular checkboxes, don't forget to switch back later though!
    \def\checkboxstyle{ellipse}

    In a range of 1-7, do you like SDAPS?
    % Note that we can do custom numbering if required, though usually this will not be a good idea!
    \immediate\write\sdapsoutfile{\unexpanded{QObject-Mark=2.2. Opinion about SDAPS (range)}}

    % Similar again. We need two labels (lower and upper) and an arbitrary number
    % of checkboxes.
    \immediate\write\sdapsoutfile{\unexpanded{Answer-Mark=bad}}
    not at all~\checkbox~\checkbox~\checkbox~\checkbox~\checkbox~\checkbox~\checkbox~very much
    \immediate\write\sdapsoutfile{\unexpanded{Answer-Mark=good}}

    % Switch back again
    \def\checkboxstyle{box}


  \end{questionnaire}
\end{document}

