equatiomatic
equatiomatic copied to clipboard
Error in tex_image
Hi, I've been trying to use the tex_preview(extract_eq(model)) function in the RStudio console, but this error message appears:
Error in tex_image(obj, stem, write_flag, overwrite) : pdf not rendered
The equation appears perfectly when I use RMarkdown's knit, but when I try it in the R console this problem persists.
Hi, this is probably an issue related to texPreview. @yonicd can you chime in to possibly help?
Please use reprex so i can diagnose the problem. Thanks
Hi, here is the requested reprex.
library(equatiomatic)
#> Warning: package 'equatiomatic' was built under R version 4.1.3
library(texPreview)
#> Warning: package 'texPreview' was built under R version 4.1.3
library(magrittr)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tidyr)
#>
#> Attaching package: 'tidyr'
#> The following object is masked from 'package:magrittr':
#>
#> extract
library(tidyverse)
library(lme4)
#> Carregando pacotes exigidos: Matrix
#>
#> Attaching package: 'Matrix'
#> The following objects are masked from 'package:tidyr':
#>
#> expand, pack, unpack
library(haven)
library(reprex)
#> Warning: package 'reprex' was built under R version 4.1.3
Banco_Movimente <- read_dta("C:/Users/rafam/Dropbox/2019 - Efeito e moderadores do Movimente na ACR/Banco e análises/Banco_Movimente_reestruturado.dta")
Banco_Movimente$tempo<- as.factor(Banco_Movimente$tempo)
Banco_Movimente$grupo<- as.factor(Banco_Movimente$grupo)
Banco_Movimente$serie<- as.factor(Banco_Movimente$serie)
Banco_Movimente$sex<- as.factor(Banco_Movimente$sex)
Banco_Movimente$codigo<- as.factor(Banco_Movimente$codigo)
Banco_Movimente$waistcat<- as.factor(Banco_Movimente$waistcat)
Banco_Movimente$weight_status<- as.factor(Banco_Movimente$weight_status)
AE<-subset(Banco_Movimente,select = c(codigo, tempo, grupo, agec, sex, vo2peak, PA, voltotaltr_ger, distance, weight, weight_status)) %>% droplevels
AE2 <- AE[complete.cases(AE),]
AE2$PAcat <- AE2$PA
AE2$PAcat[AE2$PAcat < 420] <- 0
AE2$PAcat[AE2$PAcat >=420] <- 1
summary(AE2$PAcat <- factor(AE2$PAcat))
#> 0 1
#> 430 439
AE2$PAcat <- factor(AE2$PAcat,labels=c('<420min/sem', '>=420min/sem'))
AE2$time <- AE2$tempo
AE2$time[AE2$time == 0] <- 0
AE2$time[AE2$time == 1] <- 1
AE2$time <- factor(AE2$time,labels=c('Pre', 'Follow-up'))
AE2$group <- AE2$grupo
AE2$group[AE2$group == 0] <- 0
AE2$group[AE2$group == 1] <- 1
AE2$group <- factor(AE2$group,labels=c('Control', 'Movimente'))
AE2<-AE2%>%
mutate(distance.s=(distance - mean(distance, na.rm = TRUE))/(sd(distance, na.rm = TRUE)))%>%
mutate(distance.c=(distance - mean(distance, na.rm = TRUE)))%>%
mutate(weight.s=(weight - mean(weight, na.rm = TRUE))/(sd(weight, na.rm = TRUE)))%>%
mutate(weight.c=(weight - mean(weight, na.rm = TRUE)))%>%
mutate(weight_status=factor(weight_status, levels = c("1", "2", "3"),ordered=TRUE))
mh9 <- lmer(distance.s ~ time*group + PAcat + weight.s + agec + (1|codigo) + (1|weight_status),
data=AE2)
extract_eq(mh9, wrap = T, ital_vars = T, use_coefs = T)
#> [1] "This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3) (preloaded format=pdflatex 2022.3.24) 26 MAR 2022 11:59"
#> [2] "entering extended mode"
#> [3] " restricted \\write18 enabled."
#> [4] " %&-line parsing enabled."
#> [5] "**./tex_tempDoc.tex"
#> [6] "(tex_tempDoc.tex"
#> [7] "LaTeX2e <2021-11-15> patch level 1"
#> [8] "L3 programming layer <2022-02-24>"
#> [9] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/standalone\\standalone.c"
#> [10] "ls"
#> [11] "Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan"
#> [12] "dalone"
#> [13] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/tools\\shellesc.sty"
#> [14] "Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX"
#> [15] "Package shellesc Info: Restricted shell escape enabled on input line 77."
#> [16] ") (C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/iftex\\ifluatex.sty"
#> [17] "Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead."
#> [18] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/iftex\\iftex.sty"
#> [19] "Package: iftex 2022/02/03 v1.0f TeX engine tests"
#> [20] ")) (C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/xkeyval\\xkeyval.sty"
#> [21] "Package: xkeyval 2020/11/20 v2.8 package option processing (HA)"
#> [22] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/xkeyval\\xkeyval.tex ("
#> [23] "C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/xkeyval\\xkvutils.tex"
#> [24] "\\XKV@toks=\\toks16"
#> [25] "\\XKV@tempa@toks=\\toks17"
#> [26] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/xkeyval\\keyval.tex))"
#> [27] "\\XKV@depth=\\count185"
#> [28] "File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)"
#> [29] "))"
#> [30] "\\sa@internal=\\count186"
#> [31] "\\c@sapage=\\count187"
#> [32] ""
#> [33] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/standalone\\standalone.c"
#> [34] "fg"
#> [35] "File: standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalon"
#> [36] "e' class"
#> Error in tex_image(obj, stem, write_flag, overwrite): pdf not rendered
tex_preview(extract_eq(mh9))
#> [1] "This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3) (preloaded format=pdflatex 2022.3.24) 26 MAR 2022 11:59"
#> [2] "entering extended mode"
#> [3] " restricted \\write18 enabled."
#> [4] " %&-line parsing enabled."
#> [5] "**./tex_tempDoc.tex"
#> [6] "(tex_tempDoc.tex"
#> [7] "LaTeX2e <2021-11-15> patch level 1"
#> [8] "L3 programming layer <2022-02-24>"
#> [9] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/standalone\\standalone.c"
#> [10] "ls"
#> [11] "Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan"
#> [12] "dalone"
#> [13] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/tools\\shellesc.sty"
#> [14] "Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX"
#> [15] "Package shellesc Info: Restricted shell escape enabled on input line 77."
#> [16] ") (C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/iftex\\ifluatex.sty"
#> [17] "Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead."
#> [18] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/iftex\\iftex.sty"
#> [19] "Package: iftex 2022/02/03 v1.0f TeX engine tests"
#> [20] ")) (C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/xkeyval\\xkeyval.sty"
#> [21] "Package: xkeyval 2020/11/20 v2.8 package option processing (HA)"
#> [22] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/xkeyval\\xkeyval.tex ("
#> [23] "C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/xkeyval\\xkvutils.tex"
#> [24] "\\XKV@toks=\\toks16"
#> [25] "\\XKV@tempa@toks=\\toks17"
#> [26] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/generic/xkeyval\\keyval.tex))"
#> [27] "\\XKV@depth=\\count185"
#> [28] "File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)"
#> [29] "))"
#> [30] "\\sa@internal=\\count186"
#> [31] "\\c@sapage=\\count187"
#> [32] ""
#> [33] "(C:\\Users\\rafam\\AppData\\Local\\Programs\\MiKTeX\\tex/latex/standalone\\standalone.c"
#> [34] "fg"
#> [35] "File: standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalon"
#> [36] "e' class"
#> Error in tex_image(obj, stem, write_flag, overwrite): pdf not rendered
Created on 2022-03-26 by the reprex package (v2.0.1)
The reprex is accessing a file that is in your dropbox.
please recreate the issue with a reprex with toy data that is specific to the model you are using in mh9
please attach the session_info()
output