使用paru命令安装texlive-langchinese包即可:
paru -S texlive-langchinese
宏包相应的文件夹会被安装在/usr/share/texmf-dist/tex/latex路径下,这个可能就是LaTeX宏包的默认路径,手动安装的时候可以参考这个路径。手动安装的方法参考文章:Mac texlive+texstudio 如何手动安装宏包,虽然是Mac的教程,但在这里也是通用的
如果在安装时遇到报错:
error: failed to commit transaction (conflicting files)
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/ctex.sty exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/ctexart.cls exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/ctexbook.cls exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/ctexcap.sty exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/ctexrep.cls exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/fd/c19rm.fd exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/fd/c19sf.fd exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/fd/c19tt.fd exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/fd/c70rm.fd exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/fd/c70sf.fd exists in filesystem
texlive-langchinese: /usr/share/texmf-dist/tex/latex/ctex/fd/c70tt.fd exists in filesystem
Errors occurred, no packages were upgraded.
说明之前可能有手动将ctex目录复制进去过,将其删除后,重新paru安装即可:
安装成功后就可以在LaTeX里面通过ctex使用中文了: