RMarkdown does not display Japanese when outputting PDF

Asked 2 years ago, Updated 2 years ago, 32 views

I'm practicing RMarkdown, but when I output it as a PDF,
I'm having trouble with the problem of not displaying Japanese in the formula.
Could someone tell me how to solve this problem?

 title: "Teaching: Introduction to Multivariate Analysis"
author: "practice"
date: "2021/5/6"
output:
  pdf_document:
    latex_engine —xelatex
    number_sections —true
mainfont —Hiragino Kaku Gothic Pro
{r setup, include=FALSE}
knitr::opts_chunk$set(fig.width=8,fig.height=5)
library(tidyverse)
library(socviz)
library (ggplot2)
library(gapminder)
library(tidyr)
library (lattice)
{reading}
data<-read.csv("~/Documents/r_sample/R_Multivariate Analysis 0726/Chapter 03/Customer Satisfaction Data.csv", fileEncoding="CP932")

Problem: I understand how to type formulas, but I can't see Japanese well.

$$
Number of customers = α+ 立地 location satisfaction + error
$$

r

2022-09-29 21:53

1 Answers

Thank you!This is Big Sur 11.2.3 on the M1 chip.I don't know if the Tex environment is the answer, but I added TextLive 2021.

If you follow the instructions, the following error will appear.

Enter a description of the image here

After correcting the LaTeX writing method normally, it appears, and the problem has been solved!

I'm a beginner at LaTeX, so I'm embarrassed...Thank you for letting me know!


2022-09-29 21:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.