在 Catalina 上的 MacTex 2020 上安裝本地字體

在 Catalina 上的 MacTex 2020 上安裝本地字體

[背景:由於空間和耐心耗盡,我擦除了系統驅動器並從零重新安裝了 Catalina。我現在正在一一重新安裝我仍在使用的所有應用程式。http://www.tug.org/mactex/mactex-download.html它基本上可以工作,但我需要安裝一個額外的非免費字體 Sabon,我擁有該字體的許可證和相關文件。幾年前給自己的筆記告訴我(給定我一次準備的 sabon2.tgz 文件,其中包含帶有一堆與 Sabon 相關文件的目錄結構)我應該在 處創建一個個人 texmf 目錄~/Library/texmf/。在那裡,

tar zxvf sabon2.tgz
texhash
updmap --enable Map=psb.map

這個食譜是我根據 Linux 上的一些東西改編的,2017 年左右在 Mac 上成功地運行了。然而,當我今天嘗試自己的指示時,它們不起作用。 texhash說一堆目錄不可寫:

$ texhash
texhash: /usr/local/texlive/2020/texmf-config: directory not writable. Skipping...
texhash: /usr/local/texlive/2020/texmf-dist: directory not writable. Skipping...
texhash: /usr/local/texlive/2020/texmf-var: directory not writable. Skipping...
texhash: /usr/local/texlive/texmf-local: directory not writable. Skipping...
texhash: Done.

我透過將 texhash 作為 sudo 運行來解決這個問題,儘管我不確定這就是我應該做的。 QM05 常見問題位於https://tug.org/mactex/faq/faq.html#qm05說在向 ~/Library/texmf 添加文件時沒有必要運行 texhash,所以我認為這一步驟在 2020 年已經變得不必要了。下一次失敗:

$ updmap --enable Map=psb.map
updmap [ERROR]: Either -sys or -user mode is required.
updmap [ERROR]: In nearly all cases you should use updmap -sys.
updmap [ERROR]: For special cases see https://tug.org/texlive/scripts-sys-user.html

在錯誤訊息之後,我添加 -sys...

$ updmap -sys --enable Map=psb.map
updmap will read the following updmap.cfg files (in precedence order):
  /usr/local/texlive/2020/texmf-dist/web2c/updmap.cfg
updmap may write changes to the following updmap.cfg file:
  /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg
updmap: can't write to /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg: Permission denied at /Library/TeX/texbin/updmap line 1589.

……但又出現權限錯誤。在這裡,我也添加 sudo 並重試:

$ sudo updmap -sys --enable Map=psb.map
updmap [WARNING]: resetting $HOME value (was /Users/XXX) to root's actual home (/var/root).
updmap will read the following updmap.cfg files (in precedence order):
  /usr/local/texlive/2020/texmf-dist/web2c/updmap.cfg
updmap may write changes to the following updmap.cfg file:
  /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg
Creating new config file /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg
dvips output dir: "/usr/local/texlive/2020/texmf-var/fonts/map/dvips/updmap"
pdftex output dir: "/usr/local/texlive/2020/texmf-var/fonts/map/pdftex/updmap"
dvipdfmx output dir: "/usr/local/texlive/2020/texmf-var/fonts/map/dvipdfmx/updmap"
updmap [ERROR]: The following map file(s) couldn't be found:
updmap [ERROR]:     psb.map (in /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg)
updmap [ERROR]: Did you run mktexlsr?

    You can disable non-existent map entries using the option
      --syncwithtrees.

我想 updmap 找不到 psb.map 的原因是因為 psb.map 位於我的用戶的 ~/Library/texmf 中,但如果我以 root 身份運行 updmap 那麼它不會搜尋那個地方。另一方面,如果我以我的身份運行它,它無法更新文件。

感謝這個問題,本地字型安裝問題,我發現我可以編寫沒有空格的 updmap-sys ,無需 sudo 即可工作:

$ updmap-sys --enable Map=psb.map
updmap will read the following updmap.cfg files (in precedence order):
  /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg
  /usr/local/texlive/2020/texmf-dist/web2c/updmap.cfg
updmap may write changes to the following updmap.cfg file:
  /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg
/usr/local/texlive/2020/texmf-config/web2c/updmap.cfg unchanged.  Map files not recreated.
updmap: Updating ls-R files.

該檔案現在包含單行“Map psb.map”:

$ cat /usr/local/texlive/2020/texmf-config/web2c/updmap.cfg
Map psb.map

然而,在編譯一個使用 Sabon 的已知良好的 tex 檔案時,我得到了

$ pdflatex test.tex 
...
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+264/600 --dpi 864 psbb8r
mktexpk: don't know how to create bitmap font for psbb8r.
mktexpk: perhaps psbb8r is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
(see the transcript file for additional information)
!pdfTeX error: pdflatex (file psbb8r): Font psbb8r at 864 not found
 ==> Fatal error occurred, no output PDF file produced!

為什麼它首先要創建點陣字體?無論如何,我只想要向量字體。現在已經不是20世紀了。

我錯過了什麼以及我該做什麼?

答案1

經過評論中的一些討論後,最好的解決方案是將文件解壓縮到您的TEXMFLOCAL目錄中(此處,/usr/local/texlive/texmf-local),而不是TEXMFHOME(此處,~/Library/texmf)。

MacTeX FAQ 建議將本機檔案放在後者中,但 8 位元字型對應是一個例外。您永遠不想updmap在使用者模式下運作。這是一個陷阱,它將覆蓋您的系統字體映射而不是補充它們,並且隨著您更新系統樹而變得越來越過時。不過,updmap-sys不搜尋TEXMFHOME

相關內容