Tuesday, October 28, 2014

Tricks of the Trade: LaTeX

Ok, guys. I’ve been studying as a baby statistician (scienctician? statscientist? ecologitician?)  for a little while now and I’m here to share some of their secrets. Before I started here at Penn State I had a couple ideas about what other grad students in my department would be like. First, everyone would be computer masters of any and all statistical programs: R, SAS, others that I hadn’t even heard of yet. Second, they’d all be completely on top of everything in all of our classes because they all would’ve completed undergraduate and master’s programs also in statistics. And thirdly, it’d be really hard to relate to other students because of my background in biology and my love for the outdoors (because clearly they’d all prefer sitting inside in front of their computers, right?). Thankfully, I was way off base and not only am I not left in the educational dust, but my cohort is full of awesome students with a wide variety of strengths and abilities. And I must collect them all. Yea, my new goal is to be like some sort of awesome Anna-Paquin-as-Rogue statistician and glean all of the amazing abilities and knowledge while I can. Except I think I’ll stick to taking the time to learn and practice things...instead of the whole touchy hurty thing she does. One of my absolute favorite new acquires is the ability to write and code in LaTeX.



Another one of my pre-stats misconceptions was that whenever you saw an equation in a journal article it was created with Word’s super difficult equation editor.  Hopefully I’m not the only one who thought this, because now I feel really silly (Editor’s Note: I assumed mathematical witchcraft, so joke’s on me really.). LaTeX is a document preparation system for high-quality typesetting often used for technical or scientific documents. Long story short, you could be creating completely badass documents with lots of equations and badassery like these: [Homework with R Code, Homework with crazy stat stuff!]. I received my intro to LaTeX during one of the Cohort Workshops I have been arranging on Fridays for my department. Another grad student gave us a very brief introduction and showed us some of the basics. A few downloads, a bunch of googling, and several hours of practice later (not to mention an uninstall and redownload...) I was really starting to get the hang of it! Anyone who’s learning to program knows that you experience some of the most frustrating moments during that initial learning curve. WHY WON’T YOU JUST COMPILE AND SHOW ME A PDF OF MY NAME AND ‘HELLO WORLD’? I DID EXACTLY WHAT YOU TOLD ME…*deletes comma* Oh...well then. BEHOLD MY BRILLIANCE! FOR I HATH CREATED A MASTERPIECE!
I would like to encourage everyone to give it a go! I can answer basic questions, but I’ve found that the vast majority of my own beginner’s questions have been accomplished through a few key resources, including the Great Googily Moogily. Behold your starting point!


What to Download
  1. Just getting this to work took way too long.
    I don't want to discourage anyone by
    being exact. 
    Tex - LaTeX is actually a sub-entity of Tex, sort of like Git and Github (which I also am just beginning to understand!) So you’ll actually need to download Tex in order to run LaTeX. Unfortunately, there are slightly different versions for Windows and Mac users but both deal with the same underlying program (if you run anything else, my apologies for being completely unaware of how to guide you).


  1. An Editor - The Tex download comes with everything you absolutely need, but I like using an editor for extra pretty colors and the option to code for other programming languages. I like working in Aquamacs, which is the Mac version of Emacs.


What to Try First
  1. Hello, World! - Your first task is to just compile and create a PDF file with the most basic of greetings. I used this website at Art of Problem Solving. Even still I spent way too long before I got my first code to compile and PDF produced. It’s a glorious achievement!
  2. This is about 4 hours later.
     I felt like a wizard!
    Do a Homework in LaTeX - This is not applicable to everyone and for all classes. But if you have a math or stats course where the homework isn’t too intensive consider completing it in LaTeX! One of my professors even wrote lots of handy coding tips on one of my homeworks that helped me a lot the next time around. I love being able to feel accomplished at writing up a nice, clean looking final version even if the homework is crazy difficult. Helps me keep those imposter thoughts at bay!


Next Level Stuff
  1. Update your CV - This was one of my recommendations for our Motivation blog post last week, but not you can even consider updating your CV in a LaTeX template. I used this one from Bradley P Carlin and you can check out my final form!
  2. Write and submit your next manuscript using LaTeX! - Now, I’m nowhere near this stage of my program but I’d wager that quite a few templates or style formatting guidelines available for submitting a paper using LaTeX! Go, go, go!
  3. Combine with RStudio to work with knitr and sweave to produce LaTeX documents with R code  and results spliced in!

Basically part of my grand PhD scheme is to master a lot of the computing and presentation side of statistics so that I will be a valuable asset and worthy of ALL the jobs. At least a few options after graduating will be worth the toiling away finding that stray comma or misspelled command. Now that you've heard my favorite new tool I've learned so far please share yours! Or even if your favorite is also LaTeX tell me all the little tricks  you've picked up! I want all the tricks! 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...