Skip to content

! Package mathspec Error: amsmath' must be loaded earlier than mathspec'. #751

@XiangyunHuang

Description

@XiangyunHuang

In fact, amsmath package doesn't have to load when using gt.

latex_packages <- function() {
c("amsmath", "booktabs", "caption", "longtable")
}

here is a minimal example

---
title: "Untitled"
mathspec: yes
output: 
  pdf_document: 
    latex_engine: xelatex
    template: null
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## gt

```{r}
library(gt)
iris %>%
  head() %>% 
  gt()
```


## session 

```{r}
xfun::session_info(c("rmarkdown", "gt"))
```

run log as follow

processing file: Untitled.Rmd
  |..........                                                            |  14%
  ordinary text without R code

  |....................                                                  |  29%
label: setup (with options) 
List of 1
 $ include: logi FALSE

  |..............................                                        |  43%
  ordinary text without R code

  |........................................                              |  57%
label: unnamed-chunk-1
  |..................................................                    |  71%
  ordinary text without R code

  |............................................................          |  86%
label: unnamed-chunk-2
  |......................................................................| 100%
  ordinary text without R code


/usr/local/bin/pandoc +RTS -K512m -RTS Untitled.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Untitled.tex --lua-filter /usr/local/lib/R/4.0/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/4.0/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine xelatex --include-in-header /var/folders/tj/d2qg79690bx3gy4fmz2n140r0000gn/T//Rtmpp2a2zs/rmarkdown-str12c7855dcef40.html 
output file: Untitled.knit.md

! Package mathspec Error: `amsmath' must be loaded earlier than `mathspec'.

Error: LaTeX failed to compile Untitled.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
Execution halted

session info

xfun::session_info(c("rmarkdown", "gt"))
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin20.4.0 (64-bit)
Running under: macOS Big Sur 11.3

Locale: zh_CN.UTF-8 / zh_CN.UTF-8 / zh_CN.UTF-8 / C / zh_CN.UTF-8 / zh_CN.UTF-8

Package version:
  backports_1.2.1    base64enc_0.1.3    checkmate_2.0.0   
  cli_2.5.0          colorspace_2.0.0   commonmark_1.7    
  crayon_1.4.1       digest_0.6.27      dplyr_1.0.5       
  ellipsis_0.3.2     evaluate_0.14      fansi_0.4.2       
  farver_2.1.0       fs_1.5.0           generics_0.1.0    
  ggplot2_3.3.3      glue_1.4.2         graphics_4.0.5    
  grDevices_4.0.5    grid_4.0.5         gt_0.2.2          
  gtable_0.3.0       highr_0.9          htmltools_0.5.1.1 
  isoband_0.2.4      jsonlite_1.7.2     knitr_1.33        
  labeling_0.4.2     lattice_0.20.41    lifecycle_1.0.0   
  magrittr_2.0.1     markdown_1.1       MASS_7.3.53.1     
  Matrix_1.3.2       methods_4.0.5      mgcv_1.8.35       
  mime_0.10          munsell_0.5.0      nlme_3.1.152      
  pillar_1.6.0       pkgconfig_2.0.3    purrr_0.3.4       
  R6_2.5.0           rappdirs_0.3.3     RColorBrewer_1.1.2
  rlang_0.4.11       rmarkdown_2.7.12   sass_0.3.1.9001   
  scales_1.1.1       splines_4.0.5      stats_4.0.5       
  stringi_1.5.4      stringr_1.4.0      tibble_3.1.1      
  tidyselect_1.1.1   tinytex_0.31.6     tools_4.0.5       
  utf8_1.2.1         utils_4.0.5        vctrs_0.3.8       
  viridisLite_0.4.0  withr_2.4.2        xfun_0.22         
  yaml_2.2.1        

Pandoc version: 2.13

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions