Introduction latex was invented by foreigners, so it does not support Chinese by default. How can we use latex to write Chinese documents? Use CJK. CJK is developed by Werner Lemberg. We only need to use the CJK macro package to display Chinese characters in the latex file. We do not need to configure CJK by ourselves. ctex has been configured. We only need to introduce the macro package.
CJK Introduction
12345678910 |
\ Documentclass [12pt, a4paper] {Article} \ usepackage {CJK} \ begin {document} \ begin {CJK *} {GBK} {SONG} \ cjktilde \ cjkindent Hello everyone, I am ~ \ Latex {}. \ Clearpage \ end {CJK *} \ end {document} |
Row 3: Common Article type. The default font size is 12pt. The text is displayed on the "paper" tab and A4 paper. Row 2nd: imports the CJK macro package. The CJK macro package provides two environments: the CJK environment and the CJK * environment. The differences between these two environments are as follows: for spaces after Chinese characters, the former is not ignored, and the latter is ignored. We recommend that you use the CJK * environment. Row 3rd: starts the document environment. Row 4th: starts the CJK * environment. The default encoding is GBK and the default font is. Row 3: redefinition "~ "Symbol to make" ~" Set to a reasonable interval.
Row 3: indent the first line. Row 3 :~ It indicates a space. Generally, a space is left between Chinese and English. \ latex {} indicates the latex name. Row 8th: This sentence is usually added when we use the CJK environment, because it may lead to unexpected errors, which will be mentioned below. Row 3: end the CJK * environment. Row 3: end the document environment. Small details \ cjkspace command: switch from the CJK * environment to the CJK environment. \ Cjknospace command: switch from the CJK environment to the CJK * environment. Common Errors
Error: argument of \ CJK @ XX has an extra}
If the number of words exceeds a certain limit, this error is reported. The solution is as follows:
1. \ begin {CJK *} {GBK} {Kai} must be placed behind \ begin {document} (not necessarily next ). 2. Add \ clearpage to \ end {CJK *}.