Giter Site home page Giter Site logo

lightbridge-ks / thaipdf Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 3.85 MB

R Markdown to PDF in Thai language 🇹🇭

Home Page: https://lightbridge-ks.github.io/thaipdf

License: Other

TeX 66.65% R 33.35%
thai-language latex-template thai r-package rmarkdown pdf-document

thaipdf's Introduction

thaipdf

Lifecycle: experimental CRAN status R-CMD-check codecov pkgdown

R package 📦 ช่วยสร้าง PDF document จาก R Markdown ที่ใช้ ภาษาไทย 🇹🇭

1 2
Thai book example 1 Thai book example 2

Goal

R package นี้ช่วยสร้าง PDF เป็นภาษาไทย 🇹🇭 จาก R Markdown ได้โดยง่าย

  • ผู้เริ่มต้น สามารถ knit เอกสาร R Markdown เป็น PDF ได้ทันทีโดยใช้ template ที่มีให้ และ

  • ผู้ที่ใช้งาน LaTeX เป็น สามารถเรียกใช้ LaTeX preamble ที่มีการตั้งค่าภาษาไทยมาให้แล้ว มา customize เพิ่มเติมอย่างที่ต้องการได้

โดยจะพยามคง option ต่างๆ ของ R Markdown ไว้ให้ได้มากที่สุด ซึ่งสามารถส่งต่อ YAML parameter ไปยัง R Markdown หรือ bookdown ได้ด้วย

Install

Install thaipdf:

  • ติดตั้งจาก CRAN ด้วย:
install.packages("thaipdf")
  • หรือติดตั้ง development version จาก GitHub ด้วย:
# install.packages("remotes")
remotes::install_github("Lightbridge-KS/thaipdf")

Install XeLaTeX และ LaTeX package ที่จำเป็นสำหรับการใช้ภาษาไทย อาจทำได้อย่างง่ายโดยใช้ {tinytex} R package:

install.packages("tinytex")

# For using R Markdown
tinytex::install_tinytex() 

# Install LaTeX PKG required by `thaipdf`
tinytex::tlmgr_install(c(
  "fontspec", "ucharclasses", "polyglossia"
))

Check font: ตรวจสอบว่าในเครื่องมีฟอนท์ TH Sarabun New ถ้าไม่มีให้ติดตั้งด้วย (เนื่องจาก thaipdf ใช้ font นี้เป็นตัวหลัก)

Usage

วิธีใช้ที่ง่ายที่สุด คือสร้าง R Markdown ที่รองรับภาษาไทยจาก template ที่ package นี้มีให้

ถ้าท่านใช้ RStudio ให้ไปที่ File -> New File -> R Markdown... -> From Template

New R Markdown Template

เลือก template Thai PDF R Markdown หรือ Thai PDF Bookdown จากเมนู

กดปุ่ม OK จะเปิดไฟล์ R Markdown template ที่รองรับกับภาษาไทย

thaipdf R Markdown in RStudio

จากนั้นกดปุ่ม Knit (cmd/ctr + shift + K) ได้เลย จะได้เอกสารเป็น PDF ภาษาไทยที่มี เนื้อหา โค้ด และ กราฟ อยู่รวมกัน

ตัวอย่าง R Markdown PDF ภาษาไทย

Learn more


Last Updated: 2022-04-23

thaipdf's People

Contributors

lightbridge-ks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

thaipdf's Issues

Package microtype Warning

When compile LaTeX, I get this warning message on R console.

Warning: Package microtype Warning: Unable to apply patch `footnote' on input line 167.

improve unit test

  • Using Snapshot test in Local machine to make sure that PDF can be rendered.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.