LaTeX 환경: vim + make + monex.py

오래전에 LaTeXing in Mac (with TextMate) 라는 글에서 TextMateSkim을 이용한 LaTeX 논문작성 환경을 소개했습니다. 그런데 저는 정작 이 환경을 이제는 이용하지 않고 있습니다. 제가 요새 이용하는 환경을 소개합니다.

TextMate의 한계

TextMate는 훌륭한 편집기지만, 맥에서만 사용 가능하고, 자유 소프트웨어가 아니며, 개발이 수년간 정체되어 있습니다. 2006년에 안정 버전 1.5가 출시되었고 2009년에 2.0이 곧 출시된다는 예고가 등장했지만, 버전 2.0은 아직도 소식이 없습니다.

Vim

TextMate가 가져온 편리한 기능들은 그 사이 다른 편집기에 반영되었습니다. Vim 진영에서는 macvim이 활발히 개발되고, pathogen, NERDTree, snipMate 등 훌륭한 플러그인들이 등장하여 TextMate와 비슷한 환경을 구축하는 게 가능해졌습니다. 자연스럽게, 많은 개발자들이 Vim으로 이주하기 시작했습니다. 최근 vim을 다룬 블로그 글이 늘어나는 것도 이런 흐름을 반영하는 게 아닌가 싶습니다. 저도 원래 Vim과 TextMate를 함께 써 왔지만, 작년 Steve Losh의 Coming home to vim, Vincent Driessen의 How I boosted my Vim 같은 글을 보다가 결국 Vim으로 이주를 결행했고, 현재 아주 만족하고 있습니다. Vim을 본격적으로 써 보고 싶으신 분은 제가 Vim을 사용하기 시작하면서 정리한 자료를 참고하시면 아마 도움이 되실 겁니다.

Make

컴퓨터 과학자들과 논문을 함께 쓰면서 여러 가지를 배웠는데, 그 중 하나가 GNU Make의 유용성입니다. 그림을 그리는 gnuplot 스크립트나 TeX 컴파일 명령들을 Makefile로 조직해 놓으면 매번 그림을 다시 그리고 논문을 컴파일하는 번거로움 없이 make 한번으로 최신 버전의 결과물을 얻을 수 있습니다. 사실 make가 그런 일에 쓰라고 만들어놓은 물건인데 전 논문 작성할 때 쓰면 된다는 생각은 못하고 있었죠.

TextMate 환경은 latexmk.pl을 사용합니다. LaTeX에 최적화된 Make 유틸리티라고 보시면 되는데, 무척 편리하긴 하지만 저는 그냥 간단한 Makefile을 만들어 사용하는 게 편하더군요. 논문을 작성할 때 TeX 컴파일만 하는 게 아니라 gnuplot으로 그림도 그리고 PDF 결과물들을 합치기도 하는데 latexmk만 쓰는 건 한계가 있습니다. 아주 기본적인 Makefile은 대략 다음과 같습니다. make를 실행하면 편지 (cover letter), 논문 본문, 기타 자료 (supporting material) 이렇게 세 개의 PDF 결과물을 만들고 이걸 하나로 합쳐주게 됩니다.

monex.py

Vim과 make의 조합에만 익숙해져도 꽤 편한 작업이 가능합니다. 하지만 매번 make를 실행하는 건 여전히 귀찮죠. 어떻게 하면 자동화를 할 수 있을까 고민하다가 예전에 봤던 autotest 가 생각나 monex.py라는 짤막한 스크립트를 하나 만들었습니다. 이 스크립트가 하는 일은 무척 단순합니다. 주어진 파일들을 감시하다가 파일이 변경되면 주어진 명령어를 실행하는 거죠.

결과물을 Preview에 띄워놓고, 다음과 같이 실행해 놓으면,

$ python monex.py -c "make all" *.tex *.bib *.plt 

파일을 저장할 때마다 알아서 그림을 그리고 컴파일해서 결과물을 갱신 해 줍니다. 이걸 만들어 놓으니 논문 쓸 때뿐만 아니라 여기저기 쓸모가 있더군요. 이 글을 보시는 분들에게도 유용할까 싶어 여기에 붙입니다. (혹시 더 좋은 방법을 알고 계시면 알려주세요. :)

2011/02/03 12:09 2011/02/03 12:09

TRACKBACK :: http://www.yongyeol.com/blog/trackback/55

  1. GS test demo

    Tracked from GS test demo  삭제

    :: YY

    2013/04/02 14:47
  2. best background check service

    Tracked from best background check service  삭제

    LaTeX 환경: vim + make + monex.py :: YY

    2013/05/01 03:10
  1. carb back loading review  댓글주소  수정/삭제  댓글쓰기 2013/05/14 08:40
    Everything is very open with a clear explanation of the issues.

    It was really informative. Your site is very useful.
    Many thanks for sharing!
  2. cellulite factor review  댓글주소  수정/삭제  댓글쓰기 2013/05/14 05:33
    Thanks for the auspicious writeup. It in fact used to be a amusement
    account it. Glance complicated to more delivered agreeable from you!
    By the way, how could we communicate?
  3. free ipod touch 4g  댓글주소  수정/삭제  댓글쓰기 2013/05/11 16:49
    hello there and thank you for your information – I
    have definitely picked up something new from right here.
    I did however expertise several technical points using
    this website, as I experienced to reload the website lots of times previous to I could get it to load
    correctly. I had been wondering if your web host is OK?
    Not that I am complaining, but sluggish loading instances times will very frequently affect your placement in
    google and can damage your high quality score if advertising and marketing with Adwords.

    Well I'm adding this RSS to my email and can look out for much more of your respective intriguing content. Make sure you update this again soon.
  4. free itunes gift card  댓글주소  수정/삭제  댓글쓰기 2013/05/10 12:50
    Hello! Do you use Twitter? I'd like to follow you if that would be okay. I'm undoubtedly
    enjoying your blog and look forward to new updates.
  5. iPage Coupon  댓글주소  수정/삭제  댓글쓰기 2013/05/10 10:28
    I think this is one of the most important info
    for me. And i'm glad reading your article. But should remark on some general things, The web site style is ideal, the articles is really excellent : D. Good job, cheers
  6. JustHost Coupon Codes  댓글주소  수정/삭제  댓글쓰기 2013/05/10 08:05
    That is a really good tip particularly to those new to the blogosphere.
    Brief but very precise information… Appreciate your sharing this one.
    A must read post!
  7. Just Host Reviews  댓글주소  수정/삭제  댓글쓰기 2013/05/10 07:17
    Valuable info. Fortunate me I found your web site by accident, and I am surprised why this twist of fate did not happened earlier!

    I bookmarked it.
  8. JustHost Coupon Code  댓글주소  수정/삭제  댓글쓰기 2013/05/10 07:10
    I have read a few good stuff here. Definitely worth
    bookmarking for revisiting. I wonder how much effort you
    put to create the sort of excellent informative
    web site.
  9. iPage Hosting Review  댓글주소  수정/삭제  댓글쓰기 2013/05/10 06:11
    It is actually a nice and useful piece of
    info. I'm glad that you simply shared this useful info with us. Please stay us up to date like this. Thank you for sharing.
  10. free walmart gift card  댓글주소  수정/삭제  댓글쓰기 2013/05/09 23:40
    excellent points altogether, you just gained a new reader.

    What could you recommend in regards to your submit that you made
    some days ago? Any certain?
  11. get free stuff online  댓글주소  수정/삭제  댓글쓰기 2013/05/09 19:37
    WOW just what I was searching for. Came here by searching for
    get free stuff online
  12. free ipod touch  댓글주소  수정/삭제  댓글쓰기 2013/05/09 13:18
    Hello, this weekend is nice in favor of me, because this point in time i am reading this enormous informative article here at my residence.
  13. FatCow Reviews  댓글주소  수정/삭제  댓글쓰기 2013/05/09 08:12
    These are in fact enormous ideas in about blogging.
    You have touched some fastidious points here. Any way keep up
    wrinting.
  14. FatCow Coupon  댓글주소  수정/삭제  댓글쓰기 2013/05/09 03:07
    I am extremely impressed with your writing skills
    and also with the layout on your blog. Is this a paid theme or did you modify it yourself?
    Either way keep up the excellent quality writing, it's rare to see a great blog like this one nowadays.
  15. GoDaddy Discount Coupon  댓글주소  수정/삭제  댓글쓰기 2013/05/08 03:06
    I really like reading through a post that will make people
    think. Also, many thanks for allowing for me to comment!