sam's bits

ramblings on technology and other stuff
2

Easy and fast LaTeX editing with Sublime Text 2 and Skim PDF Viewer

I recently had to write a couple of letters and didn’t want to use Word, Pages or Google Docs. They’re all great word processors, but all require a lot of effort to set the template up correctly or get the spacings right. LaTeX is a great option for people who like to focus on their content without worrying about the representation. Write up your stuff and LaTeX can by default produce a beatiful result. Customisations are possible of course.

You could use an editor like TexShop or Lyx, but if you like it bare-bones and use Sublime Text 2 for development anyway, then you might as well write your LaTeX documents with it. The macros, shortcuts and snippets functions are what make Sublime Text 2 great. And creating a PDF out of your LaTeX is done with a simple shortcut.

Here’s a straight-forward guide to get you going (if you’re running Mac OS X):

  1. Download and install MacTeX
  2. Download and install Sublime Text 2
  3. Download and install the Sublime Package Control
  4. Download and install Skim PDF Viewer (required by the Sublime Plugin)
  5. Open up Sublime Text 2 and hit “cmd+shift+p”. Search for “Install Package” and hit return.
  6. In the package list, search for “LaTeXTools” and hit return. The plugin will be installed.
  7. Done!

Open up your TeX file and hit “cmd+b” which will create a PDF and open up the Skim PDF Viewer. To get you started you can just copy the TeX below which is a standard letter for Switzerland:

\documentclass[%
    fontsize=11pt,%
    version=last,%
    foldmarks=false,%       
    refline=dateleft,% 
    paper=a4,% 
    fromalign=left,% 
    fromrule=aftername,% 
    backaddress=false,% 
    parskip=half,% 
    enlargefirstpage=true% 
]{scrlttr2} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[scale=0.81]{geometry}
\usepackage{%
    ngerman,
    graphicx,
    url,
    lmodern,
    paralist}

\renewcommand*\familydefault{\sfdefault}

\setkomavar{fromname}{\newline \newline Max Muster}         
\setkomavar{fromaddress}{Musterweg 7\
                        8000 Zürich} 

\setkomavar{signature}{ \newline Max Muster}        
\setkomavar{subject}{Gesuch um ein Schmorbraten}
\setkomavar{place}{Zürich}  

% die signatur ist linksbuendig
\let\raggedsignature=\raggedright

% Manche finden, dass scrlttr2 so eine riesige Fusszeile hat 
% einfach die nächste Zeile auskommentieren, dann wird sie kleiner:
% \setlength{\footskip}{pt}     

\begin{document}
\begin{letter}{Barbara Bonus \ Bankengasse 7 \ 8000 Zürich}         

\opening{Sehr geehrte Damen und Herren,}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
 quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
 cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
 proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 

\closing{Mit freundlichen Grüssen}

\begin{compactitem}[-]
\item Lorem
\item Ipsum
\item Dolor
\item Sit
\end{compactitem}

\end{letter}    
\end{document}

Categories: LaTeX

Tags: skim, latex, sublime text 2, letter template

Comments: 2 Comments

2

Comments

  • Comment by Ben on 25 January 2014 12:14 am

    You don't need MacTeX thats the whole point of using Sublime...

  • Comment by James on 8 February 2014 6:25 am

    Thanks for this...

Post a comment