{"id":14981038,"url":"https://github.com/lightbridge-ks/thaipdf","last_synced_at":"2025-10-29T04:31:33.104Z","repository":{"id":37960727,"uuid":"458456937","full_name":"Lightbridge-KS/thaipdf","owner":"Lightbridge-KS","description":"R Markdown to PDF in Thai language 🇹🇭","archived":false,"fork":false,"pushed_at":"2022-06-13T15:05:47.000Z","size":3946,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T22:01:39.030Z","etag":null,"topics":["latex-template","pdf-document","r-package","rmarkdown","thai","thai-language"],"latest_commit_sha":null,"homepage":"https://lightbridge-ks.github.io/thaipdf","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lightbridge-KS.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-12T07:52:47.000Z","updated_at":"2023-02-19T16:30:57.000Z","dependencies_parsed_at":"2022-08-27T13:41:42.275Z","dependency_job_id":null,"html_url":"https://github.com/Lightbridge-KS/thaipdf","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightbridge-KS%2Fthaipdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightbridge-KS%2Fthaipdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightbridge-KS%2Fthaipdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightbridge-KS%2Fthaipdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lightbridge-KS","download_url":"https://codeload.github.com/Lightbridge-KS/thaipdf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238768419,"owners_count":19527197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["latex-template","pdf-document","r-package","rmarkdown","thai","thai-language"],"created_at":"2024-09-24T14:02:46.777Z","updated_at":"2025-10-29T04:31:27.494Z","avatar_url":"https://github.com/Lightbridge-KS.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\n# from: https://github.com/mitchelloharawild/vitae/blob/master/README.Rmd\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# thaipdf \u003ca href=\"https://lightbridge-ks.github.io/thaipdf/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\"/\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![CRAN status](https://www.r-pkg.org/badges/version/thaipdf)](https://CRAN.R-project.org/package=thaipdf) [![R-CMD-check](https://github.com/Lightbridge-KS/thaipdf/workflows/R-CMD-check/badge.svg)](https://github.com/Lightbridge-KS/thaipdf/actions) [![codecov](https://codecov.io/gh/Lightbridge-KS/thaipdf/branch/main/graph/badge.svg?token=QPhwQZt2vf)](https://app.codecov.io/gh/Lightbridge-KS/thaipdf) [![pkgdown](https://github.com/Lightbridge-KS/thaipdf/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/Lightbridge-KS/thaipdf/actions/workflows/pkgdown.yaml)\n\n\u003c!-- badges: end --\u003e\n\n\u003e R package :package: ช่วยสร้าง PDF document จาก R Markdown ที่ใช้ **ภาษาไทย :thailand:**\n\n```{r show-previews, echo=FALSE, results='asis'}\nknitr::kable(\n  tibble::tibble(\n    `1` = \"![Thai book example 1](man/figures/book-th-ex1.png)\",\n    `2` = \"![Thai book example 2](man/figures/book-th-ex2.png)\"\n    ),\n  escape = FALSE\n)\n```\n\n# Goal\n\nR package นี้ช่วย**สร้าง PDF เป็นภาษาไทย :thailand: จาก [R Markdown](https://rmarkdown.rstudio.com) ได้โดยง่าย**\n\n-   **ผู้เริ่มต้น** สามารถ **knit** เอกสาร R Markdown เป็น PDF ได้ทันทีโดยใช้ template ที่มีให้ และ\n\n-   **ผู้ที่ใช้งาน [LaTeX](https://www.latex-project.org) เป็น** สามารถเรียกใช้ LaTeX preamble ที่มีการตั้งค่าภาษาไทยมาให้แล้ว มา customize เพิ่มเติมอย่างที่ต้องการได้\n\nโดยจะพยามคง option ต่างๆ ของ R Markdown ไว้ให้ได้มากที่สุด ซึ่งสามารถส่งต่อ YAML parameter ไปยัง R Markdown หรือ bookdown ได้ด้วย\n\n# Install\n\n**Install thaipdf:**\n\n-   ติดตั้งจาก CRAN ด้วย:\n\n``` r\ninstall.packages(\"thaipdf\")\n```\n\n-   หรือติดตั้ง development version จาก [GitHub](https://github.com/Lightbridge-KS/thaipdf) ด้วย:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"Lightbridge-KS/thaipdf\")\n```\n\n**Install XeLaTeX และ LaTeX package** ที่จำเป็นสำหรับการใช้ภาษาไทย อาจทำได้อย่างง่ายโดยใช้ [{tinytex}](https://yihui.org/tinytex/) R package:\n\n``` r\ninstall.packages(\"tinytex\")\n\n# For using R Markdown\ntinytex::install_tinytex() \n\n# Install LaTeX PKG required by `thaipdf`\ntinytex::tlmgr_install(c(\n  \"fontspec\", \"ucharclasses\", \"polyglossia\"\n))\n```\n\n**Check font:** ตรวจสอบว่าในเครื่องมีฟอนท์ [TH Sarabun New](https://www.f0nt.com/release/th-sarabun-new/) ถ้าไม่มีให้ติดตั้งด้วย (เนื่องจาก thaipdf ใช้ font นี้เป็นตัวหลัก)\n\n# Usage\n\nวิธีใช้ที่ง่ายที่สุด คือสร้าง R Markdown ที่รองรับภาษาไทยจาก template ที่ package นี้มีให้\n\nถ้าท่านใช้ RStudio ให้ไปที่ `File -\u003e New File -\u003e R Markdown... -\u003e From Template`\n\n\u003cimg src=\"man/figures/rmd-from-temp.png\" alt=\"New R Markdown Template\" width=\"500\"/\u003e\n\nเลือก template **Thai PDF R Markdown** หรือ **Thai PDF Bookdown** จากเมนู\n\nกดปุ่ม **`OK`** จะเปิดไฟล์ R Markdown template ที่รองรับกับภาษาไทย\n\n\u003cimg src=\"man/figures/rstudio-rmd.png\" alt=\"thaipdf R Markdown in RStudio\" width=\"600\"/\u003e\n\nจากนั้นกดปุ่ม **`Knit`** (cmd/ctr + shift + K) ได้เลย จะได้เอกสารเป็น PDF ภาษาไทยที่มี เนื้อหา โค้ด และ กราฟ อยู่รวมกัน\n\n![ตัวอย่าง R Markdown PDF ภาษาไทย](man/figures/pdf-doc-1.png)\n\n# Learn more\n\n-   [**Get Started with thaipdf**](https://lightbridge-ks.github.io/thaipdf/articles/thaipdf.html)\n\n------------------------------------------------------------------------\n\nLast Updated: `r Sys.Date()`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightbridge-ks%2Fthaipdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightbridge-ks%2Fthaipdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightbridge-ks%2Fthaipdf/lists"}