"Latex Primer" 02, CJK Environment Explained

Source: Internet
Author: User
Introduction
LaTeX is invented by foreigners, so it is not supported in Chinese by default. So how to use latex to write Chinese documents. Then use CJK. CJK was developed by Werner Lemberg, and we can display Chinese in latex files as long as we use the CJK macro package. About CJK Configuration do not need to do our own, Ctex have been configured, we just introduce a macro package.
Introduction to CJK use
1 2 3 4 5 6 7 8 9 10 \documentclass[12pt,a4paper]{article} \USEPACKAGE{CJK} \begin{document} \begin{cjk*}{gbk}{song} \CJKtilde \ Cjkindent Hello everyone, I am ~\latex{}.
\clearpage \end{cjk*} \end{document}

Line 1th: Ordinary article type, the default font size is 12pt, the article is a single column display, paper for A4 paper. Line 2nd: Import CJK Macro Package, CJK Macro Package provides two environments: CJK Environment and CJK* Environment, the difference between the two environments: for Chinese characters behind the space, the former does not ignore, the latter ignore, we recommend the use of cjk* environment. Line 3rd: Start the document environment. Line 4th: Start the cjk* environment, the default encoding is GBK, the default font is Arial. Line 5th: Redefine the "~" symbol so that "~" is set to a reasonable interval.
Line 6th: Indent in the first line. Line 7th: ~ Represents a space, the general Chinese and English are to be left blank, \latex{} for the name of LaTeX display. Line 8th: Usually when we use CJK environment, we need to add this sentence, because it can lead to some unexpected errors, which are mentioned later in this article. Line 9th: End the cjk* environment. Line 10th: End document Environment.
Small details
\cjkspace command: Switch from the cjk* environment to the CJK environment. \cjknospace command: Switch from CJK to cjk* environment.

Common errors
Error: Argument of \cjk@xx have an extra}
The number of words over a certain limit will be reported this error, the solution is as follows:
1.\begin{cjk*}{gbk}{kai} must be placed behind \begin{document} (not necessarily next to each other). 2.\end{cjk*} to add a \clearpage



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.