Latex安裝筆記

嗯,boss不喜歡Latex,so weak(吐槽而已!對不起!)! 但我喜歡,所以又在新PC(Windows10)上重裝了texlive2019。要記錄一下,以後折騰會快點。

1. 在WSL上裝texlive2019

嗯,我裝了Ubuntu(wsl),而且還裝了oh-my-zsh。安裝過程基本是看這篇:texlive 2019安裝指南,但是這篇沒能解決我所有問題。

Q1: 一開始,我遇到一個問題:爲什麼我在wsl中運行tex --version沒有反應?

我已經裝了libfontconfig庫了。

(1)我覺得可能是我安裝了zsh,所以應該把~/.bashrc寫成~/.zshrc

echo "export MANPATH=${MANPATH}:/usr/local/texlive/2019/texmf-dist/doc/man" >> ~/.zshrc
echo "export INFOPATH=${INFOPATH}:/usr/local/texlive/2019/texmf-dist/doc/info" >> ~/.zshrc
echo "export PATH=${PATH}:/usr/local/texlive/2019/bin/x86_64-linux" >> ~/.zshrc

(2)沒用。所以我打開~/.zshrc文件,把(1)中加入的刪掉,換成這個:

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

這個主要參考:

  1. Linux 下安裝 TeXLive 2018
  2. TEX Live 指南—2019

(3)還是不行,但是我在wsl中輸入exit退出後,再打開wsl就奇蹟般行了。輸出如下:

$ tex --version
TeX 3.14159265 (TeX Live 2019)
kpathsea version 6.3.1
Copyright 2019 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

所以說不定一開始(1)也行,但我沒回頭嘗試了。

Q2:我使用vscode的latexworkshop插件,zsh:1:commond not be found: xelatex?

研究過後,我覺得是插件沒辦法識別我settings.json中的latex-workshop.latex.tools。我嘗試過不少方法,都沒能解決我的問題。最後,我修改wsl/usr/local/texlive/2019/bin/x86_64-linux/xelatex就可以了。我settings.json中的latex-workshop.latex.tools如下:

"latex-workshop.latex.tools": [
      {
        "name": "xelatex",
        "command": "wsl",
        "args": [
          "/usr/local/texlive/2019/bin/x86_64-linux/xelatex",
          "-synctex=1",
          "-interaction=nonstopmode",
          "-file-line-error",
          "%DOCFILE%"
          // 聽說把%DOC%改成%DOCFILE%可以識別中文路徑
        ]
      },
      ...

主要參考資料:

  1. WSL recipe not recognising WSL command #714
  2. Dev on Windows with WSL
  3. VS Code Remote Development

Q3:Invalid filename `Times New Roman’, contains ’ '!

(1)一開始,我以爲是 xelatex 缺少字體,所以根據TEX Live 指南—2019做了一下:XeT E X 和 LuaT E X 的系統字體配置。但是仍然無法成功編譯。暫時沒有解決。

2. 在Windows10上裝texlive2019

因爲Q3沒有解決,所以我直接在Windows10上裝了= =

這裏有幾個重要的資料:

  1. 使用VSCode編寫LaTeX
  2. 一份其實很短的 LaTeX 入門文檔
  3. Visual Studio Code LaTeX Workshop Extension

嗯,方便自己下次折騰= =

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章