632 字
3 分钟
arch 使用包管理器安装 texlive

把系统更换成了 Arch Linux.之前安装的一些软件都得重新安装,其中最麻烦的就是 texlive.好在 arch 的主源打包的 texlive 足以正常使用,加之已经介绍过了镜像安装,故此篇使用包管理器安装.︀

本文无意比较两种安装方式之优劣.

安装 texlive 本体#

pacman -S texlive #列出 texlive 软件集

会让你选择安装的包,幸运的是,打包的格式和 texlive 自己是一致的:

:: 在组 texlive 中有 22 成员:
:: 软件仓库 extra
   1) texlive-basic  2) texlive-bibtexextra  3) texlive-binextra
   4) texlive-context  5) texlive-fontsextra  6) texlive-fontsrecommended
   7) texlive-fontutils  8) texlive-formatsextra  9) texlive-games
   10) texlive-humanities  11) texlive-latex  12) texlive-latexextra
   13) texlive-latexrecommended  14) texlive-luatex  15) texlive-mathscience
   16) texlive-metapost  17) texlive-music  18) texlive-pictures
   19) texlive-plaingeneric  20) texlive-pstricks  21) texlive-publishers
   22) texlive-xetex

输入某个选择 ( 默认=全部选定 ): 

参考这篇文章,我们做以下选择(毕竟 games 这种包我实在用不到,嫌麻烦可以直接全选,也占不了多大地方)

1,2,3,6,11,12,13,14,15,18,22

安装 texlive 语言包#

sudo pacman -S 	texlive-langchinese

此处也可以选择texlive-lang软件集,然后像上一步一样来选择.︀

安装字体#

默认的 fandol 字体很久没人维护了,若使用有以下问题:

  1. 会报警告
Package fontspec: Font "FandolSong-Regular" does not contain requested
(fontspec)	Script "CJK".
  1. fandol 默认没有粗体变成黑体的设置,观感一般(容易被看出来,分辨宋体黑体还是比分辨不同的字体容易的)

这里换成 adobe 开源字体:

也可以安装 Windows 字体,但是要注意侵权问题.︀

yay -S ttf-adobe-song ttf-adobe-fangsong ttf-adobe-heiti ttf-adobe-kaiti

在文档开头加上fontset=adobe即可:

\documentclass[a4paper,12pt,fontset=adobe]{report}

如果手动安装别的字体,建议放到/usr/share/fonts/而不是/usr/local/share/fonts/,后者会识别不出来.︀

LaTeXworkshop 配置#

注:默认开启折行;使用 latexmk 进行编译,编译产生的文件位于 ./build 文件夹.︀(-outdir=选项仅仅在此时有效果)

  "[latex]": {
    "editor.wordWrap": "on",
  },
  "latex-workshop.latex.tools": [
    {
      "name": "XeLaTeXmk",
      "command": "latexmk",
      "args": [
        "-xelatex",
        "-synctex=1",
        "-shell-escape",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ]
    },
    {
      "name": "pdfLaTeXmk",
      "command": "latexmk",
      "args": [
        "-pdflatex",
        "-synctex=1",
        "-shell-escape",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ]
    },
    {
      "name": "LuaLaTeXmk",
      "command": "latexmk",
      "args": [
        "-lualatex",
        "-synctex=1",
        "-shell-escape",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ]
    },
    {
      "name": "LaTeXmk-DVIPDFMx",
      "command": "latexmk",
      "args": [
        "-e",
        "$dvipdf='dvipdfmx %O -o %D %S'",
        "-latex",
        "-pdfdvi",
        "-synctex=1",
        "-shell-escape",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ]
    },
    {
      "name": "upLaTeXmk-DVIPDFMx",
      "command": "latexmk",
      "args": [
        "-e",
        "$dvipdf='dvipdfmx %O -o %D %S'",
        "-latex=uplatex",
        "-pdfdvi",
        "-synctex=1",
        "-shell-escape",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ]
    }
  ],
  "latex-workshop.latex.recipes": [
    {
      "name": "XeLaTeXmk",
      "tools": [
        "XeLaTeXmk",
      ]
    },
    {
      "name": "pdfLaTeXmk",
      "tools": [
        "pdfLaTeXmk",
      ]
    },
    {
      "name": "LuaLaTeXmk",
      "tools": [
        "LuaLaTeXmk",
      ]
    },
    {
      "name": "LaTeXmk-DVIPDFMx",
      "tools": [
        "LaTeXmk-DVIPDFMx",
      ]
    },
    {
      "name": "upLaTeXmk-DVIPDFMx",
      "tools": [
        "upLaTeXmk-DVIPDFMx",
      ]
    }
  ],
  //消息相关
  "latex-workshop.message.error.show": false,
  "latex-workshop.message.warning.show": false,
  //输出文件相关
  "latex-workshop.latex.outDir": "build",
  "latex-workshop.latex.autoClean.run": "onFailed",
arch 使用包管理器安装 texlive
https://fuwari.vercel.app/posts/arch使用包管理器安装texlive/
作者
will-c137
发布于
2024-06-07
许可协议
CC BY-NC-SA 4.0