graphdr / formatdown

Formatting tools for markdown documents
https://graphdr.github.io/formatdown/
Other
8 stars 0 forks source link

"format_power": "omit_power" does not omit the power. #3

Closed piiskop closed 8 months ago

piiskop commented 10 months ago
librarian::shelf(c(
  "formatdown"
))
numbers <- c(123.456, 2e-6, 5e8, 0.23)
format_power(numbers, omit_power = c(-6, -6))

[1] "$123.5 \times 10^{0}$" "$2.000 \times 10^{-6}$" "$500.0 \times 10^{6}$" "$230.0 \times 10^{-3}$"

graphdr commented 8 months ago

The omit_power vector is a range of exponents. I think you intended to write format_power(numbers, omit_power = c(-6, 6)) where the second entry is a positive 6.

piiskop commented 8 months ago

No, I did not. What a mistake that I did not make! Do yo usee that the second value in the vector has the power -6 although I explicitly told it to exclude the power -6.

graphdr commented 8 months ago

Oh, I see. You wanted to exclude just the -6 power. That is not a use-case I considered. I'll see what I can do .

I've edited the code to address the issue you raised. After I upload the development version to GitHub (in an hour or so), you are welcome to download it and try your use cases again. I think the results are what you had expected.

graphdr commented 8 months ago

Development version is now on GitHub