-
Notifications
You must be signed in to change notification settings - Fork 6
/
latex-surveys.tex
278 lines (223 loc) · 9.2 KB
/
latex-surveys.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
\documentclass[a4paper,10pt,BCOR10mm,oneside,headsepline]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{wasysym}% provides \ocircle and \Box
\usepackage{enumitem}% easy control of topsep and leftmargin for lists
\usepackage{color}% used for background color
\usepackage{forloop}% used for \Qrating and \Qlines
\usepackage{ifthen}% used for \Qitem and \QItem
\usepackage{typearea}
\areaset{17cm}{26cm}
\setlength{\topmargin}{-1cm}
\usepackage{scrpage2}
\pagestyle{scrheadings}
\ihead{Example questionnaire created with \LaTeX}
\ohead{\pagemark}
\chead{}
\cfoot{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Beginning of questionnaire command definitions %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% 2010, 2012 by Sven Hartenstein
%% http://www.svenhartenstein.de
%%
%% Please be warned that this is NOT a full-featured framework for
%% creating (all sorts of) questionnaires. Rather, it is a small
%% collection of LaTeX commands that I found useful when creating a
%% questionnaire. Feel free to copy and adjust any parts you like.
%% Most probably, you will want to change the commands, so that they
%% fit your taste.
%%
%% Also note that I am not a LaTeX expert! Things can very likely be
%% done much more elegant than I was able to. If you have suggestions
%% about what can be improved please send me an email. I intend to
%% add good tipps to my website and to name contributers of course.
%%
%% 10/2012: Thanks to karathan for the suggestion to put \noindent
%% before \rule!
%% \Qq = Questionaire question. Oh, this is just too simple. It helps
%% making it easy to globally change the appearance of questions.
\newcommand{\Qq}[1]{\textbf{#1}}
%% \QO = Circle or box to be ticked. Used both by direct call and by
%% \Qrating and \Qlist.
\newcommand{\QO}{$\Box$}% or: $\ocircle$
%% \Qrating = Automatically create a rating scale with NUM steps, like
%% this: 0--0--0--0--0.
\newcounter{qr}
\newcommand{\Qrating}[1]{\QO\forloop{qr}{1}{\value{qr} < #1}{---\QO}}
%% \Qline = Again, this is very simple. It helps setting the line
%% thickness globally. Used both by direct call and by \Qlines.
\newcommand{\Qline}[1]{\noindent\rule{#1}{0.6pt}}
%% \Qlines = Insert NUM lines with width=\linewith. You can change the
%% \vskip value to adjust the spacing.
\newcounter{ql}
\newcommand{\Qlines}[1]{\forloop{ql}{0}{\value{ql}<#1}{\vskip0em\Qline{\linewidth}}}
%% \Qlist = This is an environment very similar to itemize but with
%% \QO in front of each list item. Useful for classical multiple
%% choice. Change leftmargin and topsep accourding to your taste.
\newenvironment{Qlist}{%
\renewcommand{\labelitemi}{\QO}
\begin{itemize}[leftmargin=1.5em,topsep=-.5em]
}{%
\end{itemize}
}
%% \Qtab = A "tabulator simulation". The first argument is the
%% distance from the left margin. The second argument is content which
%% is indented within the current row.
\newlength{\qt}
\newcommand{\Qtab}[2]{
\setlength{\qt}{\linewidth}
\addtolength{\qt}{-#1}
\hfill\parbox[t]{\qt}{\raggedright #2}
}
%% \Qitem = Item with automatic numbering. The first optional argument
%% can be used to create sub-items like 2a, 2b, 2c, ... The item
%% number is increased if the first argument is omitted or equals 'a'.
%% You will have to adjust this if you prefer a different numbering
%% scheme. Adjust topsep and leftmargin as needed.
\newcounter{itemnummer}
\newcommand{\Qitem}[2][]{% #1 optional, #2 notwendig
\ifthenelse{\equal{#1}{}}{\stepcounter{itemnummer}}{}
\ifthenelse{\equal{#1}{a}}{\stepcounter{itemnummer}}{}
\begin{enumerate}[topsep=2pt,leftmargin=2.8em]
\item[\textbf{\arabic{itemnummer}#1.}] #2
\end{enumerate}
}
%% \QItem = Like \Qitem but with alternating background color. This
%% might be error prone as I hard-coded some lengths (-5.25pt and
%% -3pt)! I do not yet understand why I need them.
\definecolor{bgodd}{rgb}{0.8,0.8,0.8}
\definecolor{bgeven}{rgb}{0.9,0.9,0.9}
\newcounter{itemoddeven}
\newlength{\gb}
\newcommand{\QItem}[2][]{% #1 optional, #2 notwendig
\setlength{\gb}{\linewidth}
\addtolength{\gb}{-5.25pt}
\ifthenelse{\equal{\value{itemoddeven}}{0}}{%
\noindent\colorbox{bgeven}{\hskip-3pt\begin{minipage}{\gb}\Qitem[#1]{#2}\end{minipage}}%
\stepcounter{itemoddeven}%
}{%
\noindent\colorbox{bgodd}{\hskip-3pt\begin{minipage}{\gb}\Qitem[#1]{#2}\end{minipage}}%
\setcounter{itemoddeven}{0}%
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% End of questionnaire command definitions %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{center}
\textbf{\huge Example questionnaire created with \LaTeX}
\end{center}\vskip1em
\noindent Welcome to this very important survey with which we
researchers want to look deep inside of you (be afraid!). Anyway,
thank you for filling it all out.
\noindent \textit{Please note that no tabular environment is used in
this example questionnaire. Of course, you could use tabular to
create more complex layout.}
\section*{About you}
\Qitem{ \Qq{Your name}: \Qline{8cm} }
\Qitem{ \Qq{How old are you?} I am \Qline{1.5cm} years old.}
\Qitem{ \Qq{Are you in a good mood right now?} \hskip0.4cm \QO{}
absolutely \hskip0.5cm \QO{} not really because: \Qline{3cm} }
\Qitem{ \Qq{Do you like having an option?}
\begin{Qlist}
\item Yes, this meets my need for autonomy.
\item No, I'd rather have someone else decide for me.
\item Not sure.
\end{Qlist}
}
\Qitem{ \Qq{What kind of music do you like best?}
\begin{Qlist}
\item Johann Sebastian Bach
\item Jazz
\item The Beatles
\item Other: \Qline{4cm}
\end{Qlist}
}
\minisec{Please evaluate the following composers}
\vskip.5em
\Qitem[a]{ \Qq{Mozart} \Qtab{3cm}{horrible \Qrating{5} fantastic}}
\Qitem[b]{ \Qq{Beethoven} \Qtab{3cm}{horrible \Qrating{5} fantastic}}
\Qitem[c]{ \Qq{Johann S. Bach} \Qtab{3cm}{horrible \Qrating{5}
fantastic}}
\Qitem[d]{ \Qq{John Lennon}\Qtab{2.5cm}{\parbox[t]{3.3cm}{\raggedleft
Uh, well, I do not like his music very much}
\Qrating{7} \parbox[t]{3cm}{Oh, yes, you know, really great
stuff}}}
\Qitem[e]{ \Qq{Elvis}\Qtab{2.5cm}{\parbox[t]{3.3cm}{\raggedleft Uh,
well, I do not like his music very much}
\Qrating{7} \parbox[t]{3cm}{Oh, yes, you know, really great
stuff}}}
\section*{About this questionnaire}
\Qitem{\Qq{Do you like the style so far?} \Qtab{5.5cm}{\QO{} Yes
\hskip0.5cm \QO{} No}}
\Qitem{\Qq{Is it really worth the ink?} \Qtab{5.5cm}{\QO{} Guess so.
\hskip0.5cm \QO{} Probably not. \hskip0.5cm \QO{} Don't know.}}
\Qitem{\Qq{How does this item look different from the previous one?}
\Qtab{10.5cm}{\QO{}\Qtab{0.6cm}{Oh. Does it?}}\par
\Qtab{10.5cm}{\QO{}\Qtab{0.6cm}{No clue. I just can't figure it out.
So sorry.}}\par
\Qtab{10.5cm}{\QO{}\Qtab{0.6cm}{I guess what you mean is that here
the different answer options are below each other.}}\par
}
\Qitem[a]{ \Qq{Please describe your first impression.} \Qlines{2} }
\Qitem[b]{ \Qq{In case you would like some more lines to write, here
they are:} \Qlines{4} }
\section*{Another feature}
\noindent Now, here is another nice feature: you can automatically
alter the background color of the items. Here is how it can look like.
Because we are too lazy to think of new questions we will just ask you
the same questions again. There is one difference to the above though,
can you find it?
\renewcommand{\QO}{$\ocircle$}% Use circles now instead of boxes.
\section*{About you}
\QItem{ \Qq{Your name}: \Qline{8cm} }
\QItem{ \Qq{How old are you?} I am \Qline{1.5cm} years old.}
\QItem{ \Qq{Are you in a good mood right now?} \hskip0.4cm \QO{}
absolutely \hskip0.5cm \QO{} not really because: \Qline{3cm} }
\QItem{ \Qq{Do you like having an option?}
\begin{Qlist}
\item Yes, this meets my need for autonomy.
\item No, I'd rather have someone else decide for me.
\item Not sure.
\end{Qlist}
}
\QItem{ \Qq{What kind of music do you like best?}
\begin{Qlist}
\item Johann Sebastian Bach
\item Jazz
\item The Beatles
\item Other: \Qline{4cm}
\end{Qlist}
}
\minisec{Please evaluate the following composers}
\vskip.5em
\QItem[a]{ \Qq{Mozart} \Qtab{3cm}{horrible \Qrating{5} fantastic}}
\QItem[b]{ \Qq{Beethoven} \Qtab{3cm}{horrible \Qrating{5} fantastic}}
\QItem[c]{ \Qq{Johann S. Bach} \Qtab{3cm}{horrible \Qrating{5} fantastic}}
\QItem[d]{ \Qq{John Lennon}\Qtab{2.5cm}{\parbox[t]{3.3cm}{\raggedleft
Uh, well, I do not like his music very much}
\Qrating{7} \parbox[t]{3cm}{Oh, yes, you know, really great
stuff}}}
\QItem[e]{ \Qq{Elvis}\Qtab{2.5cm}{\parbox[t]{3.3cm}{\raggedleft
Uh, well, I do not like his music very much}
\Qrating{7} \parbox[t]{3cm}{Oh, yes, you know, really great
stuff}}}
\section*{About this questionnaire}
\QItem{\Qq{Do you like the style so far?} \Qtab{5.5cm}{\QO{} Yes
\hskip0.5cm \QO{} No}}
\QItem{\Qq{Is it really worth the ink?} \Qtab{5.5cm}{\QO{} Guess so.
\hskip0.5cm \QO{} Probably not. \hskip0.5cm \QO{} Don't know.}}
\QItem{\Qq{How does this item look different from the previous one?}
\Qtab{10.5cm}{\QO{}\Qtab{0.6cm}{Oh. Does it?}}\par
\Qtab{10.5cm}{\QO{}\Qtab{0.6cm}{No clue. I just can't figure it out.
So sorry.}}\par
\Qtab{10.5cm}{\QO{}\Qtab{0.6cm}{I guess what you mean is that here
the different answer options are below each other.}}\par
}
\QItem[a]{ \Qq{Please describe your first impression.} \Qlines{2} }
\QItem[b]{ \Qq{In case you would like some more lines to write, here
they are:} \Qlines{4} }
\end{document}