Skip to content

Instantly share code, notes, and snippets.

@lucasgautheron
Created March 16, 2016 17:42
Show Gist options
  • Save lucasgautheron/1845bd03a4ef944834b7 to your computer and use it in GitHub Desktop.
Save lucasgautheron/1845bd03a4ef944834b7 to your computer and use it in GitHub Desktop.
\documentclass[10pt]{article}
% I only need the arrows for this one.
\usepackage{tikz}
\usetikzlibrary{arrows}
% Nice captions.
\usepackage[hang,small,bf]{caption}
\setlength{\captionmargin}{25pt}
% New commands to keep things tidy.
\newcommand{\ket}[1]{$\left|#1\right\rangle$}
\newcommand{\Om}[1]{\small $\omega_{#1}$}
\newcommand{\De}[1]{$\Delta_{#1}$}
\newcommand{\Ga}[1]{$\Gamma_{#1}$}
\begin{document}
% Place the TikZ picture in a figure environment.
\begin{figure}
\centerline{
% Resize it to 5cm wide.
\resizebox{7cm}{!}{
\begin{tikzpicture}[
scale=0.5,
level/.style={thick},
virtual/.style={thick,densely dashed},
direct/.style={thick,<-,shorten >=2pt,shorten <=2pt,>=stealth},
trans/.style={thick,<->,shorten >=2pt,shorten <=2pt,>=stealth},
classical/.style={thin,double,<->,shorten >=4pt,shorten <=4pt,>=stealth}
]
% Draw the energy levels.
\draw[level] (2cm,-2em) -- (0cm,-2em) node[left] {\ket{i}};
\draw[level] (2cm,11em) -- (4cm,11em) node[midway,above] {\ket{e}};
\draw[level] (4cm,-11em) -- (6cm,-11em) node[right] {\ket{f}};
% Draw the transitions.
\draw[direct] (1cm,-2em) -- (3cm,10em) node[midway,left] {$\Gamma_e$};
\draw[trans] (3.5cm,10em) -- (5cm,-10em) node[midway,right] {$W$};
\draw[direct] (4.5cm,-10em) -- (1.5cm,-3em) node[midway,below] {$\Gamma_i$};
\end{tikzpicture}
}
}
\caption{A level diagram with some transitions drawn in TikZ, resized,
and placed in a figure environment.}
\end{figure}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment