coatless-rpkg / assignr

Tools for Educators Writing Assignments in RMarkdown

Home Page:https://r-pkg.thecoatlessprofessor.com/assignr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Never ending with Korean

inmybrain opened this issue · comments

Hi

I'm trying to use this awesome package in my class, but I found that when I include Korean in Rmd, assignr does not complete its job. It is just stuck at the first step and does not proceed.

> assignr(file = "./Final_v1.0-main.Rmd")
Building Final_v1.0-assign files

Do you happen to know how I can handle this?

Thanks!

@inmybrain mind giving a quick reproducible example?

Hi @coatless,

I tried this. If I comment Korean ("이것은 한글이다") (and use English ("This is Korean") instead), it works.

p.s. Sorry for my late reply.

---
title: 'Homework X'
author: "Prof. Name"
date: 'Due: Friday, Month Day by 1:59 PM CDT'
output:
  html_document:
    theme: readable
    toc: yes
---

이것은 한글
<!-- This is English -->

```{asis, solution = TRUE}
**Solution:**
```

```{r, solution = TRUE}
1+1
```

@inmybrain thanks for the reproducible example.

The reason for the hang error is assignr attempts to create two formats: html and pdf.

During the generation of the pdf, there is an error thrown:

! Package inputenc Error: Unicode character 이 (U+C774)
(inputenc)                not set up for use with LaTeX.

Try other LaTeX engines instead (e.g., xelatex) if you are using pdflatex. See https://bookdown.org/yihui/rmarkdown-cookbook/latex-unicode.html
Error: LaTeX failed to compile test-assign.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test-assign.log for more info.

That said, the HTML version generates cleanly. For the moment, I'd like to solve this by just generating HTML.

Could you try the patch?

if(!requireNamespace("remotes")) install.packages("remotes")

remotes::install_github("r-assist/assignr", ref = "issue-15-format")

Then, use:

assignr::assignr("test-main.Rmd", output_format = "html_document")

Thanks a lot, @coatless

This works well :) Your comment also solves one question that I had in my mind: could we just return either html or pdf output? Hope to see this update in the later version.

p.s. To compile Korean in LaTeX, you need to install "kotex" package :)