I have a large number in my code chunk:
a <- 1.234 * 10^36
Which I then print inline in my document:
What does this look like when knitted: `r a`
Knitting this in a standard .Rmd produces the expected 1.234 x 10^36
But knitting in the papaja template produces the "computational format" with 1.234e+36
Is there anyway to automate the formatting, without having to resort to a custom function like the solution given here?
You can use
knitrto force formatting.This will format the appearance to look like this (having used your code as described above).
I wasn't fond of the uneven distribution of space about
x, so I found captured the functions (and supporting functions) and was able to get:For the former, I used as you indicated. This isn't what you would use for the second option, though.
You wouldn't need to call the
hooks$set, but you would need to call the modified function and encapsulate the call with$.Here are the slightly modified
knitrfunctions that produced the second option:Alternatively, you can change this in your download of the knitr package. (I've made modifications to my downloaded packages before, not
knitr, though.)FYI, this was tested with and the images were from the knitted RMD using the output set to
output: papaja::apa6_pdf.