# User:Khaosgrille/Draft:How to read and write in Chinese

This is a draft. Visit my Mainpage to see the TODO

This guide aims at explaining how to read and write in Chinese on a non-Chinese system. Please feel free to amend it based on personal knowledge or experience.

## Requirements

In order to support Chinese language and characters, a number of required tools, libraries and capabilities need to be installed on the system.

### Chinese fonts

Most non-Chinese systems have no Chinese fonts installed. Whenever a user tries to enter Chinese characters from the keyboard, they will only see small rectangle boxes in place of the characters on the screen.

### Input method

To read and write in Chinese, the first thing that is needed is a way to enter Chinese characters with the keyboard. This is done via a piece of software usually called an input method. At the moment, for the Chinese language, there are 3 kinds of common methods -- phonitc,shape based and a hybrid once. https://en.wikipedia.org/wiki/Chinese_input_methods_for_computers. The most common one are wubi and pinyin.

Note
It is not the purpose of this guide to describe in detail how the "pinyin" or "wubi" input methods work. Please refer to the documentation of these software components or other "other sources"

### IME

On top of this users also need a way to switch from the input method normally used for the primary language to the one needed for the Chinese language. This functionality is provided by another piece of software called an IME (Input Method Editor) such as app-i18n/ibus, app-i18n/scim or app-i18n/fcitx. fcitx sunpinyin working, table not yet ibus not confirmed yet scim not confirmed yet

Once installed, this allows users to switch from one language's input method to the Chinese input method using a key combination or using the mouse to select a relevant icon in the icon tray.

## Installation

### Chinese fonts

As a minimum, install the <placeholder> media-fonts/<placeholder> package.

root #emerge --ask <placeholder>

Additionally, the following packages are also available:

### Input tools

It is recommended to use fcitx instead of scim or ibus.

To install fcitx, install app-i18n/fcitx:

root #emerge --ask fcitx

#### sunpinyin

sunpinyin is provided through the app-i18n/fcitx-sunpinyin package.

Note
pinyin has no steep learning curve.

#### Launching the fcitx daemon at login time

FILE ~/.xprofile
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx


This will allow the fcitx daemon to start at login time.

#### Configuring

To configure the fcitx Input Method Editor, use the following media-fonts/app-i18n/fcitx-configtool package for graphical configuration.

### Latex

Here are some additional requirements to write Latex files in Chinese.

#### CJK and xetex support

In order to write Chinese chunks in Latex files, add support for CJK languages and for [xetex] in Texlive.

This can be accomplished by adding or modifying the following lines in /etc/portage/package.use:

FILE /etc/portage/package.use/latexEnabling cjk and xetex support
app-text/texlive cjk xetex
app-text/texlive-core cjk xetex

Then reinstall the packages:

root #emerge --ask --newuse app-text/texlive app-text/texlive-core

Here is a working short LaTeX sample:

FILE chinese.tex
\documentclass{article}
\usepackage{CJKutf8}
\usepackage{color}

\begin{document}

\begin{CJK}{UTF8}{zhsong}
\section{One simple example}
\textcolor{red}{你好世界}
\\

\\
But I can also write with latin characters
\end{CJK}

\end{document}

Note
In the \begin{CJK}{UTF8}{zhsong} command in the example above, the third argument defines the font. Here {zhsong} is used for Simsun.

#### Editor configuration

To compile and visualize the output of the sample above Texmaker or Texstudio editor needs to be configured properly.

Open Texmaker, and go to Options -> Configure Texmaker. Under the Commands tab change the following:

• At the LaTeX line, change "latex" with "platex".
• At the Dvipdfm line, change "divipdfm" with "dvipdfmx".

Through the Fast compile tab, choose "Latex + Dvipdfm + View PDF".

Finally go to the Editor tab, choose UTF8 encoding and deselect On the fly on the dictionary line.