Thursday, June 13, 2019

LaTeX, Vim and Perl

I'm finishing up grad school.  I write all of my papers in vi (usually Elvis, sometimes Vim) and mark them up with LaTeX.  Yeah, I know.  I'm a geek.  I just love the beautiful look of a typeset document when I'm done.  I like the way it forces me to think about the outline; creating \sections{}, then \subsection{} and even \subsubsection{}.  This looks really nice as an auto-generated table of contents. 

Even better than the beautiful typesetting, I really enjoy keeping my bibliography in BibTeX and having LaTeX/BibTeX automagically write my bibliography citations and print my bibliography at the end by simply writing \cite[p.78]{author}.

And when I'm done, if I don't want a PDF, I can use latex2rtf for an RTF or latex2html to create a web site (or latex2man if I'm feeling extra geeky).  And, I pretty much live in vi all day so, even if I try to use a regular word processor, it gets krufted up with :wq and randomly interjected i's and a's and x', etc.

I used to use emacs.  I did more with emacs I think because I had a Wyse60 monitor and really used the multiple buffers and split screens.  And, loved the macros.  I know, you can do this with vi too.  I really need to learn more of that in vi.  Lately, while writing these papers, I find myself wanting to copy lines from other .tex docs into the current document.  Cutting and pasting outside of vi leaves unexpected broken lines that require a lot of Ctrl-J, x, etc.  Then I saw an article by Jun Wu "Perl as a command line tool"  Lots of fun.  Love Perl one-liners.  She had a version of this example:


    $ perl -ne 'print if $. >=64 && $. <=94' June10.tex >>../FinalPaper/ENG609final.tex 

It's so great to NOT have to clean up line breaks after cut & paste.  And, even better, it gives me an excuse to play around with Perl one-liners.  Some people things that's odd but I see it as recreational - like Soduko or something.

Anyways, that's all I'm up to with Perl lately.  See you all at the 20th anniversary of YAPC