Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

parsing latex strings inside parentheses #34

Closed
AlbertLei opened this issue Oct 10, 2024 · 1 comment
Closed

parsing latex strings inside parentheses #34

AlbertLei opened this issue Oct 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@AlbertLei
Copy link

litedown seems not parse latex strings inside parentheses. eg:

The force ($F$) equals to mass ($m$) multiplied by the acceleration ($a$).

litedown output:

image

Would you consider changing the latex parsing rule to allow this? The previosu example is parsed "correctly" by pandoc and github (see below)

  • The force ($F$) equals to mass ($m$) multiplied by the acceleration ($a$).
@yihui yihui added the bug Something isn't working label Oct 10, 2024
@yihui
Copy link
Owner

yihui commented Oct 10, 2024

Fixed in xfun. Thanks for the report! You can install the development version via

remotes::install_github('yihui/xfun')

Or wait for an hour and

install.packages('xfun', repos = 'https://yihui.r-universe.dev')

Make sure packageVersion('') >= '0.48.5') after installation.

clrpackages pushed a commit to clearlinux-pkgs/R-xfun that referenced this issue Nov 18, 2024
Michael Chirico (1):
      Remove unused function (#93)

Yihui Xie (16):
      start the next version
      add argument use_block = FALSE to protect_math()
      no need to escape " by default in html_escape()
      add a `start` argument to make_fence()
      ignore $ $ as inline math if backticks appear after opening $ or before closing $
      fix yihui/litedown#34: allow () around math expressions (outside dollar signs)
      only check `^<pre>` and `</pre>$`
      read_all()'s `before` and `after` functions can take the file content as the second argument
      tried an implementation of prose_index() via commonmark but it's too slow; leave the code here for future reference
      stop early if graphics device failed to open, e.g. png(type = 'cairo') can fail on macOS without xquartz, but it doesn't throw an error, so we have to check if dev.list() really has a new device
      fix yihui/litedown#38: for `name` and `call` values (typically from quote(), but could be from as.name() or call(), too), use do.call(quote = TRUE) in reocrd()
      forgot to suggest commonmark in aa75d8fb04d0637dbfccca0d3b6aa0c1e5108799
      try dev version of litedown
      close yihui/litedown#37: provide a helper function to clean up apps registered in tools:::.httpd.handlers.env
      amend 6b98bb6b05f8ff7c586057174ee093e2b2ea5231: knitr has tests that expect `"` to be converted to `&quot;`
      CRAN release v0.49
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 12, 2025
# CHANGES IN xfun VERSION 0.50

- The function `isFALSE()` has been removed from this package. The
  deprecation notice was given two years ago:
  https://yihui.org/en/2023/02/xfun-isfalse/

- Added a new function `tabset()` to represent a list with a
  tabset. The representation is similar to `str()`, but uses a visual
  form.

- Factored out the function `taml_load()` and exported it (TAML is a
  tiny subset of YAML). Also added a new function `taml_save()` to
  convert simple lists to YAML.

- The `print` argument of `record()` can accept non-function values
  now, in which case `print()` (or `show()` for S4 objects) will be
  used as the print function.

- The `record()` results can also be formatted to Markdown via
  `format(record(), to = 'markdown')`.

- Moved `knitr::combine_words()` into this package as
  `xfun::join_words()`. The former has become a simple wrapper of the
  latter.

- Similarly, moved `knitr::write_bib()` into this package as
  `xfun::pkg_bib()`.

- Moved the internal function `str_wrap()` from **knitr** and exported
  it as `xfun::str_wrap()`.

- Exported the internal `find_globals()` and `find_locals()`
  functions.

- `md_table()` escapes `|` in the table to `\|` instead of `&#124;`
  now.

- `yaml_load(use_yaml = FALSE)` allows for indenting sub-fields by any
  number of spaces now (thanks, @J-Moravec, #95). Previously, one
  level of indentation must use exactly 2 spaces.

- `divide_chunk()` no longer requires every line of chunk options to
  be commented out when the engine uses a pair of comment delimiters
  (such as `/*` and `*/` for CSS) instead of a single comment
  character. It suffices to use the opening delimiter at the beginning
  and closing delimiter at the end, e.g.,

  ````md
  ```{css}
  /*| echo=FALSE,
      label='foo' */
  ```
  ````

  Previously, every line must be commented out like:

  ````md
  ```{css}
  /*| echo=FALSE, */
  /*| label='foo' */
  ```
  ````

# CHANGES IN xfun VERSION 0.49

- Added an argument `use_block = FALSE` to `protect_math()`. When
  `use_block = TRUE`, a `$$ $$` expression that spans across multiple
  lines will be protected in a code block.

- `protect_math()` will ignore `$ $` if there are backticks after the
  opening `$` or before the closing `$`, e.g., ``$`this is not
  math`$``.

- `protect_math()` allows for parentheses `()` around math expressions
  now, e.g., `($x$)` was previously not recognized but is recognized
  now (thanks, @AlbertLei, yihui/litedown#34).

- `record()` works with `quote()` now (thanks, @ben-schwen,
  yihui/litedown#38).

- `html_escape()` will not escape double quotes (i.e., convert `"`" to
  `&quot;`) by default, and the conversion will be done only for
  `html_escape(attr = TRUE)`.

- The arguments `before` and `after` of `read_all()` can take
  functions of two arguments now, with the second argument being the
  content of each file.

- Added an argument `start` to `make_fence()`.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants