Ubuntu 18 安装 LaTeX

Ubuntu18 安装 LaTex

1.1 一种方法:用在线安装器 install-tl 安装

此方法受网速影响比较大(不推荐),最好用清华镜像:https://mirrors.tuna.tsinghua.edu.cn/help/CTAN/。

下载链接:https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
解压缩,在解压后的install-tl-unx/install-tl-20211105/下安装:
image

sudo perl install-tl

或者用清华的镜像(没试过):

sudo perl install-tl --repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet

安装>>>...(大约几个小时)...>>>安装完成。

1.2 另一种方法:下载iso文件后安装

可以从清华镜像站找历史版本:https://mirrors.tuna.tsinghua.edu.cn/tex-historic-archive/systems/texlive/
下载完iso文件(大约4G)后,双击挂载,或者用命令挂载:

sudo mkdir texliveiso
sudo mount Downloads/texlive2021.iso texliveiso
cd texliveiso/
sudo perl install-tl

最后安装完后,用sudo umount texliveiso 卸载。
然后打开,用上面同样的步骤(不需要联网,可以离线安装,安装相对较快):

sudo perl install-tl

image

2.添加路径

打开./home/.bashrc(显示隐藏文件)
在后面添加(下载的版本不同添加的地址稍微不一样):

PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
export PATH
INFOPATH=/usr/local/texlive/2021/texmf-dist/doc/info:$INFOPATH
export INFOPATH
MANPATH=/usr/local/texlive/2021/texmf-dist/doc/man:$MANPATH
export MANPATH

image

终端输入:

tex

image

可以,ctrl+D退出。

3.下载安装 TeXstudio

image
下载链接:http://download.opensuse.org/repositories/home:/jsundermeyer/xUbuntu_18.04/amd64/texstudio_4.1.2-1+3.1_amd64.deb
安装:

sudo dpkg -i texstudio_4.1.2-1+3.1_amd64.deb

如果安装报错,提示缺少依赖,则需要先执行:

sudo apt -f install

安装完成后打开,编译一个tex文件时会报错,需要改一下设置:
(帮助来源:https://tex.stackexchange.com/questions/246316/error-make-sure-that-you-have-installed-a-latex-distribution)
打开TeXstudio > Options > Configure TeXstudio > Commands :
修改LaTeX 和 PDFLaTeX:
image
image

现在就可以编译出pdf了。

posted @ 2021-12-19 12:18  zhaopw5  阅读(419)  评论(0编辑  收藏  举报