Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug solution]: 经过一段时间的折磨,linux上的pdf字体问题终于解决了[泣不成声] #1982

Open
liuanhua110 opened this issue Sep 23, 2024 · 3 comments

Comments

@liuanhua110
Copy link

Installation Method | 安装方法与平台

Others (Please Describe)

Version | 版本

Latest | 最新版

OS | 操作系统

Linux

Describe the bug | 简述

由于最为关键的转化PDF编译失败, 将根据报错信息修正tex源文件并重试, 当前报错的latex代码处于第[-1]行 ...[Bug]
image
看merge_translate_zh.log发现是因为缺少字体,!pdfTeX error: pdflatex (file simhei.ttf): cannot open TrueType font file for reading
image

Screen Shot | 有帮助的截图

如上所示

Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

No response

@liuanhua110
Copy link
Author

解决方案:

  1. 找到texlive的安装目录,对于我来说是在/usr/local/texlive/2024
  2. 在安装目录中的一个tex文档下其实官方给了解决方案,但是对于我来说没有work,解决方案在这个文档中 texmf-dist/doc/context/third/context-notes-zh-cn/src/03.tex
    image
  3. 对于我来说,我把内3个字体,simhei.ttf, simkai.ttf,simsun.ttc复制到了/usr/local/texlive/2024/texmf-dist/fonts/truetype
  4. 添加这三个到/usr/local/texlive/2024/texmf-dist/ls-R中
    image
  5. 按照03.tex的说法也执行了一遍(我觉得可以去掉),先是mkdir了下 sudo mkdir -p texmf-local/fonts/truetype/msfonts ,然后cp进去了
  6. 最后加载字体
    cd /usr/local/texlive/2024/
    context --generate
    mtxrun --script fonts --reload --force
  7. 再去文件夹里面执行/usr/local/texlive/2024/bin/x86_64-linux/pdflatex -interaction=batchmode -file-line-error merge_translate_zh.tex 即可成功生成pdf,如果有别的问题,可以看看log
    image

@SakuraPuare
Copy link

其实直接把这个字体放在文件夹目录下也能解决

@hongyi-zhao
Copy link
Collaborator

另一个解决思路是使用 xelatex/lualatex。
See #1972.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants