{"id":4485,"date":"2015-03-05T00:20:58","date_gmt":"2015-03-04T16:20:58","guid":{"rendered":"https:\/\/lttt.blog.ustc.edu.cn\/?p=4485"},"modified":"2015-03-05T00:20:58","modified_gmt":"2015-03-04T16:20:58","slug":"%e6%95%99%e7%a8%8b%e5%9c%a8linux%ef%bc%88ubuntudebian%ef%bc%89%e4%b8%ad%e7%bc%96%e8%af%91%e4%b8%ad%e6%96%87tex%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/lttt.vanabel.cn\/?p=4485","title":{"rendered":"\u6559\u7a0b:\u5728Linux\uff08Ubuntu\/Debian\uff09\u4e2d\u7f16\u8bd1\u4e2d\u6587TeX\u6587\u4ef6"},"content":{"rendered":"<p>\\documentclass{article}<br \/>\n\\begin{document}<br \/>\n\\title{Texlive on Linux with Chinese support}<br \/>\n\\author{Van Abel}<br \/>\n\\begin{abstract}<br \/>\n\u672c\u6559\u7a0b\u5e76\u975e\u624b\u628a\u624b\u7684\u6559\u4f60\u5982\u4f55\u5728Linux\u673a\u5668\u4e0a\u7f16\u8bd1\u4e2d\u6587\u6587\u4ef6. \u800c\u662f\u6211\u4f5c\u4e3a\u5c1d\u8bd5\u7f16\u8bd1<a href=\"https:\/\/code.google.com\/p\/ustcthesis\/\">ustcthesis<\/a>\u7684\u4e00\u4e2a\u5b66\u4e60\u8bb0\u5f55.<br \/>\n\\end{abstract}<br \/>\n\\tableofcontents<br \/>\n\\section{Install of texlive}<br \/>\nA lot of people will try to tell you install texlive by hand (download the texlive2014.iso), but I find it is about 2.5G, so why not just install texlive form the apt-get?<\/p>\n<p>I follow <a href=\"http:\/\/my.oschina.net\/u\/1037903\/blog\/376446\">here<\/a>:<\/p>\n<pre>apt-get install texlive \napt-get install texlive-xetex \n<\/pre>\n<p>of course this will not make chinese support for texlive.<br \/>\n\\section{Chinese Support}<br \/>\nThere are two method of texlive to support chinese. One is <code>xecjk method<\/code>, the other is <code>cjk<\/code>.<br \/>\n\\subsection{xecjk method}<\/p>\n<pre>\\documentclass{article}\n\\usepackage{xeCJK}\n\\setCJKmainfont{Adobe Song Std}\n\\begin{document}\nhi, this is xelatex!\n\n\u8fd9\u662f\u4e2d\u6587\u6d4b\u8bd5\uff01\n\\end{document}\n<\/pre>\n<p><!--more--><br \/>\nThe results is, after compile as <code>xelatex test_zh.tex<\/code>, <a href=\"https:\/\/lttt.vanabel.cn\/wp-content\/uploads\/2015\/03\/test_zh.pdf\">test_zh.pdf<\/a><br \/>\n\\subsubsection{File used}<br \/>\n\\begin{enumerate}<br \/>\n\\item The <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/test_zh.tex\">test_zh.tex<\/a> source file<br \/>\n\\item Need to download <a href=\"https:\/\/lttt.vanabel.cn\/wp-content\/uploads\/2015\/03\/Adobe.7z\">Adobe.7z<\/a> Adobe Fonts and <code>7zr e Adobe.7z -w \/usr\/share\/fonts\/winfonts\/<\/code> (create &#8216;winfonts&#8217; directory first)<br \/>\n\\item Refreash your font cache as <a href=\"http:\/\/my.oschina.net\/u\/1037903\/blog\/376446\">here<\/a>.<br \/>\n\\item Need to modify <code>\/usr\/share\/texlive\/texmf-dist\/tex\/latex\/ctex\/fontset\/ctex-xecjk-winfonts.def<\/code> (please adapt it to your installation of texlive) as in the file <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/ctex-xecjk-winfonts.def\">ctex-xecjk-winfonts.def<\/a><br \/>\n\\end{enumerate}<br \/>\n<strong>If you have other problems, please take a look at the end of this post!<\/strong><br \/>\n\\subsection{cjk method}<\/p>\n<pre>\\documentclass[UTF8]{ctexart}\n\n\\begin{document}\nHi, Ctex!\n\u4f60\u597d\uff0c Ctex\uff01\n\\end{document}\n<\/pre>\n<p>firstly, let us compile is as <code>latex test_ctex.tex<\/code>, this will output <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/test_ctex.dvi\">test_ctex.dvi<\/a><br \/>\nSecondly, in order to make pdflatex work, we need the following:<br \/>\n\\subsubsection{File used}<br \/>\n\\begin{enumerate}<br \/>\n\\item The <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/test_ctex.tex\">test_ctex.tex<\/a> source file<br \/>\n\\item Need to download <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/Win7Fonts.7z\">Win7Fonts.7z<\/a> and extract to the same dir as before<br \/>\n\\item Need to modify the file <code>\/usr\/share\/texlive\/texmf-dist\/tex\/generic\/zhmetrics\/zhwinfonts.tex<\/code> as <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/zhwinfonts.tex\">zhwinfonts.tex<\/a><br \/>\n\\item Need to add <code>export OSFONTDIR=\/usr\/share\/fonts\/winfonts\/<\/code> in <code>~\/.bash_profile<\/code><br \/>\n\\end{enumerate}<br \/>\nAnd finally, we will get, after complie as <code>pdflatex test_ctex.tex<\/code> <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/test_ctex.pdf\">test_ctex.pdf<\/a><br \/>\n\\section{Reference}<br \/>\n\\begin{enumerate}<br \/>\n\\item <a href=\"http:\/\/my.oschina.net\/u\/1037903\/blog\/376446\">Ubuntu\u4e0b\u5b89\u88c5TeX Live\u5e76\u914d\u7f6e\u4e2d\u6587\u652f\u6301<\/a><br \/>\n\\item <a href=\"https:\/\/code.google.com\/p\/ctex-kit\/wiki\/UnixFonts\">UnixFonts<\/a><br \/>\n\\item <a href=\"http:\/\/tex.stackexchange.com\/a\/117131\/19832\">$OSFONTDIR on OSX<\/a><br \/>\n\\end{enumerate}<br \/>\n\\section{Techological Remark}<br \/>\n\\begin{itemize}<br \/>\n\\item If there are some missing sty files, try to use<br \/>\n<code><br \/>\napt-cache search the-missing-sty | grep tex<br \/>\n<\/code><br \/>\nwhere <code>the-missing-sty<\/code> are replaced by the sty file name<br \/>\nand then use <code>sudo apt-get install the-find-package<\/code> to install.<\/p>\n<p>I finally installed the following package<br \/>\n<code><br \/>\nsudo apt-get install latex-cjk-chinese texlive-bibtex-extra texlive-math-extra texlive-science texlive-science-doc texlive-latex-extra<br \/>\n<\/code><br \/>\n\\item you can also install the missing package by<br \/>\n<code>tlmgr install the-missing-package<\/code><br \/>\n\\item If tlmgr report the error:<br \/>\n<em>cannot setup TLPDB in \/root\/texmf at \/usr\/bin\/tlmgr line 5336.<\/em><br \/>\nplease try <code>tlmgr init-usertree<\/code>, I get the solution from <a href=\"http:\/\/tex.stackexchange.com\/a\/147090\/19832\">here<\/a><br \/>\n\\item If tlmgr report the error:<br \/>\n<code>\/usr\/bin\/tlmgr: Please install xzdec and try again.<\/code><br \/>\nThen try<br \/>\n<code>sudo apt-get install xzdec<\/code><br \/>\n\\item If you find some package can&#8217;t be installed successfully by <em>tlmgr<\/em>, then try to install it by hand. This is not so hard at all, as an example, let me show you how to install <em>bbm.sty<\/em><br \/>\n\\begin{enumerate}<br \/>\n\\item Firstly, just go <a href=\"http:\/\/www.ctan.org\/\">http:\/\/www.ctan.org\/<\/a> to search bbm at the top bar<br \/>\n\\item It will show you that there are two packages, one is the font package <em>bbm<\/em>, and the other is the macros package <em>bbm-macros<\/em>, we need to install both of them<br \/>\n\\item click the link of font package bbm, we can see the sources is <code>\/fonts\/cm\/bbm<\/code>, then download all the package by click the link at the bottom, to the directory <code>~\/texmf\/fonts\/cm\/bbm<\/code>, maybe you have already noticed that we put the source in the local directory <em>texmf<\/em>.<br \/>\n\\item Refreash the database of texlive by the command <code>mktexlsr<\/code>, which will tell texlive where the package is located.<br \/>\n\\item Similarly to install the macro package bbm-macros.<br \/>\n\\end{enumerate}<br \/>\n\\end{itemize}<br \/>\n\\section{Test of ustcthesis}<br \/>\nAt last, you can compile <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/ustcthesis-108a0e17c3c3_Linux.tar.gz\">ustcthesis<\/a> easily, The uploading file has correct the error mentioned <a href=\"http:\/\/bbs.ctex.org\/forum.php?mod=viewthread&amp;tid=78610\">here<\/a>. which is caused by the too old version of ctex, I think.<\/p>\n<p>And how about have a look at the final result: <a href=\"https:\/\/lttt.blog.ustc.edu.cn\/wp-content\/uploads\/2015\/03\/main.pdf\">preview of ustcthesis<\/a>.<br \/>\n\\end{document}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\\documentclass{article} \\begin{document} &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/lttt.vanabel.cn\/?p=4485\"> <span class=\"screen-reader-text\">\u6559\u7a0b:\u5728Linux\uff08Ubuntu\/Debian\uff09\u4e2d\u7f16\u8bd1\u4e2d\u6587TeX\u6587\u4ef6<\/span> \u9605\u8bfb\u66f4\u591a &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[276,540,646,660],"class_list":["post-4485","post","type-post","status-publish","format-standard","hentry","category-latex","tag-ctex","tag-linux","tag-texlive","tag-ustcthesis"],"_links":{"self":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts\/4485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4485"}],"version-history":[{"count":0,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts\/4485\/revisions"}],"wp:attachment":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}