SturdyCobble's Study Note

Atom을 LaTeX 편집기로 활용하기 본문

자유 주제

Atom을 LaTeX 편집기로 활용하기

StudyingCobble 2020. 4. 10. 13:30

NOTICE : 독학인 만큼, 잘못된 내용이 있을 수 있습니다. 내용 지적은 언제나 환영합니다.

더 이상 이 블로그에는 글을 올리지는 않을 예정입니다. 그렇지만 댓글을 달아주시면 최대한 답변드리고자 노력하겠습니다.


최근 LaTeX을 활용할 일이 많아져서 Atom에 관련 패키지를 설치해서 편집기로 활용할 수 있도록 했습니다. 설치한 패키지는 다음과 같습니다. 물론 그 전까지 Overleaf를 잘 활용하고 있었지만, 인터넷이 되야 한다는 점 등이 걸려서 Atom을 활용하기로 했습니다.

 

  • latex               -> Compile
  • language-latex  -> Syntax Highlight
  • latexer             -> Auto-complete

LaTeX 조판 프로그램이 추가로 설치되어야 하는데, 처음에는 MikTex 쓰다가 나중에 TexLive로 갈아탔습니다. 둘 다 패키지에 latexmk를 추가해야 하는데, MikTex의 경우 내장 펄(Perl)이 없어서 ActivePerl이나 StrawberryPerl(저는 드라이브 이름때문에 ActivePerl만 사용 가능했습니다.)을 깔아주어야 합니다. 

 

아래 글을 참고하면 될 것 같네요.

https://github.com/thomasjo/atom-latex/wiki/Using-latexmk-with-MiKTeX

 

 근데 자꾸 오류가 났습니다. MikTex를 썼었는데, 자꾸 latexmk가 설치된 걸 인식도 잘 못하길래, 그냥 TexLive로 갈아탔습니다. Setting에서 Tex Path를 바꾸어 주는 것을 잊으면 안 됩니다.

 

 

latexmk.exe: The script could not be found.
latexmk.exe: Data: scriptEngine="perl", name="latexmk", path="scripts/latexmk/perl/latexmk.pl"

 

대강 이런 에러였습니다. 근데 TexLive로 갈아타니 다른 문제가 생겼습니다.

 

File::Path version 2.08 required--this is only version 1.08 at c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl line 291.
BEGIN failed--compilation aborted at c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl line 291.
C:\texlive\2019\bin\win32\runscript.tlu:910: command failed with exit code 255:
perl.exe c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl -synctex=1 -interaction=nonstopmode -file-line-error -pdf "-outdir="(파일 위치)" "(파일 위치)"

 

대강 이런 오류였는데, cmd 창에서 latexmk -v를 쳐도 같은 오류가 나는 것을 보아 TexLive쪽 문제인가 싶었지만, 문제는 perl쪽에서 난 것이였습니다.

 

 

# File : c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl


use File::Path 2.08 qw( make_path );

 

문제의 코드는 이거였는데, 저 버전을 낮추니 다른 문제가 생기길레 Perl 쪽 문제인거 같아서 찾아보니까 msys2에도 perl이 있어서 버전을 확인했는데, 저거보다 훨씬 높았습니다... 내장 Perl도 이상이 없었는데, 다른 파일을 뜯어보니 이런 코드가 있었습니다.

 

-- File : C:\texlive\2019\bin\win32\runscript.tlu


local PERLEXE = try_extern_perl and search_path('perl.exe', PATH)
local extperl_warn
if not PERLEXE then
  if try_extern_perl then extperl_warn = [[
External Perl missing or outdated. Please install a recent Perl, or configure
TeX Live to always use the builtin Perl:
  tlmgr conf texmf TEXLIVE_WINDOWS_TRY_EXTERNAL_PERL 0
Meanwhile, continuing with built-in Perl...
]]

일단 외부에서 먼저 Perl을 찾아오는 코드길레 아래와 같이 바꿔버렸습니다.

 

local PERLEXE = false

 

무슨 외부 Perl이 버전이 그렇게 된 건지는 모르겠지만, 일단 무조건 내장 펄을 사용하도록 false를 대입시켰더니 작동합니다. 다만, cmd창에 latexmk -v를 치면 아래와 같이 나오긴 합니다.

 

C:\Users\user>latexmk -v
External Perl missing or outdated. Please install a recent Perl, or configure
TeX Live to always use the builtin Perl:
  tlmgr conf texmf TEXLIVE_WINDOWS_TRY_EXTERNAL_PERL 0
Meanwhile, continuing with built-in Perl...


Latexmk, John Collins, 26 Dec. 2019. Version 4.67

 

뭐 작동만 하면 됐습니다.

 

추가로 pdf-view 패키지도 추가하고, 조그마한 설정을 건드려 결국 다음과 같이 컴파일할 수 있었습니다.

 

쓰고 보니 뭔가 이상한 문장이지만, 테스트용이니 굳이 수정하진 않았습니다.

 

Comments