I am using latex syntax since I am creating .pdf in RMardown to enter .png file in text.
title: "Untitled"
author: "Unnamed"
date: "2024-05-17"
output:
pdf_document: default
word_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
pckgs = c('readr', 'kableExtra', 'magrittr', 'tidyverse', 'ggplot2', 'ggpubr',
'flextable','janitor', 'tidyr', 'readxl', 'car', 'effects', 'pastecs',
'compute.es', 'WRS2', 'multcomp', 'Hmisc', 'ggm', 'polycor', 'rstatix',
'babynames', 'hrbrthemes', 'viridis', 'WRS2', 'googledrive', 'ppcor',
'lattice', 'lmtest', 'betareg', 'ggcorrplot', 'corrplot', 'RColorBrewer',
'glmmTMB', 'DHARMa', 'gtsummary', 'knitr')
sapply(pckgs, function(x){if(!require(x, character.only = T))
{install.packages(x);require(x, character.only = T)}
else{require(x, character.only = T)}})
extxtxtxxtxtxttextbf{Fig.~ref{fig:figure1}}.
```{r}
setwd("C:/all path to picture folder")
```
begin{figure}[h]
centering
includegraphics[width=0.5textwidth]{AA.png}
caption{Fig 1: xxxxxxx}
label{fig:figure1}
end{figure}
But I am getting the following error.
A new version of TeX Live has been released. If you need to install or update any LaTeX packages, you have to upgrade TinyTeX with tinytex::reinstall_tinytex(repository = “illinois”).
tlmgr.pl: Local TeX Live (2023) is older than remote repository (2024).
Cross release updates are only supported with
update-tlmgr-latest(.sh/.exe) --update
See https://tug.org/texlive/upgrade.html for details.
! Package pdftex.def Error: File `AA.png' not found: using draft setting.
Errore: LaTeX failed to compile tr.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See tr.log for more info.
I am sure that AA.png is in the right folder. Do you know how I possibly could fix it?
Thanks