linux下安装texlive及中文环境配置,及texmaker安装

来源:互联网 发布:淘宝助理找不到图片 编辑:程序博客网 时间:2024/05/20 23:33

安装texlive

到 texlive官网 下载texlive.iso.

下载完成后:

bash$ sudo mount texlive.iso /mnt...bash$ cd /mntbash$ ./install-tl# 出现选项后,输入I直接安装(也可以更改选项).安装完成后bash$ cd /bash$ sudo umount /mnt

环境变量:

# 在用户的~/.bashrc或/etc/profile中加入如下语句:PATH=/usr/local/texlive/2017/bin/x86_64-linux:$PATHexport PATHMANPATH=/usr/local/texlive/2017/texmf-dist/doc/man:$MANPATHexport MANPATHINFOPATH=/usr/local/texlive/2017/texmf-dist/doc/info:$INFOPATHexport INFOPATH# 这里的路径可能与安装的版本有关.

至此texlive安装完成.


texlive中文环境配置

安装字体

从Windows系统中拷贝宋体(simsun.ttf/c)、仿宋(simfang.ttf)、黑体(simhei.ttf)、楷体(simkai.ttf)、隶书(simli.ttf)、幼圆(simyou.ttf)出来 . 将这些文件放入/usr/share/fonts/WinFonts/目录 .

sudo mkdir /usr/share/fonts/WinFonts/cd /usr/share/fonts/WinFontssudo chmod 777 *sudo mkfontscalesudo mkfontdirsudo fc-cache -fsvfc-list :lang=zh-cn     # 检查结果中是否有simsun,simfang等字体.

配置xelatex的字体配置文件

为了进行配置,xetex 安装后创建 /usr/local/texlive/2017/texmf-var/fonts/conf/texlive-fontconfig.conf 配置文件。
在整个系统中使用 TEX Live 的字体:

sudo cp /usr/local/texlive/2017/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.confsudo fc-cache -fsv

编译一个中文pdf试试

例:用UTF-8 No BOM的模式写一个tex文件test.tex ,内容如下:

\documentclass{article}      % Specifies the document class\title{中文标题}  % Declares the document's title.\author{Tarrega}      % Declares the author's name.\date{Jul 20, 2015}      % Deleting this command produces today's date.\usepackage{fontspec} % use to set font\usepackage{xeCJK} % seperate the english and chinese\setCJKmainfont{SimSun}\XeTeXlinebreaklocale "zh"  % Auto linebreak for chinese\XeTeXlinebreakskip = 0pt plus 1pt % Auto linebreak for chinese\begin{document}             % End of preamble and beginning of text.\maketitle                   % Produces the title.中文 how to 中文. \section{第一章}   终于搞定中文了。\end{document}               % End of document.

然后xelatex test.tex 就能生成 .pdf 文件.


安装texmaker

sudo apt-get install texmaker