1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 手把手教你在Linux上安装LaTeX环境

手把手教你在Linux上安装LaTeX环境

时间:2020-11-29 03:56:47

相关推荐

手把手教你在Linux上安装LaTeX环境

Original artical url:

/linux/linux-unix/280361.html

手把手教你在Linux下安装LaTeX环境

一、LaTeX简介

LaTeX(LATEX,音译“拉泰赫”)是一种基于TeX的排版系统,由美国计算机学家莱斯利·兰伯特(Leslie Lamport)在20世纪80年代初期开发,利用这种格式,即使使用者没有排版和程序设计的知识也可以充分发挥由TeX所提供的强大功能,能在几天,甚至几小时内生成很多具有书籍质量的印刷品。

LaTeX在Windows、Linux、Mac OS上都有发行版:

二、LaTeX 下载安装

首先我们下载TexLive镜像,这是推荐厦门大学开源软件镜像,上面有最新的TexLive ,下载速度也很可观。http://mirrors./CTAN/systems/texlive/Images/ 下面安装TexLive:

#cd Downloads#supasswd:# mount -t <span id="8_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="8_nwl" href="/cpro/ui/uijs.php?c=news&cf=5&ch=0&di=128&fv=11&jk=d4075488539088f&k=iso&k0=iso&kdi0=0&luki=1&n=10&p=baidu&q=v77y4_cpr&rb=0&rs=1&seller_id=1&sid=8f0839854875400d&ssp2=1&stid=0&t=tpclicked3_hc&tu=u2102575&u=http%3A%2F%2Fwww%2Eylzx8%2Ecn%2Flinux%2Flinux%2Dunix%2F280361%2Ehtml&urlid=0" target="_blank" mpid="8" style="color: rgb(1, 70, 108); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">iso</span></a></span>9660 -o loop texlive-0701.iso /mnt/mount: warning: /mnt/ seems to be mounted read-only.#./install-tl

三、LaTeX 配置 首先我们从别处拷贝需要的字体,比如从Windows的C:/Windows/Fonts下拷贝最常使用的几种字体: msyh.ttf(微软雅黑) simfang.ttf(仿宋) simhei.ttf(黑体) simkai.ttf(楷体) simsun.ttc(宋体)

比如说我们拷贝到Linux的/home/username/Fonts目录下: 接下来打开终端进行配置:

# mkdir /usr/share/fonts/winfonts/# cp ~/Fonts/msyh.ttf /usr/share/fonts/winfonts/ # cp ~/Fonts/simfang.ttf /usr/share/fonts/winfonts/ # cp ~/Fonts/simhei.ttf /usr/share/fonts/winfonts/ # cp ~/Fonts/simkai.ttf /usr/share/fonts/winfonts/ # cp ~/Fonts/simsun.ttf /usr/share/fonts/winfonts/

如果需要更多的字体,使用同样办法拷贝即可。 拷贝完成之后一定要注意使用chmod给字体权限:

# sudo chmod a+x /usr/share/fonts/winfonts/

接下来再进行下列操作

# cd /usr/share/fonts/winfonts/# mkfontscale # mkfontdir # fc-cache

以上命令的作用分别是:为X字体创建可裁剪的索引,在一个目录中创建X字体文件的索引,建立字体信息缓存文件。

接下来,使用fc-list 命令查看:

# sudo fc-list :lang=zh-cnNSimSun,新宋体:<span id="6_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="6_nwl" href="/cpro/ui/uijs.php?c=news&cf=5&ch=0&di=128&fv=11&jk=d4075488539088f&k=style&k0=style&kdi0=0&luki=7&n=10&p=baidu&q=v77y4_cpr&rb=0&rs=1&seller_id=1&sid=8f0839854875400d&ssp2=1&stid=0&t=tpclicked3_hc&tu=u2102575&u=http%3A%2F%2Fwww%2Eylzx8%2Ecn%2Flinux%2Flinux%2Dunix%2F280361%2Ehtml&urlid=0" target="_blank" mpid="6" style="color: rgb(1, 70, 108); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">style</span></a></span>=RegularKaiTi,楷体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,ArruntaSimSun,宋体:style=RegularUnibit:style=RegularWenQuanYi Zen Hei,文泉驛正黑,文泉驿正黑:style=RegularSimHei,黑体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,ArruntaWenQuanYi Zen Hei Mono,文泉驛等寬正黑,文泉驿等宽正黑:<span id="7_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="7_nwl" href="/cpro/ui/uijs.php?c=news&cf=5&ch=0&di=128&fv=11&jk=d4075488539088f&k=style&k0=style&kdi0=0&luki=7&n=10&p=baidu&q=v77y4_cpr&rb=0&rs=1&seller_id=1&sid=8f0839854875400d&ssp2=1&stid=0&t=tpclicked3_hc&tu=u2102575&u=http%3A%2F%2Fwww%2Eylzx8%2Ecn%2Flinux%2Flinux%2Dunix%2F280361%2Ehtml&urlid=0" target="_blank" mpid="7" style="color: rgb(1, 70, 108); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">style</span></a></span>=RegularWenQuanYi Zen Hei Sharp,文泉驛點陣正黑,文泉驿点阵正黑:style=Regular

最后,咱们根据fc-list命令显示的信息修改文件/usr/local/texlive//texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def

# cat /usr/local/texlive//texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def% ctex-xecjk-winfonts.def: Windows 的 xeCJK 字体设置,默认为六种中易字体 % <span id="5_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="5_nwl" href="/cpro/ui/uijs.php?c=news&cf=5&ch=0&di=128&fv=11&jk=d4075488539088f&k=vim&k0=vim&kdi0=0&luki=9&n=10&p=baidu&q=v77y4_cpr&rb=0&rs=1&seller_id=1&sid=8f0839854875400d&ssp2=1&stid=0&t=tpclicked3_hc&tu=u2102575&u=http%3A%2F%2Fwww%2Eylzx8%2Ecn%2Flinux%2Flinux%2Dunix%2F280361%2Ehtml&urlid=0" target="_blank" mpid="5" style="color: rgb(1, 70, 108); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">vim</span></a></span>:ft=tex \setCJKmainfont[BoldFont={SimHei},ItalicFont={[SIMKAI.TTF]}]{SimSun}\setCJKsansfont{SimHei}\setCJKmonofont{[SIMFANG.TTF]}\setCJKfamilyfont{zhsong}{SimSun}\setCJKfamilyfont{zhhei}{SimHei}\setCJKfamilyfont{zhkai}{[SIMKAI.TTF]}\setCJKfamilyfont{zhfs}{[SIMFANG.TTF]}% \setCJKfamilyfont{zhli}{LiSu}% \setCJKfamilyfont{zhyou}{YouYuan}\newcommand*{\songti}{\CJKfamily{zhsong}} % 宋体\newcommand*{\heiti}{\CJKfamily{zhhei}} % 黑体\newcommand*{\kaishu}{\CJKfamily{zhkai}} % 楷书\newcommand*{\fangsong}{\CJKfamily{zhfs}} % 仿宋% \newcommand*{\lishu}{\CJKfamily{zhli}} % 隶书% \newcommand*{\youyuan}{\CJKfamily{zhyou}} % 幼圆\endinput

咱需要对红色标记的做修改,修改成fc-list上与楷体(或者其他)相关的,我这为KaiTi,有的环境上为KaiTi_GB2312,修改需要根据环境上fc-list打印的信息而定。 修改后,咱再来看看:

# cat /usr/local/texlive//texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def% ctex-xecjk-winfonts.def: Windows 的 xeCJK 字体设置,默认为六种中易字体 % <span id="4_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="4_nwl" href="/cpro/ui/uijs.php?c=news&cf=5&ch=0&di=128&fv=11&jk=d4075488539088f&k=vim&k0=vim&kdi0=0&luki=9&n=10&p=baidu&q=v77y4_cpr&rb=0&rs=1&seller_id=1&sid=8f0839854875400d&ssp2=1&stid=0&t=tpclicked3_hc&tu=u2102575&u=http%3A%2F%2Fwww%2Eylzx8%2Ecn%2Flinux%2Flinux%2Dunix%2F280361%2Ehtml&urlid=0" target="_blank" mpid="4" style="color: rgb(1, 70, 108); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">vim</span></a></span>:ft=tex \setCJKmainfont[BoldFont={SimHei},ItalicFont={KaiTi}]{SimSun}\setCJKsansfont{SimHei}\setCJKmonofont{[SIMFANG.TTF]}\setCJKfamilyfont{zhsong}{SimSun}\setCJKfamilyfont{zhhei}{SimHei}\setCJKfamilyfont{zhkai}{KaiTi}\setCJKfamilyfont{zhfs}{[SIMFANG.TTF]}% \setCJKfamilyfont{zhli}{LiSu}% \setCJKfamilyfont{zhyou}{YouYuan}\newcommand*{\songti}{\CJKfamily{zhsong}} % 宋体\newcommand*{\heiti}{\CJKfamily{zhhei}} % 黑体\newcommand*{\kaishu}{\CJKfamily{zhkai}} % 楷书\newcommand*{\fangsong}{\CJKfamily{zhfs}} % 仿宋% \newcommand*{\lishu}{\CJKfamily{zhli}} % 隶书% \newcommand*{\youyuan}{\CJKfamily{zhyou}} % 幼圆\endinput

至此,配置完毕。

我在使用xelatex时会有提示,xelatex :command not found 之类的信息,之后通过如下手动配置得以正常使用: #vim/etc/bash.bashrc

在最后添加一行: PATH=$PATH : /usr/local/texlive//bin/i386-linux/ (这个路径最好一步一步走,使用自动补全找到,不过一般差异为最后,64位机器为x86_64-linux)

#source /etc/bash.bashrc

之后关闭所有终端,即可!

四、LaTeX学习帮助

LaTeX 学习文档下载: /detail/longerzone/4703133

/detail/longerzone/4703238

参考文档

【1】/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf

【2】http://www.aboutlinux.info//12/adding-windows-fonts-in-linux.html

【3】/defeattroy/blog/item/5df1ffcac3348415be09e6de.html

【4】http://learningloong./blog/static/162308124731102219361/

【5】/viewtopic.php?f=35&t=350882

【6】/defeattroy/article/details/7581846

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。