Closed kizen777 closed 1 year ago
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?
#########################################
#########################################
オックスフォード大学で自分の博士論文を書く際に作成した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を使うと、論文の中にコードの塊を埋め込むことができ、コピー&ペーストの手順を避けて、基礎となるデータから直接プロットや表を生成することができるということです。これにより、再現可能な研究を行う習慣が身に付き、研究者としての長期的な利益となり、将来的にあなたの結果を再現したり構築したりしようとする人の助けにもなるのです。
-------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 はこのロケールでは不適切です 実行が停止されました
Fonts are specified: "MS Mincho" for Japanese and Times "New Roman for Roman" for Europe, US matters.
I just looked into this:
As per this latex stack exchange, one way to write Japanese characters in LaTeX is to
xelatex
LaTeX engine instead of pdflatex
(which oxforddown
uses by default)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?
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
呼び出し:
##################### 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
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?
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
Output created: test_Japanese_character.html
Can you show me the content of the entire R Markdown file you created, and I'll try to reproduce the error?
Do you mean this?
I put my name on the index.Rmd autohor: Author Name to my Japanese name.
output file: _main.knit.md
/Applications/RStudio.app/Contents/MacOS/quarto/bin/tools/pandoc +RTS -K512m -RTS _main.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output _main.tex --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --metadata-file /var/folders/vg/yh8xwzx52dq7dy_mzblw7dl40000gn/T//RtmpBQ1e7r/file5f057f7cea26 --embed-resources --standalone --table-of-contents --toc-depth 2 --template templates/template.tex --number-sections --highlight-style tango --pdf-engine pdflatex --biblatex --wrap preserve --lua-filter=scripts_and_filters/colour_and_highlight.lua --include-in-header /var/folders/vg/yh8xwzx52dq7dy_mzblw7dl40000gn/T//RtmpBQ1e7r/rmarkdown-str5f05df44a40.html --variable tables=yes --standalone -Mhas-frontmatter=false
警告: Package fancyhdr Warning: \fancyhead's E' option without twoside option is useless. 警告: (fancyhdr) Please consider using the
twoside' option on input line 177.
警告: LaTeX Warning: Command @.*** has changed.
警告: Check if current package is valid.
警告: Package fvextra Warning: csquotes should be loaded after fvextra, to avoid a warning from the lineno package on input line 37.
警告: Package biblatex Warning: Language 'latin' not supported.
警告: (biblatex) Using dummy definitions on input line 261.
Output created: docs/_main.pdf 警告メッセージ: 1: get_engine(options$engine) で: Unknown language engine 'yaml' (must be registered via knit_engines$set()). 2: get_engine(options$engine) で: Unknown language engine 'yaml' (must be registered via knit_engines$set()). 3: get_engine(options$engine) で: Unknown language engine 'yaml' (must be registered via knit_engines$set()).
2022/12/07 21:21、Ulrik Lyngs @.***>のメール:
Can you show me the content of the entire R Markdown file you created, and I'll try to reproduce the error?
— Reply to this email directly, view it on GitHub https://github.com/ulyngs/oxforddown/issues/42#issuecomment-1340889454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH2ZPGU5A7Y5FOXI2F3DUJ3WMB6NPANCNFSM5REQVV6Q. You are receiving this because you modified the open/close state.
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?
Oh, sorry. Thereafter I started to try to use quarto but stoped after August.
Japanese can use in the text, but not for graphs and figures.
Thanks and regards,
Kizen
2022/12/09 21:13、Ulrik Lyngs @.***>のメール:
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?
— Reply to this email directly, view it on GitHub https://github.com/ulyngs/oxforddown/issues/42#issuecomment-1344234119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH2ZPGQLZFCV3MJOYM3HDHDWMMO63ANCNFSM5REQVV6Q. You are receiving this because you modified the open/close state.
I would like to use it for my thesis in Japanese, but to output it in Japanese on your template, it was garbled.
I have just started using Rstudio and found your excellent template in RMarkdown and would be happy to modify it to my graduate school of Health and Sports Sciences format for use.