Ubuntu 安裝TeXLive 2018並完成宏包更新 (部分截圖和代碼爲2016版本)

TeXLive在CTAN最新版本下載地址html

https://www.tug.org/texlive/acquire-iso.html

該頁面下有texlive最新版本ISO種子問題下載連接。linux

#2018
https://www.tug.org/texlive/files/texlive2018-20180414.iso.torrent

TeXLive在國內下載源不少,現僅以清華大學和阿里云爲例。git

https://mirrors.tuna.tsinghua.edu.cn/#
#阿里雲
https://mirrors.aliyun.com/CTAN/systems/texlive/

找到經常使用發行版 iso 和應用工具安裝包直接下載,點擊應用軟件,清華大學 TeXLive2018 下載連接以下github

#2018年新版本
https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2018-20180414.iso

阿里雲下載連接:ubuntu

http://mirrors.aliyun.com/CTAN/systems/texlive/Images/

選擇對應版本下載便可。windows

下載可使用wget下載,也能夠在Windows上面將ISO文件複製到系統目錄。網絡

下載完成就能夠掛載ISO鏡像。app

CTAN官方網站ISO掛載教程以下。編輯器

mount -t iso9660 -o ro,loop,noauto /ISOFileDictory/texlive2018-20180414.iso /mnt

本機掛載記錄以下:工具

dell@DELL-Server:~$ sudo mount -o loop texlive2018-20180414.iso /mnt/
mount: /home/dell/texlive2016.iso is already mounted
dell@DELL-Server:~$ ls /mnt/
archive      install-tl               LICENSE.CTAN  readme-html.dir    release-texlive.txt  tlpkg
autorun.inf  install-tl-advanced.bat  LICENSE.TL    readme-txt.dir     source               tl-tray-menu.exe
index.html   install-tl-windows.bat   README        README.usergroups  texlive-doc
dell@DELL-Server:~$

安裝命令

dell@DELL-Server:~$ cd /mnt/
dell@DELL-Server:/mnt$ sudo ./install-tl --gui

該命令能夠在圖形化界面下安裝。

TeXLive 2016安裝截圖

安裝過程和完成截圖以下。

安裝過程

安裝完成

安裝界面有不少安裝選項,無特殊要求直接點擊安裝texlive,等待安裝過程完成。

完成安裝後,卸載鏡像。

sudo umount /mnt

也能夠將ISO解壓後複製到Linux系統。複製文件方法這裏再也不贅述。

增長環境變量。

# TeX Live 2016
#命令能夠直接複製運行,每次運行一條命令
export TeXLiveMANPATH=/urs/local/texlive/2018/texmf-dist/doc/man
export TeXLiveINFOPATH=/usr/local/texlive/2018/texmf-dist/doc/info
#64位系統
export TeXLivePATH=/usr/local/texlive/2018/bin/x86_64-linux

具體安裝路徑請以安裝時選擇目錄爲準。

本機運行結果以下:

dell@DELL-Server:~$ export TeXLiveMANPATH=/urs/local/texlive/2018/texmf-dist/doc/man
dell@DELL-Server:~$ export TeXLiveINFOPATH=/usr/local/texlive/2018/texmf-dist/doc/info
dell@DELL-Server:~$ export TeXLivePATH=/usr/local/texlive/2018/bin/x86_64-linux
dell@DELL-Server:~$ echo $TeXLiveMANPATH
/urs/local/texlive/2018/texmf-dist/doc/man
dell@DELL-Server:~$ echo $TeXLiveINFOPATH
/usr/local/texlive/2018/texmf-dist/doc/info
dell@DELL-Server:~$ echo $TeXLivePATH
/usr/local/texlive/2018/bin/x86_64-linux
dell@DELL-Server:~$

建議安裝前將Windows字體複製到Linux,複製字體方法和複製ISO解壓後文件方法同樣,等待字體安裝完成後再安裝texlive。

在Linux系統字體目錄下建立winfonts文件夾(可選項),前提是已複製字體到Linux主機。

#建立Windows字體文件目錄,目錄名稱可自定義
dell@DELL-Server:~$ sudo mkdir /usr/share/fonts/WindowsFonts
#查看目錄
dell@DELL-Server:~$ ls /usr/share/fonts/
cmap  opentype  truetype  type1  WindowsFonts  X11

複製字體到winfonts文件夾。

dell@DELL-Server:~$ sudo cp /home/dell/Fonts/* /usr/share/fonts/WindowsFonts/
#查看字體複製狀況
dell@DELL-Server:~$ ls /usr/share/fonts/WindowsFonts/

安裝字體命令。

dell@DELL-Server:mkfontscale
dell@DELL-Server:mkfontdir
dell@DELL-Server:sudo fc-cache -fv
dell@DELL-Server:~$ sudo fc-cache -fsv
/usr/share/fonts: caching, new cache contents: 0 fonts, 6 dirs
/usr/share/fonts/WindowsFonts: caching, new cache contents: 1188 fonts, 0 dirs
/usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs
/usr/share/fonts/X11/Type1: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/X11/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/X11/misc: caching, new cache contents: 59 fonts, 0 dirs
/usr/share/fonts/X11/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs
/usr/share/fonts/cmap/adobe-cns1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-gb1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-japan1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-japan2: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-korea1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 5 dirs
/usr/share/fonts/opentype/mondulkiri: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/opentype/noto: caching, new cache contents: 36 fonts, 0 dirs
/usr/share/fonts/opentype/opendyslexic: caching, new cache contents: 9 fonts, 0 dirs
/usr/share/fonts/opentype/stix: caching, new cache contents: 29 fonts, 0 dirs
/usr/share/fonts/opentype/stix-word: caching, new cache contents: 5 fonts, 0 dirs
/usr/share/fonts/truetype: caching, new cache contents: 2 fonts, 38 dirs
/usr/share/fonts/truetype/abyssinica: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/ancient-scripts: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/arphic: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/truetype/capture-it-elementary: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/croscore: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/truetype/daniel-elementary: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/dejavu: caching, new cache contents: 21 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-guru-extra: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/freefont: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/truetype/hvd-bodedo-elementary: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/jenna-sue-elementary: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/kacst: caching, new cache contents: 15 fonts, 0 dirs
/usr/share/fonts/truetype/kacst-one: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/lao: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lato: caching, new cache contents: 18 fonts, 0 dirs
/usr/share/fonts/truetype/liberation: caching, new cache contents: 16 fonts, 0 dirs
/usr/share/fonts/truetype/limelight-elementary: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lobster-elementary: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-punjabi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/nanum: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/truetype/noto: caching, new cache contents: 175 fonts, 0 dirs
/usr/share/fonts/truetype/open-sans-elementary: caching, new cache contents: 10 fonts, 0 dirs
/usr/share/fonts/truetype/openoffice: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/operating-instructions-elementary: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/padauk: caching, new cache contents: 4 fonts, 0 dirs
/usr/share/fonts/truetype/plainblack-elementary: caching, new cache contents: 6 fonts, 0 dirs
/usr/share/fonts/truetype/raleway-elementary: caching, new cache contents: 9 fonts, 0 dirs
/usr/share/fonts/truetype/redacted-elementary: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/roboto: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/truetype/roboto/hinted: caching, new cache contents: 18 fonts, 0 dirs
/usr/share/fonts/truetype/roboto-mono-elementary: caching, new cache contents: 10 fonts, 0 dirs
/usr/share/fonts/truetype/sinhala: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/takao-gothic: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/takao-mincho: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/tibetan-machine: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/tlwg: caching, new cache contents: 58 fonts, 0 dirs
/usr/share/fonts/truetype/ttf-khmeros-core: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/ubuntu-font-family: caching, new cache contents: 13 fonts, 0 dirs
/usr/share/fonts/truetype/unfonts-core: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
Re-scanning /usr/share/fonts: caching, new cache contents: 0 fonts, 6 dirs
Re-scanning /usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs
Re-scanning /usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs
Re-scanning /usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs
Re-scanning /usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 5 dirs
Re-scanning /usr/share/fonts/truetype: caching, new cache contents: 2 fonts, 38 dirs
Re-scanning /usr/share/fonts/truetype/roboto: caching, new cache contents: 0 fonts, 1 dirs
Re-scanning /usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/var/cache/fontconfig: cleaning cache directory
fc-cache: succeeded
dell@DELL-Server:~$

Ubuntu網絡安裝TeXLive比較簡單,只須要執行一條命令並等待安裝完成。

首先要安裝基礎依賴軟件。

sudo apt-get install libdigest-perl-md5-perl perl-tk
sudo apt install texlive-full

但該方法安裝存在一個弊端,即不能更新宏包(包括全部Debian和Ubuntu發行版本)。

當咱們執行命令

tlmgr update -all

咱們可使用

時會有報錯。報錯信息以下:

jiangjuan@OptiPlex-390:~$ tlmgr update --all
(running on Debian, switching to user mode!)
cannot setup TLPDB in /home/jiangjuan/texmf at /usr/bin/tlmgr line 5604.

其餘tlmgr命令也無效。因此咱們須要其餘方法安裝TeXLive。下文將加以介紹。

安裝鏡像中全部宏包均是打包時版本,部分軟件包會在Ubuntu 安裝源發佈後更新,本方法能夠解決安裝源軟件版本不能實時更新問題。部分Debian系發行版本執行tlmgr命令有問題,下文將給出一個解決方法。

首先,執行命令:

#必定要安裝perl-tk
sudo apt install git perl-tk

安裝git客戶端,git客戶端能夠克隆github代碼到本地。git完成後以下圖。 windows git clone

linux git clone

install-tl-ubuntuGitHub地址。

https://github.com/scottkosty/install-tl-ubuntu .

下面是重要環節,首先git 同步 install-tl-ubuntu代碼到本機並安裝。代碼以下:

#克隆代碼
git clone https://github.com/scottkosty/install-tl-ubuntu.git
#切換到安裝目錄
cd cd install-tl-ubuntu
#賦予安裝文件可執行權限
chmod +x ./install-tl-ubuntu
#開始安裝
sudo ./install-tl-ubuntu
#查看安裝幫助文檔,如下是部分幫助文檔
jiangjuan@jiangjuan-machine:~/install-tl-ubuntu$ ./install-tl-ubuntu --help | more

  USAGE
  sudo ./install-tl-ubuntu [OPTIONS]

  DESCRIPTION
  This script uses the TeX Live 2016 installer to install TeX Live so that LaTeX
  packages can be updated through CTAN with tlmgr. To do this, the official TeX
  Live 2016 installer is downloaded and used and apt is informed that TeX
  dependencies are satisfied. Thus, when you want to install a program with
  apt-get that depends on TeX Live, apt will not try to install the TeX Live
  packages from the Ubuntu repositories.

  If this script detects a previous TeX Live installation installed to the same
  place (/opt/texbin), the link will be updated to the new installation but the
  old installation (the place /opt/texbin points to) will not be removed and
  should be removed manually by the user if desired.

  This script must be run with sudo. Many recommend not installing TeX Live with
  sudo, in which case this script must be altered (please send a patch or post
  an enhancement request).

--更多-

等待程序自動選擇安裝源並自完成安裝,全程無需人工干預。

提示:須要注意該方法須要網絡環境穩定,不然可能會出現反覆從新安裝狀況。

程序安裝完成後,開始菜單會增長一個選項--TeXLive Package Manager,經過該軟件能夠完成宏包更新和管理等操做。

提示:軟件功能bug可能會隨着做者更新軟件而修復。

安裝完成後,檢查軟件安裝狀況,能夠執行命令。

xelatex -version

LaTeX示例代碼以下,Windows將代碼直接複製到文本編輯器(記事本,notepad++等)中,另存爲英文名稱.tex(Linux沒有該限制),可在文本編輯器中再次打開,或者直接經過命令編譯。

\documentclass{book}
\usepackage{amsmath}
\usepackage{ctex}
%\usepackage{ctex}%(PDF)LaTeX編譯方式請選擇此行,註釋上一行代碼
\begin{document}
你好,中國。

勾股定律
$$a^2+b^2=c^2$$

Happy TeXing.
\end{document}

Linux系統能夠將代碼保存至/home/dell/文檔/tex/Hello目錄下,該目錄是筆者電腦目錄,可根據實際狀況選擇保存目錄,或者放置到其餘任意目錄。

/home/dell/文檔/tex/Hello/hello.tex

Linux編譯文件操做步驟以下:

#切換到tex源文件目錄
cd /home/dell/文檔/Hello/
#xelatex命令編譯文件,可選其餘選項
xelatex hello.tex

等待編譯過程完成便可。

下面貼出一個編譯過程。

jiangjuan@jiangjuan-machine:~/test$ xelatex test.tex
This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/ctex/ctex.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ctex/ctexhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ctex/ctexpatch.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/fix-cm.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/share/texlive/texmf-dist/tex/latex/ms/everysel.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ctex/config/ctexopts.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def
(/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmr.fd))
(/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/share/texmf/tex/latex/tipa/t3enc.def
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmss.fd))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/xelatex/xetex-def/xetex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty)
(/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
*** Reloading Xunicode for encoding 'EU1' ***
) (/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def)
(/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg))
(/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/share/texlive/texmf-dist/tex/latex/environ/environ.sty
(/usr/share/texlive/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(/usr/share/texmf/tex/latex/CJK/CJKfntef.sty)))
(/usr/share/texlive/texmf-dist/tex/latex/zhnumber/zhnumber.sty
(/usr/share/texlive/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def
(/usr/share/texlive/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/tools/indentfirst.sty)
(/usr/share/texlive/texmf-dist/tex/latex/ctex/ctex-c5size.clo)
(/usr/share/texlive/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def
*************************************************
* fontspec warning: "script-not-exist"
*
* Font 'FandolSong-Regular' does not contain script 'CJK'.
*************************************************
)) (/usr/share/texlive/texmf-dist/tex/latex/ctex/config/ctex.cfg)
No file test.aux.
(/usr/share/texmf/tex/latex/tipa/t3cmr.fd)
ABD: EverySelectfont initializing macros

LaTeX Font Warning: Font shape `OMX/cmex/m/n' in size <10.53937> not available
(Font)              size <10.95> substituted on input line 6.

[1] (./test.aux)

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.41063pt have occurred.

 )
Output written on test.pdf (1 page).
Transcript written on test.log.
jiangjuan@jiangjuan-machine:~/test$
#PDF生成正常
jiangjuan@jiangjuan-machine:~/test$ ls
test.aux  test.log  test.pdf  test.tex  WhoLogIn.sh
jiangjuan@jiangjuan-machine:~/test$
相關文章
相關標籤/搜索