我在Ubuntu (20.04 LTS) 系统下安装了TeXlive 2020 和 VS Code 按Ctrl+Shift+I (默认)格式化代码时报错...


参考了

https://tex.stackexchange.com/questions/445521/latexindent-cant-locate-log-log4perl-pm-in-inc-you-may-need-to-install-the-l?r=SearchResults

https://github.com/James-Yu/LaTeX-Workshop/issues/376


问题并没有得到解决...


很有可能是latexindent的问题...


\documentclass{article}


\usepackage{amsmath}


\begin{document}


\begin{equation*}

       \int_C \mathbf{F}\cdot\,d\mathbf{r}

\end{equation*}


\end{document}


LaTeX Workshop  输出:




[16:55:46] Found root file from active editor: /home/bang/文档/VS Code/LaTeX/test/test.tex

[16:55:46] Root file remains unchanged from: /home/bang/文档/VS Code/LaTeX/test/test.tex.

[16:55:49] Formatting with command latexindent -c,/home/bang/文档/VS Code/LaTeX/test/,/home/bang/文档/VS Code/LaTeX/test/__latexindent_temp.tex,-y=defaultIndent: '    '

[16:55:49] Formatting failed with exit code 2

[16:55:49] stderr: Can't locate Log/Dispatch/File.pm in @INC (you may need to install the Log::Dispatch::File module) (@INC contains: /usr/local/texlive/2020/texmf-dist/scripts/latexindent /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/local/texlive/2020/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm line 24.

BEGIN failed--compilation aborted at /usr/local/texlive/2020/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm line 24.

Compilation failed in require at /usr/local/texlive/2020/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 25.

BEGIN failed--compilation aborted at /usr/local/texlive/2020/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 25.

Compilation failed in require at /usr/local/texlive/2020/bin/x86_64-linux/latexindent line 27.

BEGIN failed--compilation aborted at /usr/local/texlive/2020/bin/x86_64-linux/latexindent line 27.




2020-04-27 16-54-57 的屏幕截图.png2020-04-27 16-55-58 的屏幕截图.png


1 回答1

1
<p>`latexindent` 是 Perl 脚本,这里提示你缺 Perl module `Log::Dispatch::File`。</p>
  • cpan Log::Dispatch 后解决了 –  2020-04-27 20:40 回复
  • 非常感谢! –  2020-04-27 20:40 回复

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。