Source: http://blog.chinaunix.net/u/25605/showart_2100398.html
Introduction Good article: TeX, LaTeX, texlive summary
Note Details: http://visayafan.com/others/o/latex-lyx.html#sec-14-3
First, install TEXLIVE+LATEX+CJK:
Open the terminal, install the following texlive and some commonly used latex macro package (can be modified according to their own needs):
sudo apt-get install texlive texlive-math-extra texlive-latex-base Texlive-latex-extra texlive-latex-recommended texlive-pictures texlive-science Latex-beamer
If the hard drive is plentiful, a direct full installation can also:
sudo apt-get install texlive-full Latex-beamer
After installation, you can install CJK related packages, if only need to obtain Chinese support, then execute:
sudo apt-get install Latex-cjk-chinese ttf-arphic-* hbf-*
Otherwise, it is recommended to install Latex-cjk-all for full support.
Second, the generation of Chinese font package
After installing TEXLIVE+CJK, you also need to install a software ──fontforge to generate fonts:
sudo apt-get install FontForge
Well, what we've done in the front is a standard Debian installation, and if you don't need one day, just remove it and install it.
Before creating a font, prepare the font file you want to generate: Simsun.ttc,simhei.ttf (to download it yourself, or to find it from Windows C), for example, SIMSUN.TTC (Arial).
When you're ready, download the following package and unzip it to a place like your home directory ~/font:
font.tar.bz2
Then copy the SIMSUN.TTC into the ~/font, and execute the following command to generate the font map:
CD ~/font time fontforge-script subfonts.pe SIMSUN.TTC song UNICODE.SFD
Add time is to calculate the timing, because it takes a bit longer, and in my Core 2 Duo T5500, it took 40 minutes to generate the song, and it took 24 minutes to generate HEI for reference only.
Font generation OK, then create a description file.
Under ~/font, create a Makemap file with the following contents (no spaces):
For I in *.TFM does cat >> song.map << eof ${I%.TFM} ${I%.TFM} < ${I%.TFM}.PFB eof done
Then execute under Terminal: chmod +x makemap Let the file plus execute permission, and finally execute:
./makemap
Then create a C70SONG.FD file:
% This is the C70SONG.FD for CJK package. % created by Edward G.J Lee % modify by Yue Wang \providesfile{c70song.fd} \declarefontfamily{c70}{song} {\hyphenchar \font\[email protected]} \declarefontshape{c70}{song}{m}{n}{<-> CJK * song}{} \declarefontshape{c70}{song}{bx}{n}{<-> CJKb * Song}{\cjkbold} \endinput
OK, the relevant files have been generated and the fonts are copied to take effect.
Execute the following command to generate a hidden personal Tex configuration in your home directory, or delete it if you don't need it any day:
Mkdir-p ~/.texmf-var/fonts/map/dvips/cjk mkdir-p ~/.texmf-var/fonts/tfm/cjk/song mkdir-p ~/.texmf-var/ Fonts/type1/cjk/song mkdir-p ~/.texmf-var/tex/latex/cjk/utf8
Once you've built this list of layers, copy the fonts you just created.
CP ~/font/song.map ~/.TEXMF-VAR/FONTS/MAP/DVIPS/CJK CP ~/FONT/*.TFM ~/.texmf-var/fonts/tfm/cjk/song CP ~/ FONT/*.PFB ~/.texmf-var/fonts/type1/cjk/song CP ~/font/c70song.fd ~/.texmf-var/tex/latex/cjk/utf8
After the copy is finished, execute the command to flush the cache and let it take effect:
sudo texhash updmap--enable Map song.map
If it's all in order, let's test if we can use the song body we installed.
Edit this file anywhere, then save as Test.tex, support UTF-8 format:
\documentclass{article} \usepackage{cjkutf8} \begin{document} \begin{cjk}{utf8}{song} Hello! This is the TEXLIVE+CJK environment under Ubuntu! \END{CJK} \end{document}
To generate PDF documents separately and use evince to view documents:
Pdflatex Test.tex evince test.pdf
Line break command \ \: Wrap. \\[offset]: line break, and the line spacing to the next line is the original line spacing +offset. \newline: Same as \ \. \linebreak: Force line break, which differs from \newline for the current line of \linebreak. Segmented command \par: segment.
Paging Command\newpage: Paging command. \clearpage: Similar to \newpage. We will join \clearpage at the end of the environment when using CJK environments. The simplest way to indent the first line is to set the length of the \parindent: \setlength{\parindent}{length}, \setlength{\parindent}{2em} If you want the first line to indent two kanji distances. If you are in a CJK environment, you can implement the first line indentation immediately after \begin{cjk}{gbk}{song}, followed by \cjkindent. The default first paragraph does not indent, and you can use \usepackage{indentfirst} if you want to indent the first line. If you want to indent a section without first line, you can add \noindent to the paragraph before it. If you want the entire article to be indented in the first line, then: \setlength{\parindent}{0pt} Note: In LaTeX, a carriage return represents a space, and two carriage returns represent a segment. In practice, we are expanding according to the following template:
\DOCUMENTCLASS[12PT,A4PAPER]{ARTICLE}\USEPACKAGE{CJK} % import CJK macro package \setlength{\parskip}{10pt} % set partial paragraph interval \begin{document}\begin{cjk *}{gbk}{song}% start CJK Environment \cjktilde % redefine ~ " % Set first paragraph indent this paper reflects on the history and development of the LaTeX P Roject public License (LPPL). \par % Here is the fragment \noindent (here is not the first line indent) in late June, the TUG
2010 Conference was held in San Francisco to great success. \CLEARPAGE\END{CJK *}% end CJK Environment \end{document}
\SETLENGTH{\PARSKIP}{10PT}: The paragraph interval is the sum of \lineskip and \parskip, where the value of \parskip is set to increase the interval of the paragraphs. \cjkindent: The first line indent in a CJK environment.
Getting started with the Linux system latex installation tutorial