[Tex/LaTex] Define a Likert scale grid with multiple rows

questionnaire

I am trying to create a survey and I was hoping to do this with the eqexam package, but I can't really figure out how to make a good Likert scale. There are only examples of exams in the documentation and not of surveys.

I am trying to make something like:

    Bad NotBad Neutral OK Good
Q1  []    []     []    []  []
Q2  []    []     []    []  []
Q3  []    []     []    []  []
Q4  []    []     []    []  []

Should I do this with latex anyway? I am just trying to get a printable survey.

Best Answer

Here's one possible solution using a longtable environment and the method described by Herbert in his answer to How to programmatically make tabular rows using `\whiledo` ? to iteratively build the rows. I defined a \CheckTable command with a mandatory argument which builds your table with the number of rows specified in the argument:

\documentclass{article}
\usepackage{amssymb}
\usepackage{array,longtable}

\newcounter{question}
\newcounter{row}

\makeatletter
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{\@tabtoks\expandafter{\the\@tabtoks#1}}
\newcommand*\resettabtoks{\@tabtoks{}}
\newcommand*\printtabtoks{\the\@tabtoks}
\makeatother

\newcommand\CheckTable[1]{%
  \setcounter{question}{0}
  \setcounter{row}{0}
  \resettabtoks
  \loop\ifnum\therow<#1\relax
    \stepcounter{row}
    \addtabtoks{& $\square$ & $\square$ & $\square$ & $\square$ & $\square$ \\}%
  \repeat
  \begin{longtable}{>{\stepcounter{question}Q\thequestion}l*{5}{c}}
    \multicolumn{1}{c}{} & Bad & Not Bad & Neutral & OK & Good \\
    \printtabtoks
  \end{longtable}%
}

\begin{document}

\CheckTable{10}

\CheckTable{6}

\CheckTable{12}

\end{document}

enter image description here

Related Question