ArchLinux使用vscode编写latex报错The font "FontAwesome" cannot be found
2023-3-6
·
hexer

参考archwiki_texlive,安装完texlive,配置好个人的vscode之后,遇上了一个问题

右下方提示报错Formatting failed. Please refer to LaTeX Workshop Output for details.

在日志中查看错误信息

如果没有日志的可能是你在latex-workshop中设置了清除日志

/usr/share/texmf-dist/tex/latex/fontawesome/fontawesome.sty:46: Package fontspec Error: The font "FontAwesome" cannot be found.

进入/usr/share/texmf-dist/tex/latex/fontawesome/后发现文件fontawesome.sty存在,所以是权限不够的原因,随后尝试修改权限chmod 777 fontawesome.sty

返回vscode,latex编译成功

个人vscode配置

2023.3.6版

{
    "files.autoSave": "afterDelay",
    "files.autoGuessEncoding": true,
    "editor.mouseWheelZoom": true,
    "editor.cursorSmoothCaretAnimation": "on",
    "editor.smoothScrolling": true,
    "workbench.list.smoothScrolling": true,
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.wordWrap": "on",
    "editor.autoClosingBrackets": "always",
    "editor.guides.bracketPairs": true,
    "editor.bracketPairColorization.independentColorPoolPerBracketType": true,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.acceptSuggestionOnEnter": "smart",
    "editor.suggestSelection": "recentlyUsed",
    "window.dialogStyle": "custom",
    "debug.showBreakpointsInOverviewRuler": true,
    "deepl.apiKey": null,
    "translation.target-language": "zh-CN",
    "terminal.integrated.fontFamily": "MesloLGS NF",
    // --- Latex 配置 ---
    // 保存文件后构建项目
    "latex-workshop.latex.autoBuild.run": "never",
    "latex-workshop.showContextMenu": true,
    // 从加载的包中启用命令和环境的自动完成(默认也是true)
    "latex-workshop.intellisense.package.enabled": true,
    // 两次连续自动构建之间的最小时间间隔(以毫秒为单位)
    "latex-workshop.latex.autoBuild.interval": 1000,
    "latex-workshop.message.error.show": true,
    "latex-workshop.message.warning.show": true,
    // 可用于构建的工具
    "latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    // 为构建而运行的工具序列
    "latex-workshop.latex.recipes": [
        {
            "name": "XeLaTeX",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "PDFLaTeX",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "BibTeX",
            "tools": [
                "bibtex"
            ]
        },
        {
            "name": "LaTeXmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
    ],
    // 要清理的文件扩展名 字符串数组
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist", // 默认中没有出现
        "*.fls",
        // "*.log", // 默认中没有出现
        "*.fdb_latexmk",
        "*.vrb", // 默认中没有出现
        "*.synctex(busy)", // 默认中出现但是其他博客的配置没有出现
        "*.synctex.gz(busy)", // 同上
    ],
    // 编译失败时自动清理
    "latex-workshop.latex.autoClean.run": "onFailed",
    "latex-workshop.latex.recipe.default": "lastUsed",
    // --- Latex 配置 END ---
}