-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathutf8.tex
38 lines (24 loc) · 1.26 KB
/
utf8.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
\documentclass{article}
% Package for CJK font support in XeLaTeX
\usepackage{xeCJK}
% Package for printing ``XeLaTeX''
\usepackage{hologo}
% Package for stacking of characters for ruby
\usepackage{mathtools}
\title{中文}
\author{Overleaf developers and Dainius Masiliūnas}
\begin{document}
\maketitle
\section{前言}
這是一些文字。
這是繁體中文。
Math works as usual:
$$ e = mc^2 $$
\section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments. Note that this requires compiling with \hologo{XeLaTeX} or \hologo{LuaTeX}.
\section{Ruby}
You can also write ruby (also known as $\stackrel{\text{furigana}}{\text{ふりがな}}$), where e.g. $\stackrel{\text{pīnyīn}}{\text{拼音}}$ is written at the top and $\stackrel{\text{hànzì}}{\text{漢字}}$ is at the bottom.
We can make it more concise by defining our own command.
\newcommand{\ruby}[2]{\stackrel{\text{#1}}{\text{#2}}}
That way, we can just use \texttt{\textbackslash{ruby}} like this: $\ruby{Three Kingdoms}{三國}$ is a famous time period, known for its heroes $\ruby{Cao}{曹}$ $\ruby{Cao}{操}$, $\ruby{Liu}{劉}$ $\ruby{Bei}{備}$ and $\ruby{Sun}{孫}$ $\ruby{Quan}{權}$.
\end{document}