Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support the $$ syntax for pdf output #959

Open
3 tasks done
etiennebr opened this issue Sep 27, 2020 · 3 comments
Open
3 tasks done

Support the $$ syntax for pdf output #959

etiennebr opened this issue Sep 27, 2020 · 3 comments
Labels
feature a feature request or enhancement next to consider for next release

Comments

@etiennebr
Copy link

This is a feature request for $$ support for pdf output. I'm moving the discussion from rstudio/rticles#326

For epub, the syntax seems to be supported:

$$
(\#eq:label)
math
$$

It would be nice to have it for pdf too.

Because the $$ notation is closely related to cross-referencing of numbered equations, I think it's relevant to expose the cross-reference package syntax.

The cross-reference pandoc filter uses

$$ math $$ {#eq:label}

Translated to

\begin{equation}
\label{eq:label}
math 
\end{equation}

for tex output

This is slightly different from the current solution, which is to use a syntax closer to latex

\begin{equation}
(\#eq:label)
math 
\end{equation}

This prevents equation previews in Rstudio, and also requires the user to learn a new syntax when outputting to pdf.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/bookdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv
Copy link
Collaborator

cderv commented Sep 27, 2020

Some thoughts:

  • This would be in favor of rethinking the cross referencing in bookdown to maybe do it using a Pandoc Lua filter to deal with several output format.
  • Another idea: We could adapt the future news syntax (Custom environment using Fenced Divs #940) so that we could write equation environment this way
::: {.equation #eq1}
math
:::

that would lead to the a new equation environment in latex

\begin{equation}
\label{eq:eq1}
math 
\end{equation}

@cderv cderv added the feature a feature request or enhancement label Mar 30, 2021
@jiedxu
Copy link

jiedxu commented Aug 17, 2021

I hope there is a way in #940 syntax to label one of the equations in a aligned, align or any multi-line math environment:

$$ \begin{aligned}
math 1 \nonumber \\
math 2 (\#eq:label)
\end{aligned} $$

@cderv
Copy link
Collaborator

cderv commented Dec 23, 2021

More thoughts:

Afterall the following syntax could be the simpler to implement

$$ 
math
$$ {#eq:label}

using lua filter maybe

❯ pandoc -t native
$$ math $$ {#eq:label}
^Z
[ Para
    [ Math DisplayMath " math " , Space , Str "{#eq:label}" ]
]

@cderv cderv added the next to consider for next release label Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement next to consider for next release
Projects
None yet
Development

No branches or pull requests

3 participants