quarto-dev/quarto-cli

Decimal point not shown when wrapping inline code within math delimiters

Closed this issue · 2 comments

Bug description

The decimal point is not shown when wrapping inline code within math delimiters.

Steps to reproduce

---
title: "Test Title"
author: "Test Author"
lang: "en"
engine: knitr
format: pdf
---

$`{r} format.pval(1.066457e-10, eps = 0.001, scientific = FALSE)`$

Expected behavior

< 0.001

Actual behavior

< 0001

Your environment

  • Fedora Linux 40

Quarto check output

Quarto 1.6.6
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.6
      Path: /home/<USER>/Downloads/quarto-1.6.6-linux-amd64/quarto-1.6.6/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/local/texlive/2024/bin/x86_64-linux
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.4
      Path: /usr/bin/python3
      Jupyter: 5.7.1
      Kernels: ir, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /usr/lib64/R
      LibPaths:
        - /home/<USER>/R/x86_64-redhat-linux-gnu-library/4.4
        - /usr/local/lib/R/library
        - /usr/lib64/R/library
        - /usr/share/R/library
      knitr: 1.48
      rmarkdown: 2.28

[✓] Checking Knitr engine render......OK

This isn't a bug; you need I() that code for this kind of thing (because you want the equivalent of output: asis). In the future, consider using keep-md: true first to investigate what's happening. This works:

---
title: "Test Title"
author: "Test Author"
lang: "en"
engine: knitr
format: pdf
keep-md: true
---

$`{r} I(format.pval(1.066457e-10, eps = 0.001, scientific = FALSE))`$

I see, the decimal point is escaped. This feels like a false positive, but I reckon you are not inclined to exclude, e.g., instances of \d+\.\d+ from escaping?

Maybe the tutorial on computations (or some other part of the documentation) could benefit from mentioning use cases of I() (like typesetting math) as well? When I read...

Any markdown-like syntax within the output of inline expressions will be automatically escaped.

...I only thought about _emphasis_ and the like, but not decimal points.

Of note, numerics are not escaped, hence...

$`{r} round(329.2903 , digits = 2)`$

...appears correct.