Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choicearray other option #31

Open
Dave811 opened this issue Apr 29, 2022 · 3 comments
Open

choicearray other option #31

Dave811 opened this issue Apr 29, 2022 · 3 comments

Comments

@Dave811
Copy link

Dave811 commented Apr 29, 2022

Hi, I wanted to create a questionair, but I wanted to seperate the most right option from the rest of the availible options.
This is my choicearry I am using:

 \begin{choicearray}[layouter=rotated,type=singlechoice]{\largeArray{Wie oft werden diese Geräte für die Schule genutzt? Werden diese deiner Meinung nach zu oft, zu wenig oder genau richtig genutzt? Kreuze an.}}
                \choice{1 zu wenig}
                \choice{2}
                \choice{3}
                \choice{4 genau richtig}
                \choice{5}
                \choice{6}
                \choice{7 zu oft}
                \choice{nutze / kenne ich nicht}
                \question{Smartphone / Handy}
                \question{Tablet / iPad}
                \question{PC / Laptop}
                \question{Smartboard / Whiteboard}
                \question{Tafel}
                \question{Beamer}
                \question{Dokumentenkamera}
                \question{Overheadprojektor}
                \question{Sonstiges}
            \end{choicearray}

Is that possible?

@benzea
Copy link
Member

benzea commented Apr 29, 2022

I suppose, the problem here is that you want the genau richtig text (which can't be done with a range question)?

Otherwise the obvious thing to do may be to use a https://sdaps.org/class-doc/sdapsclassic.html#markgroup type question.

Anyway, the answer is that there is no clean way of doing this. Only thing you can do is to hack it, i.e. add a further "choice" that is invisible, and then filter away that checkbox for every question.

            \begin{choicearray}[layouter=rotated,type=singlechoice]{{Wie oft werden diese Geräte für die Schule genutzt? Werden diese deiner Meinung nach zu oft, zu wenig oder genau richtig genutzt? Kreuze an.}}
                \choice{1 zu wenig}
                \choice{2}
                \choice{3}
                \choice{4 genau richtig}
                \choice{5}
                \choice{6}
                \choice{7 zu oft}
                \choice{}
                \choice[val=0]{nutze / kenne ich nicht}
                \question[range={1,...,7,0}]{Smartphone / Handy}
                \question[range={1,...,7,0}]{Tablet / iPad}
                \question[range={1,...,7,0}]{PC / Laptop}
                \question[range={1,...,7,0}]{Smartboard / Whiteboard}
                \question[range={1,...,7,0}]{Tafel}
                \question[range={1,...,7,0}]{Beamer}
                \question[range={1,...,7,0}]{Dokumentenkamera}
                \question[range={1,...,7,0}]{Overheadprojektor}
                \question[range={1,...,7,0}]{Sonstiges}
            \end{choicearray}

Note that I changed the value of the "nutze / kenne ich nicht" to zero. The range= parameter needs to give the valid values in the correct oder, so the zero is listed last. If we didn't add the val=0, then it would be the 9th value, and the range should be given as {1,...,7,9} instead.

@Dave811
Copy link
Author

Dave811 commented Apr 29, 2022

Thanks for the answer, that was what I was looking for. The best would be to draw a line between 7 and "nutze ich nicht". Is that possible? If not your answer solves the problem anyway.

one last thing:
I wanted a "Other" Texfield below, so if the user who wants to add a thing can describe what they mean.
So I surrounded the choicearray with a choicequestion and added a choiceitemtext. But If the choicearray would extend over 2 paper sides, the question wouldn't be repeated on the second page.
After that I tried to add a normal textfield, that kind of works, but it would have its own numbering so my next question changed from 1.2 to 1.3, what isn't what I wanted.
So after that I tried to make a \let\inlineTextBox\sdaps_textbox_hstretch:nnnnn. That works how I wanted it. But as I tried to setup a sdaps project it would throw this error: AssertionError: Adding a box to this QObject type is not possible.. If I removed my custom textbox I could create the project.

@benzea
Copy link
Member

benzea commented Apr 29, 2022

The best would be to draw a line between 7 and "nutze ich nicht".

Nah, that is not possible at all. Only thing you could do is draw a line in the header, but that seems pretty pointless.


btw. please create a new comment if you add something like that (also, e-mail via the mailinglist is better for these kind of questions).

So I surrounded the choicearray with a choicequestion and added a choiceitemtext. …

That sounds like it'll properly confuse the class.

Hah, actually, choicearray is not even supposed to be used like that really. You should have used optiongroup as that will create a proper question/sub-section. I do see that using choicearray results in a much more compact layout for you though, even if it is a bit of an accident.

\ExplSyntaxOn
\let\myquestionbegin\sdaps_qobject_begin:nnn
\let\myquestionend\sdaps_qobject_end:n
\ExplSyntaxOff

      \myquestionbegin{heading}{Head}{Wie oft werden diese Geräte für die Schule genutzt? Werden diese deiner Meinung nach zu oft, zu wenig oder genau richtig genutzt? Kreuze an.}
      \begin{choicearray}[layouter=rotated,type=singlechoice]{\thesubsection~Wie oft werden diese Geräte für die Schule genutzt? Werden diese deiner Meinung nach zu oft, zu wenig oder genau richtig genutzt? Kreuze an.}
        \choice{1--zu wenig}
        \choice{2}
        \choice{3}
        \choice{4--genau richtig}
        \choice{5}
        \choice{6}
        \choice{7--zu oft}
        \choice{}
        \choice[val=0]{nutze / kenne ich nicht}
        \question[range={1,...,7,0}]{Smartphone / Handy}
        \question[range={1,...,7,0}]{Tablet / iPad}
        \question[range={1,...,7,0}]{PC / Laptop}
        \question[range={1,...,7,0}]{Smartboard / Whiteboard}
        \question[range={1,...,7,0}]{Tafel}
        \question[range={1,...,7,0}]{Beamer}
        \question[range={1,...,7,0}]{Dokumentenkamera}
        \question[range={1,...,7,0}]{Overheadprojektor}
        \question[range={1,...,7,0}]{Sonstiges}
      \end{choicearray}
      % NOTE: We cannot prevent a page break here, this could be considered a
      % bug in sdapsarray
      % (it always inserts a penalty of 10 which we cannot remove anymore.)
      \myquestionbegin{explanation}{Text}{Weitere Bemerkungen}
      Further explanation: 
      \ExplSyntaxOn
        \sdaps_textbox_hstretch:nnnnn{}{2mm}{5mm}{40mm}{1}
      \ExplSyntaxOff
      \myquestionend{explanation}
    \myquestionend{heading}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants