Giter Club home page Giter Club logo

Comments (11)

ulyngs avatar ulyngs commented on August 27, 2024

Thanks for flagging this! :)

Can you show me an example of Japanese input, and the garbled output, so I can have a look at what the issue is?

from oxforddown.

kizen777 avatar kizen777 commented on August 27, 2024

The part before "Why use it?" in the Introduction is now in Japanese as attached.
BTW, Is this the correct way to contact you?

#########################################

options for knitting a single chapter

#########################################

オックスフォード大学で自分の博士論文を書く際に作成したRMark-down用の論文テンプレート、oxforddown [@lyngsOxforddown2019]へようこそ。このテンプレートでは、RMarkdownで書きながら、美しく実績のあるOxThesisLaTeXテンプレートでPDF出力をフォーマットすることができ,かつ,長い間使われてきた美しいOxThesisLaTeXテンプレートでPDF出力をフォーマットすることができます。my own PhD thesis at the University of Oxford.
もしあなたがTeXやLaTeXを使ったことがないのであればR Markdownで論文を書くことで、OxThesisテンプレートへのより良いインターフェイスを提供できることを願っています。さらに重要なことは、R Markdownを使うと、論文の中にコードの塊を埋め込むことができ、コピー&ペーストの手順を避けて、基礎となるデータから直接プロットや表を生成することができるということです。これにより、再現可能な研究を行う習慣が身に付き、研究者としての長期的な利益となり、将来的にあなたの結果を再現したり構築したりしようとする人の助けにもなるのです。

Why use it? {.unnumbered}

-------Error message------
processing file: 00-introduction.Rmd
output file: 00-introduction.knit.md

! Package inputenc Error: Unicode character オ (U+30AA)
(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
エラー: LaTeX failed to compile 00-introduction.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See 00-introduction.log for more info.
追加情報: 警告メッセージ:
1: grep("^\s*$", x) で: 入力文字列 1824 はこのロケールでは不適切です
2: grep("^! ", x) で: 入力文字列 1824 はこのロケールでは不適切です
実行が停止されました

from oxforddown.

kizen777 avatar kizen777 commented on August 27, 2024

Fonts are specified: "MS Mincho" for Japanese and Times "New Roman for Roman" for Europe, US matters.

from oxforddown.

ulyngs avatar ulyngs commented on August 27, 2024

I just looked into this:

As per this latex stack exchange, one way to write Japanese characters in LaTeX is to

  • use the xelatex LaTeX engine instead of pdflatex (which oxforddown uses by default)
  • add the LaTeX package xeCJK

To do this with oxforddown, adjust the 'output details' section of index.Rmd to the following:

header-includes:
  - \usepackage{xeCJK}
output:
  bookdown::pdf_book:
    latex_engine: xelatex
    citation_pa... (etc.)

Does this work?

from oxforddown.

kizen777 avatar kizen777 commented on August 27, 2024

before input, Japanese characters got an
Error message:
register() で:
Can't find generic scale_type in package ggplot2 to register S3 method.
yaml::yaml.load(..., eval.expr = TRUE) でエラー:
Parser error: while parsing a block collection at line 152, column 3 did not find expected '-' indicator at line 153, column 3
呼び出し: ... parse_yaml_front_matter -> yaml_load ->
実行が停止されました
When I add #####################

output details

#####################
header-includes:
-\usepackage{xeCJK}
output:
bookdown::pdf_book:
latex_engine: xelatex
citation_package: biblatex

macOS Big Sur 11.5.2, XQuartz 2.8.1(xorg-server 1.20.11)
R version 4.1.3(2022-03-10) -- "One Push-Up"
RStudio 1.4.1717

from oxforddown.

ulyngs avatar ulyngs commented on August 27, 2024

Can you confirm that you used exactly the same indentation as in my example above? It seems like this is just a parsing error of the YAML header. So, for example, you must put two spaces before " - \usepackage{xeCJK}".

As a starting point, try creating a new, R Markdown file that contains only the following, and knit it:

---
header-includes:
  - \usepackage{xeCJK}
output: 
  pdf_document:
    latex_engine: xelatex
---

オックスフォ

Can you confirm that this works?

from oxforddown.

kizen777 avatar kizen777 commented on August 27, 2024

I did a new RMarkdown with only 4 lines and put two spaces before " -\usepackage{xeCJK} then showed the following;

The following objects are masked from 'package:base':

errorCondition

Error message:

Can't find generic scale_type in package ggplot2 to register S3 method.
|......................................................................| 100%
ordinary text without R code

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS test_Japanese_character.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output test_Japanese_character.html --lua-filter /Library/Frameworks/R.framework/Versions/4.1/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.1/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/4.1/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /var/folders/vg/yh8xwzx52dq7dy_mzblw7dl40000gn/T//RtmpGcI3iC/rmarkdown-str28fe35ba391d.html

processing file: test_Japanese_character.Rmd
output file: test_Japanese_character.knit.md

[WARNING] This document format requires a nonempty <title> element.
Defaulting to 'test_Japanese_character.knit' as the title.
To specify a title, use 'title' in metadata or --metadata title="...".

Output created: test_Japanese_character.html

from oxforddown.

ulyngs avatar ulyngs commented on August 27, 2024

Can you show me the content of the entire R Markdown file you created, and I'll try to reproduce the error?

from oxforddown.

kizen777 avatar kizen777 commented on August 27, 2024

from oxforddown.

ulyngs avatar ulyngs commented on August 27, 2024

No, I meant can you confirm that you put only this content in a brand-new R Markdown file in a brand-new project?

---
header-includes:
  - \usepackage{xeCJK}
output: 
  pdf_document:
    latex_engine: xelatex
---

オックスフォ

So forgetting everything about oxforddown for a minute, are you normally able to use Japanese characters in R Markdown documents and output to PDF without any issues?

from oxforddown.

kizen777 avatar kizen777 commented on August 27, 2024

from oxforddown.

Related Issues (20)

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.