Reputation: 23
I am trying to render the Greek sigma notation within a Quiz in R Markdown. If I use dollar signs, it only italicizes the word \sigma. If I use
<span class="math inline">\sigma</span>
I get an error".
question_radio(
"Is this a statement about the standard deviation, $/sigma$, a proportion $p$, or something else?",
answer("Standard deviation", correct = TRUE),
answer("Proportion"),
answer("Something else altogether"),
allow_retry = TRUE,
random_answer_order = TRUE
)
yields
question_radio(
"Is this a statement about the standard deviation, <span class="math inline">\mu</span>, a proportion $p$, or something else?",
answer("Standard deviation", correct = TRUE),
answer("Proportion"),
answer("Something else altogether"),
allow_retry = TRUE,
random_answer_order = TRUE
)
yields
Error in parse()
:
! :2:67: unexpected symbol
1: question_radio(
2: "Is this a statement about the standard deviation, <span class="math
^
Backtrace:
<fn>
(...)I have looked through much documentation on writing quizzes, but I've had no luck.
EDIT: Answer: Use $\sigma$
or $\\sigma$
within the question function. I mistakenly used forward slashes. Ugh.
Upvotes: 2
Views: 810
Reputation: 1775
You need to enclose it in double backslashes to escape the backslash character in R Markdown.
By using $\\sigma$
, the Greek sigma symbol should be rendered correctly in the quiz question:
question_radio(
"Is this a statement about the standard deviation, $\\sigma$, a proportion $p$, or something else?",
answer("Standard deviation", correct = TRUE),
answer("Proportion"),
answer("Something else altogether"),
allow_retry = TRUE,
random_answer_order = TRUE
)
Upvotes: 0