Error ตอน Export PDF
Problem: No LaTeX installation detected ตอน Knit to PDF
No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/ If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex() Otherwise consider MiKTeX on Windows - http://miktex.org MacTeX on macOS - https://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome strongly recommended)
Solution:
- ลองตามที่มันแนะนำ
tinytex::install_tinytex()
- อ๋อ เหมือน RMarkDown มีปัญหา กับภาษาไทยนะ
Ref: https://bookdown.org/yihui/rmarkdown-cookbook/install-latex.html
📍📍Update 2025-03-04 เรื่องภาษาไทยต้องไปแก้ Config ใน RMarkdown 📍📍
ถ้ามีติดภาษาไทยต้องมีเปลี่ยนนิดหน่อยครับ ตัว default ที่เป็น pdflatex ไม่รองรับ unicode
output: pdf_document: latex_engine: xelatex
ใน RMarkdown เราเติมประมาณนี้ + ลง xelatex
--- title: "R_DataVizHW_ChatriNG" author: "Chatri Ngambenchawong" date: "2025-02-22" output: pdf_document: latex_engine: xelatex ---
Ref:
- https://cran.r-project.org/web/packages/thaipdf/vignettes/thaipdf.html
- https://support.posit.co/hc/en-us/articles/200532257-Customizing-LaTeX-Options-in-the-RStudio-IDE
Problem: trying to use CRAN without setting a mirror
Error in `contrib.url()`: ! trying to use CRAN without setting a mirror Backtrace:
Solution:
- ตอน Step Install Require Package ให้เติม
repos = "http://cran.us.r-project.org"
แต่ถ้า package อยู่ที่อื่นต้องแก้ URL นะ
```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) install.packages("nycflights23",repos = "http://cran.us.r-project.org") install.packages("dplyr",repos = "http://cran.us.r-project.org") install.packages("ggplot2",repos = "http://cran.us.r-project.org") install.packages("tidyr",repos = "http://cran.us.r-project.org") library(nycflights23) library(dplyr) library(ggplot2) library(tidyr) ```
Problem: ! LaTeX Error: Unicode character ่ (U+0E48)
! LaTeX Error: Unicode character ่ (U+0E48) not set up for use with LaTeX.
U+0E48 ไม้เอกครับ
Solution:
หาให้เจอ แล้วลบทิ้ง
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.