Questionnaire template?

Here is my \question macro that provides room for a question and separately room for its scale without relying on a table. This is an advantage when you have questions over multiple pages; plus, you still can use \subsection and the like to structure your document. Below is the macro and how I use it:

\def\question#1\par#2\par{\hbox to \hsize
{\vbox{\hsize=0.72\hsize #1\dotfill}\quad#2\hfil}\medskip\goodbreak}

Example use:

 \question Would you come to another workshop?
 \par\fiveboxes{no}{}{}{}{yes}

The \fiveboxes macro (cf. below) provides five check boxes where the leftmost one is labeled with no and rightmost one is labeled with yes.

For free-text questions and answers I defined the following macro

\def\freequestion#1\par{#1\par\nobreak
    \begingroup\nobreak
    \advance\leftskip by 2pc
    \hrule width 0pt height 1.7\baselineskip\hrulefill
    \hrule width 0pt height 1.7\baselineskip\hrulefill
    \par
    \medskip
    \endgroup
    }

which is used like this:

\freequestion Please share any other remarks or ideas for improving the
workshop or this survey: \par

Note the use of \par to separate arguments such that I don't have to use braces. But of course, classic arguments could be used as well.

Below, similar macros are seen in action.

Example Survey

For completeness, here are my various macros for boxes, including \fiveboxes:

\def\boxit#1{\hbox{\lower0.7ex\vbox{\hrule\hbox{\vrule\kern1pt
    \vbox{\kern1pt\hbox to 1.4em
    {\small\strut\hfil #1\hfil}\kern1pt}\kern1pt\vrule}\hrule}}}

\def\fiveboxes#1#2#3#4#5{\hbox to\scalewidth
    {\boxit{#1}\hfil\boxit{#2}\hfil\boxit{#3}\hfil%
     \boxit{#4}\hfil\boxit{#5}}}

In the example above the scale is typeset above the boxes without taking up vertical space. This is a little more involved:

\question The group is a good mix in terms of expertise and interests.
\par\xagree

\newdimen\scalewidth
\scalewidth=0.3\hsize

\def\xagree{\xscale{strongly disagree}{agree completely}}
\def\boxes{\fiveboxes{}{}{}{}{}\ignorespaces}
\def\xscale#1#2{%
    \setbox0=\hbox{\boxes}%
    \setbox1=\hbox to \wd0{\small\strut\hfill #2 $\to$}%
    \setbox2=\hbox to \wd0{\small\strut $\gets$ #1 \hfill}%
    \vbox{\vbox to 0pt{\vss\box1\box2\kern2pt}\vbox{\box0}}}

Obviously this is all very PlainTeX-y and I'm not really an expert, so comments are welcome.

You can find a full example on GitHub Gist


There are some fine answers in the other posts. It is always to strive for a simpler user interface, especially if other people are going to use your macros. Here is an example based on some work that I have developed at work for checklists. The basic row is:

\question{Is everything working properly? }

The rest is pretty much hidden from the user. A sample is shown below: enter image description here

Here is an abbreviated version of the code:

\documentclass{article}
\usepackage{textcomp,amsmath,longtable}
\usepackage{latexsym}
\begin{document}

%% Set up counters for questions
%% 
\newcounter{qnumber}
\setcounter{qnumber}{0}
\stepcounter{qnumber}
\newcommand{\yesno}{\textsf{Yes}~~\textsf{No} {\Large ~$\Box$}~~~~   {\Large $\Box$}}

%% we now define the questions
\newcommand{\question}[1]{
    \hfill \relax1.\theqnumber\hfill\hfill &\textsf{#1} &{\small\yesno} & {\small\yesno} &{\small\yesno}\stepcounter{qnumber}\\ \hline
}

%% we now define the questions
\newcommand{\heading}[1]{
1.0 &\multicolumn{4}{|l|}{\bf\textsf{#1}}\\ \hline %
}
 \newcommand{\divider}{\hline}
 \begin{longtable}{|c| p{5.61cm}|p{1.5cm}|p{1.5cm}|  p{1.55cm} |}
\divider
Sl.     &Quality Checks & A     & B     &C\\
\divider\divider
\heading{Installation}
\question{Are the fans installed as per the drawings and specifications?}
\question{Are all safety rules understood by personnel repsonsible for operating the equipment?}
\heading{Electrical}
  \question{Proper motor and fan rotation verified?}
  \question{Verify that proper disconnect is located within sight of the unit it controls.}
\end{longtable}

\end{document}

The actual version is a bit more complicated, uses an environment etc. I use a longtable as inevitably you will somewhere end with a two page questionnaire.


You can use the m column type to center the checkboxes vertically. If you want to make the tabular wider then \textwidth, like 1.2\textwidth, surround it with \makebox[\textwidth]{ ... } to center it.

Here the example code. Note also the $ $ to typeset the - and + symbols.

\documentclass{article}

\usepackage{amssymb}
\usepackage{array}
\usepackage{tabularx}

\newcolumntype{S}{>{\centering\arraybackslash}m{1.5em}}

\renewcommand{\tabularxcolumn}[1]{m{#1}} % redefine 'X' to use 'm'

\begin{document}

\makebox[\textwidth]{%
\begin{tabularx}{1.2\textwidth}{|X|S|S|S|S|S|X|}
  \hline
  The software ... & $--$ & $-$ & $-/+$ & $+$ & $++$ &\\
  \hline
  is complicated to use & $\square$ & $\square$ & $\square$ & $\square$ & $\square$ & is not complicated to use\\
  \hline
bietet nicht alle Funktionen um die anfallenden Aufgaben effizient zu bewältigen  & $\square$ & $\square$ & $\square$ & $\square$ & $\square$ & bietet alle Funktionen, um die anfallenden Aufgaben effizient zu bewältigen
\end{tabularx}%
}

\end{document}