如何在Ubuntu 20.04 Linux上安装LaTex

根据安装不同类型的软件包,需要不同的磁盘空间。

  • texlive-base – 160 MB
  • texlive-latex-recommended – 203 MB
  • texlive – 269 MB
  • texlive-latex-extra – 464 MB
  • texlive-full – 5903 MB

此外,Ubuntu提供了更多针对专业的软件包选择,如:

  • texlive-publishers
  • texlive-science
  • texlive-pstricks
  • texlive-pictures
  • texlive-metapost
  • texlive-music
  • texlive-xetex
  • texlive-luatex
  • texlive-games
  • texlive-humanities

无论您选择何种软件包,都可以使用'apt'命令安装LaTeX。

以下linux命令将安装LaTeX包: texlive-latex-extra
将程序包名称替换为要安装的程序包名称:

$ sudo apt install texlive-latex-extra

现在,我们已经安装了LaTeX。

让我们编译一个简单的LaTeX代码,来检查是否安装成功。

新建一个文件hello-world.tex,内容如下:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
Hello world \LaTeX
\url{https://onitroad.com}
\end{document}

使用“pdflatex命令”将其编译为PDF。
如果系统上没有“PDFlatex命令”,则需要在使用它之前安装texlive-extra-utils

$ pdflatex hello-world.tex

上面的步骤将 hello-world.tex编译成 hello-world.pdf

开始Evince PDF查看器查看结果:

$ evince hello-world.pdf
日期:2020-07-07 20:55:25 来源:oir作者:oir