DEV Community

Cover image for Installing LaTeX themes on your machine/Emacs org-mode

Installing LaTeX themes on your machine/Emacs org-mode

viglioni profile image Laura Viglioni Updated on ・3 min read

For those who need to write academic presentations, it is very common to make use of LaTeX. If you majored computer science you have probably seen a lecture like this:

Most of these presentations are created with beamer and its default themes, although beamer is very handy, these themes are a little bit old-fashioned. We can use modern custom themes like metropolis:

My org-mode code

I use org-mode to do most of my writing, that includes presentations, articles, personal notes etc. Org-mode can interpret LaTeX (and code blocks of a wide range of languages), but talking about org-mode is not the point of this text... (or is it? 👀)

The presentation example above was created with the following code:

#+options: H:3 email:nil tex:t toc:t
#+title: Any Computer Science Class
#+date: \today
#+author: Laura Viglioni
#+language: en
#+creator: Emacs 27.1 (Org mode 9.4)
#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+beamer_theme: Copenhagen

* Graph theory
** Nodes and vertices
** BFS 
** DFS
* Algorithm Complexity
** Big O notation

Enter fullscreen mode Exit fullscreen mode

Compiling that (M-x org-beamer-export-to-pdf or C-c C-e l P) will generate the first pdf shown in this text. Org-mode convert this to a LaTeX file and compiles it, in this example it the .tex generated is:

% Created 2021-01-20 Wed 21:22
% Intended LaTeX compiler: pdflatex
\author{Laura Viglioni}
\title{Any Computer Science Class}
 pdfauthor={Laura Viglioni},
 pdftitle={Any Computer Science Class},
 pdfcreator={Emacs 27.1 (Org mode 9.4)}, 


\section{Graph theory}

\subsection{Nodes and vertices}






\section{Algorithm Complexity}

\subsection{Big O notation}

Enter fullscreen mode Exit fullscreen mode

woa... a little bit verbose compared to org, huh 👀

But the most important lines for this text are:

#+beamer_theme: Copenhagen
Enter fullscreen mode Exit fullscreen mode

aren't you convinced to use org at this point? 😨

Enter fullscreen mode Exit fullscreen mode

If we want to use custom themes, as we can read on metropolis documentation, we must compile the project and put the .sty files in the same directory as our .tex or .org that is calling the theme and change it from Copenhagen to metropolis.

But how to install themes on your system and use them without copying and pasting the .sty files every time?

Installing LaTeX themes to your machine/Emacs

First, you need to know where your system (or Emacs) looks for LaTeX files, including the styles (.sty) ones. The easiest way I know is using the command kpsewhichif you are a mac user, it comes in MacTex package :)

$ kpsewhich -var-value=TEXMFHOME
Enter fullscreen mode Exit fullscreen mode

In my case it returns:

Enter fullscreen mode Exit fullscreen mode

So you must create this dir, if it doesn't exist, and paste the .sty files in there and that's it, as simple as that :)

I hope this might be useful to you :)

Be safe, use masks and use Emacs

PS.: If you want to know more about org-mode, checkout these videos:

Discussion (0)

Editor guide