mac10.15配置latex格式化

参考这里的:12. Appendices — latexindent.pl 3.13.2 documentation

archlinux

报错参开 ubuntu

请安装如下:

1
sudo pacman -S perl-file-homedir perl-yaml-tiny

ubuntu

报错这个

1
Can't locate YAML/Tiny.pm in @INC (you may need to install the YAML::Tiny module) 

按照官网的,sudo cpan -i App::cpanminus 这一步卡住了,这一步我是这么干的

1
sudo apt install cpanminus

还需要这个

1
sudo cpanm Log::Dispatch

整体是

1
2
3
4
5
6
sudo apt install perl
sudo apt install cpanminus
sudo cpanm YAML::Tiny
sudo cpanm File::HomeDir
sudo cpanm Unicode::GCString
sudo cpanm Log::Dispatch

后三步,需要一分钟左右,慢慢等

可还报错,我又把latexindent更新了,方法:进入root更新latex库

1
2
3
4
5
sudo su

tlmgr update --self

tlmgr update latexindent

macos

mac10.15

vscode格式化latex时报错

Formatting failed. Please refer to LaTeX Workshop Output for details.

并且按照之前的mac系统,运行以下也不行,仍然提示缺少File::HomeDir

1
sudo cpan -i Log::Log4perl Log::Dispatch::File\ YAML::Tiny File::HomeDir Unicode::GCString

其实是在运行sudo cpan -i时,提示了

fatal error: 'EXTERN.h' file not found

而且查找这个库时

sudo find /Library -type f -name EXTERN.h

可以找到这个库所在位置

  • 前提是已经安装了xcode命令行工具xcode-select --install输入到终端即可

按理说,随便找一个路径刚才查到的路径,在终端输入即可

1
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE:$CPATH

可是File::HomeDir时还是不对,提示权限错误等问题

注意,保持没有改变终端窗口,防止环境变量失效

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo find /Library -type f -name EXTERN.h


export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE:$CPATH


sudo su


cpan

install Mac::SystemDirectory

install File::HomeDir

解决


本文作者:yuhldr
本文地址: https://yuhldr.github.io/posts/14097.html
版权声明:转载请注明出处!