atlas-aai / ratlas

Custom graphics and report generation for @atlas-aai
https://ratlas.netlify.app
28 stars 8 forks source link

fmt_prop rendering incorrectly for html #59

Open JeffreyCHoover opened 1 year ago

JeffreyCHoover commented 1 year ago

fmt_prop is not rendering correctly for html versions of the tech manual, specifically values that become <.01, <.001, etc. It appears that the code for the less than symbol is being misinterpreted when rendering to html output.

wjakethompson commented 1 year ago

I also ran into this. The issue pops up when there is no space between the < and the number. For example, < .01 renders fine, <.01 does not. Here was my work around chapter 6 if it's helpful:

https://github.com/atlas-aai/dlm-tech-manual/blob/a9eccddf1def35f0b2fa0d945d0f89a42cf8e28a/chapters/06-Standard-Setting/ye-adjustment-ss.Rmd#L96

We might just have to update the fmt_small functionality to add a space if the output is html.

JeffreyCHoover commented 1 year ago

@wjakethompson That's interesting that the space (or lack thereof) is throwing everything off. If we don't want to add a space after the < symbol to have as similar as possible format across the pdf and html versions, it appears that replacing < with $\\lt$ for the html output will insert a < in the rendered html output.

I've been trying out some code for doing this in fmt_prop and fmt_prop_pct: https://github.com/atlas-aai/ratlas/blob/fmt-prop-bug/R/formatting.R#L184-L185