Skip to content

MDPI issue with equation numbering #326

@etiennebr

Description

@etiennebr

Equation labels are not translated \label{eq:eq} when knitting with mdpi_article, but they are with bookdown::pdf_document2.

Here's the Rmd

This is an equation
\begin{equation}
(\#eq:eq)
c = a \cdot b
\end{equation}
  
see \@ref(eq:eq)

And 
$$
(\#eq:eq2)
a = c \cdot b
$$
  
see \@ref(eq:eq2)

Knit with bookdown::pdf_document2
image

Knit with rticles::mdpi_article
image

It seems like there is some processing not happening. I don't have a deep knowledge of knitr, so I suspect it might simply be that the mdpi_article and pdf2_document are unrelated, and mdpi in fact uses pdf_document for rendering, but in any case, I'd like to reference equations in a mdpi paper, so this might be a feature request. Also, per rstudio/bookdown#190 (comment), it seems like the second equation should also be translated to \begin{equation} ... \end{equation} (at least for ebooks), so I wondered if one of my packages was outdated, but apparently not (see session info below, but knitr_1.30, rmarkdown_2.3, bookdown_0.20, rticles_0.16.1 all seemed fine).

Here are the rendered .tex

With bookdown::pdf_document2 yields in .tex

This is an equation
\begin{equation}
\label{eq:eq}
c = a \cdot b
\end{equation}

see \eqref{eq:eq}

And
\[
\label{eq:eq2}
a = c \cdot b
\]

see \eqref{eq:eq2}

With rticles::mdpi_article, the tex is:

This is an equation \begin{equation}
(\#eq:eq)
c = a \cdot b
\end{equation}

see @ref(eq:eq)

And \[
(\#eq:eq2)
a = c \cdot b
\]

@dleutnant, any idea? @cderv, I'm happy to dive a bit deeper in rticles/knitr if you can point me in a general direction where this could be fixed, or how to have a step-by-step look at the knitting process because I'm completely new to this code.

session info
xfun::session_info('rticles')
#' R version 3.6.3 (2020-02-29)
#' Platform: x86_64-pc-linux-gnu (64-bit)
#' Running under: Ubuntu 18.04.5 LTS, RStudio 1.3.1073
#' 
#' Locale:
#'   LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8       
#'   LC_COLLATE=en_CA.UTF-8     LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
#'   LC_PAPER=en_CA.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
#'   LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       
#' 
#' Package version:
#'   base64enc_0.1.3 digest_0.6.25   evaluate_0.14   glue_1.4.2      graphics_3.6.3 
#'   grDevices_3.6.3 highr_0.8       htmltools_0.5.0 jsonlite_1.7.1  knitr_1.30     
#'   magrittr_1.5    markdown_1.1    methods_3.6.3   mime_0.9        rlang_0.4.7    
#'   rmarkdown_2.3   rticles_0.16.1  stats_3.6.3     stringi_1.5.3   stringr_1.4.0  
#'   tinytex_0.26    tools_3.6.3     utils_3.6.3     xfun_0.17       yaml_2.2.1    

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/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('rticles'). 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/rticles').
    • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions