LaTeX equation support

33 views
Skip to first unread message

John Helveston

unread,
Oct 20, 2021, 4:15:06 PM10/20/21
to formr
Hi everyone, in a recent survey I tried including a LaTeX math equation using $$ to denote  math mode, but it doesn't render. For example, $x$ just renders as \$x\$, so it's taking the $ symbol as a literal symbol. Any ideas on how to show equations in formr? My hack for now is just to save it as an image and show the image.

Ruben Arslan

unread,
Oct 22, 2021, 5:44:13 AM10/22/21
to John Helveston, formr
Hi John,

formr renders markdown differently in three contexts:
label attributes without R code are rendered as HTML in PHP without rmarkdown (and so without math mode)
label attributes with R code are rendered as HTML with rmarkdown but only snippets (so I'm guessing math mode won't work)
R code in Stop Buttons, Pages, and in note_iframe labels is rendered as a full page by rmarkdown, so I'd expect math mode to work.

I haven't tried it myself though.

Best wishes,
Ruben

On Wed, Oct 20, 2021 at 10:15 PM John Helveston <john.he...@gmail.com> wrote:
Hi everyone, in a recent survey I tried including a LaTeX math equation using $$ to denote  math mode, but it doesn't render. For example, $x$ just renders as \$x\$, so it's taking the $ symbol as a literal symbol. Any ideas on how to show equations in formr? My hack for now is just to save it as an image and show the image.

--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/formr/0241b98f-9b62-4aef-b2c8-da569cad4aa5n%40googlegroups.com.

John Helveston

unread,
Oct 22, 2021, 6:17:51 AM10/22/21
to formr
Thanks Ruben!

Okay, I tested each case and you're right - here's a demo
The note_iframe type was the only one that rendered the math (screenshot attached). 
The only issue is that with note_iframe I also see a code chunk of everything being called. 
Is there a way to hide that? I've tried a few things but can't quite figure it out.

Cheers,
JP

Screen Shot 2021-10-22 at 6.17.08 AM.png

Ruben Arslan

unread,
Oct 22, 2021, 7:01:26 AM10/22/21
to John Helveston, formr
Hi John,

you're in testing mode right? You shouldn't see code chunks once you use it as a "real" user,
or if you toggle testing mode off in the user overview.

Best wishes,

Ruben



John Helveston

unread,
Oct 22, 2021, 7:04:28 AM10/22/21
to formr
No I still saw the message even inside a run as a real user. 

Ruben Arslan

unread,
Oct 22, 2021, 7:08:10 AM10/22/21
to John Helveston, formr
Can't reproduce this behavior. https://helveston-test.formr.org/ this is just your survey in a run.

John Helveston

unread,
Oct 22, 2021, 8:31:56 AM10/22/21
to formr
Strange, no matter what I do in my run I always see it. Is there some setting in your run that you changed? 

John Helveston

unread,
Oct 22, 2021, 8:50:27 AM10/22/21
to formr
That solved it!...should have known better about the caching. 
Reply all
Reply to author
Forward
0 new messages