Debian Codegraph @

texmf-dist/doc/latex/moodle/test/test_escaping_right_braces_in_cloze.tex

raw
1 % !TeX encoding = UTF-8
2 % !TeX spellcheck = en_US
3 % !TEX TS-program = lualatex
4 \documentclass{article}
5 \usepackage[nostamp]{moodle}
6 \ifPDFTeX % FOR LATEX and PDFLATEX
7 \usepackage[utf8]{inputenc} % necessary
8 \usepackage[T1]{fontenc} % necessary
9 \else % assuming XELATEX or LUALATEX
10 \usepackage{fontspec}
11 \fi
12
13 \def\myequation{y=a\sqrt{x}/2+{b}}
14 \htmlregister{\myequation}
15
16 \begin{document}
17
18 \section*{Introduction}
19
20 This document is intended to check that in cloze subquestion code the right
21 brace character is escaped with a backslash, as expected.
22
23 This allows the character to pass Moodle import and \LaTeX equations to be
24 displayed in \texttt{clozemulti} answers and in all cloze feedbacks.
25
26 \begin{quiz}{Cloze: Escaping Characters}
27
28 \begin{cloze}{Cloze}
29 No escaping here: $\myequation$
30
31 \begin{multi}[points=4,vertical,shuffle=false]
32 No escaping here: \texttt{text} $\myequation$
33 \item* $\lbrace A\rbrace$
34 \item \{B\}
35 \end{multi}
36
37 \begin{shortanswer}
38 {No escaping here: } $\myequation$
39 \item[feedback={nip}] chip
40 \item[fraction=10,feedback={that must be escaped: $\myequation$}] nop
41 \end{shortanswer}
42
43 \begin{numerical}
44 {No escaping here: } $\myequation$
45 \item[feedback={nip}] 0
46 \item[fraction=10,feedback={that must be escaped: $\myequation$}] 1
47 \end{numerical}
48
49 \end{cloze}
50
51 \end{quiz}
52
53 \end{document}