<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>ianws</title>
 <link href="https://ianws.com/atom.xml" rel="self"/>
 <link href="https://ianws.com/"/>
 <updated>2026-03-03T18:50:53+00:00</updated>
 <id>https://ianws.com</id>
 <author>
   <name>Ian Waudby-Smith</name>
   <email>ian@ianws.com</email>
 </author>

 
 <entry>
   <title>Toggling verbosity in LaTeX derivations (old)</title>
   <link href="https://ianws.com/blogposts/toggling-verbosity-latex-old/"/>
   <updated>2024-03-18T00:00:00+00:00</updated>
   <id>https://ianws.com/blogposts/toggling-verbosity-latex-old</id>
   <content type="html">&lt;center&gt;&lt;em&gt;(An updated version of this post can be found &lt;a href=&quot;/blogposts/toggling-verbosity-latex&quot;&gt;here&lt;/a&gt;. This one is only kept for posterity.)&lt;/em&gt;&lt;/center&gt;

\[\newcommand{\Fcal}{\mathcal{F}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\EE}{\mathbb{E}}\]

&lt;p&gt;I find it helpful to write proofs so that they can optionally be made more verbose (e.g. to fill in certain details in a derivation). There’s a very simple trick you can use to accomplish this and it’s already built in to LaTeX — no additional packages needed. This idea was taken from &lt;a href=&quot;https://old.reddit.com/r/LaTeX/comments/p321rh/is_there_a_way_to_have_two_versions_of_a_document/h8ojktk/&quot;&gt;this reddit comment&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Put the following in your preamble:&lt;/p&gt;

&lt;div class=&quot;language-LaTeX highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;% Verbose LaTeX doc.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\newif\ifverbose&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;% Define a new Boolean value &quot;verbose&quot;.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;% Initially it is false.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\verbosefalse&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;% set verbose to true/false here.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Any content you would like to restrict to the “verbose” version of your paper should then be wrapped in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\ifverbose &amp;lt;content&amp;gt; \if&lt;/code&gt;.&lt;/p&gt;

&lt;h1 id=&quot;demo&quot;&gt;Demo&lt;/h1&gt;

&lt;p&gt;For the sake of example, consider the following short proof of the &lt;a href=&quot;https://proofwiki.org/wiki/Second_Borel-Cantelli_Lemma&quot; target=&quot;_blank&quot;&gt;second Borel-Cantelli lemma&lt;/a&gt; (the proof details do not matter for the purposes of this post).&lt;/p&gt;

&lt;div class=&quot;theorem&quot;&gt;

&lt;b&gt;Claim:&lt;/b&gt; If \((E_k)_{k=1}^\infty\) are independent events and \(\sum_{k=1}^\infty \Pr(E_k) = \infty\), then

\[ \Pr \left ( \limsup_{n \to \infty} E_n \right ) = 1. \]
  

&lt;em&gt;Proof.&lt;/em&gt;
Writing out the probability of \(\limsup_{n} E_n\), we have

$$\begin{align}
  &amp;amp;\quad \Pr \left ( \limsup_{n \to \infty} E_n \right )\\
  &amp;amp;\equiv \Pr \left ( \bigcap_{m=1}^\infty \bigcup_{k = m}^\infty E_k \right ) \\
                                                 &amp;amp;{\color{lightgray}{= \lim_{m \to \infty}\Pr \left ( \bigcup_{k = m}^\infty E_k \right )}} \\
                                                 &amp;amp; \color{lightgray}{=1- \lim_{m \to \infty}\Pr \left ( \bigcap_{k = m}^\infty E_k^c \right ) }\\
                                                 &amp;amp; =1- \lim_{m \to \infty} \lim_{K \to \infty}  \Pr \left ( \bigcap_{k = m}^K E_k^c \right ) \\
                                                 &amp;amp;= 1- \lim_{m \to \infty} \lim_{K \to \infty} \prod_{k=m}^K \left [1-\Pr \left ( E_k \right ) \right ]\\
                                                 &amp;amp;\geq 1- \lim_{m \to \infty} \lim_{K \to \infty} \exp \left \{ -\sum_{k=m}^K \Pr(E_k) \right \}\\
                                                 &amp;amp; \color{lightgray}{= 1- \lim_{m \to \infty} \exp \left \{ -\sum_{k=m}^\infty \Pr(E_k) \right \}}\\
                                                 &amp;amp; \color{lightgray}{= 1- \lim_{m \to \infty} 0}\\
                                                 &amp;amp;= 1,
\end{align}$$

which completes the proof. \(\square\)
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;If the above derivations are written with the following TeX, then toggling between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\verbosefalse&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;verbosetrue&lt;/code&gt; in your preamble will remove/include the lines in gray above, respectively.&lt;/p&gt;

&lt;div class=&quot;language-LaTeX highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;\begin{align}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\limsup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;n &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;n &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; )
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\equiv&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m=1&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\bigcup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\ifverbose&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%BEGIN VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt; =1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k&lt;span class=&quot;p&quot;&gt;^&lt;/span&gt;c &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\fi&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%END VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt; =1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;K E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k&lt;span class=&quot;p&quot;&gt;^&lt;/span&gt;c &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\prod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k=m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; [1-&lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ]&lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\geq&lt;/span&gt; 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\exp&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\{&lt;/span&gt; -&lt;span class=&quot;k&quot;&gt;\sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k=m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt;(E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k) &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\}\\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\ifverbose&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%BEGIN VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\exp&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\{&lt;/span&gt; -&lt;span class=&quot;k&quot;&gt;\sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k=m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt;(E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k) &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\}\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; 0&lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\fi&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%END VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1,
&lt;span class=&quot;nt&quot;&gt;\end{align}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s all there is to it.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;Bonus: if you use &lt;a href=&quot;https://github.com/joaotavora/yasnippet&quot;&gt;yasnippet&lt;/a&gt; in emacs or similar tools in neovim etc., it is very handy to have a snippet that creates the following.&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;language-LaTeX highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;\ifverbose&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%BEGIN VERBOSE&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;%&amp;lt;content goes here&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\fi&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%END VERBOSE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Toggling verbosity in LaTeX derivations</title>
   <link href="https://ianws.com/blogposts/toggling-verbosity-latex/"/>
   <updated>2025-07-22T00:00:00+00:00</updated>
   <id>https://ianws.com/blogposts/toggling-verbosity-latex</id>
   <content type="html">\[\newcommand{\Fcal}{\mathcal{F}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\EE}{\mathbb{E}}\]

&lt;p&gt;I find it helpful to write proofs so that they can optionally be made more verbose (e.g. to fill in certain details in a derivation). There’s a very simple trick you can use to accomplish this and it’s already built in to LaTeX; — no additional packages needed. This idea is an adaptation of &lt;a href=&quot;https://old.reddit.com/r/LaTeX/comments/p321rh/is_there_a_way_to_have_two_versions_of_a_document/h8ojktk/&quot;&gt;this reddit comment&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Put the following in your preamble:&lt;/p&gt;

&lt;div class=&quot;language-LaTeX highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;% Verbose LaTeX doc.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\newif\ifverbose&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;% Define a new Boolean value &quot;verbose&quot;.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;% Initially it is false.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\verbosetrue&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;% set verbose to true/false here.&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;\newcommand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\verbose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;[1]&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\ifverbose\textcolor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;gray&lt;span class=&quot;p&quot;&gt;}{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\textit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;verbose &lt;span class=&quot;p&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;\rightarrow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;$}}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\quad&lt;/span&gt; #1&lt;span class=&quot;k&quot;&gt;\textcolor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;gray&lt;span class=&quot;p&quot;&gt;}{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\textit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;non-verbose &lt;span class=&quot;p&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;\rightarrow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;$}}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\quad&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\fi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Any lines you would like to restrict to the “verbose” version of your paper should then be wrapped in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\verbose{&amp;lt;content&amp;gt;}&lt;/code&gt;.&lt;/p&gt;

&lt;h1 id=&quot;demo&quot;&gt;Demo&lt;/h1&gt;

&lt;p&gt;For the sake of example, consider the following short proof of the &lt;a href=&quot;https://proofwiki.org/wiki/Second_Borel-Cantelli_Lemma&quot; target=&quot;_blank&quot;&gt;second Borel-Cantelli lemma&lt;/a&gt; (the proof details do not matter for the purposes of this post).&lt;/p&gt;

&lt;div class=&quot;theorem&quot;&gt;

&lt;b&gt;Claim:&lt;/b&gt; If \((E_k)_{k=1}^\infty\) are independent events and \(\sum_{k=1}^\infty \Pr(E_k) = \infty\), then

\[ \Pr \left ( \limsup_{n \to \infty} E_n \right ) = 1. \]
  

&lt;em&gt;Proof.&lt;/em&gt;
Writing out the probability of \(\limsup_{n} E_n\), we have

$$\begin{align}
  &amp;amp;\quad \Pr \left ( \limsup_{n \to \infty} E_n \right )\\
  &amp;amp;\equiv \Pr \left ( \bigcap_{m=1}^\infty \bigcup_{k = m}^\infty E_k \right ) \\
                                                 &amp;amp;{\ \color{lightgray}{= \lim_{m \to \infty}\Pr \left ( \bigcup_{k = m}^\infty E_k \right )}} \\
                                                 &amp;amp; \ \color{lightgray}{=1- \lim_{m \to \infty}\Pr \left ( \bigcap_{k = m}^\infty E_k^c \right ) }\\
                                                 &amp;amp; =1- \lim_{m \to \infty} \lim_{K \to \infty}  \Pr \left ( \bigcap_{k = m}^K E_k^c \right ) \\
                                                 &amp;amp;= 1- \lim_{m \to \infty} \lim_{K \to \infty} \prod_{k=m}^K \left [1-\Pr \left ( E_k \right ) \right ]\\
                                                 &amp;amp;\geq 1- \lim_{m \to \infty} \lim_{K \to \infty} \exp \left \{ -\sum_{k=m}^K \Pr(E_k) \right \}\\
                                                 &amp;amp; \ \color{lightgray}{= 1- \lim_{m \to \infty} \exp \left \{ -\sum_{k=m}^\infty \Pr(E_k) \right \}}\\
                                                 &amp;amp;\ \color{lightgray}{= 1- 0}\\
                                                 &amp;amp;= 1,
\end{align}$$

which completes the proof. \(\square\)
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;If the above derivations are written with the following TeX, then toggling between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\verbosefalse&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;verbosetrue&lt;/code&gt; in your preamble will remove/include the lines in gray above, respectively.&lt;/p&gt;

&lt;div class=&quot;language-LaTeX highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;nt&quot;&gt;\begin{align}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\limsup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;n &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;n &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; )
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\equiv&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m=1&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\bigcup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\verbose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%BEGIN VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt; =1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k&lt;span class=&quot;p&quot;&gt;^&lt;/span&gt;c &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%END VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt; =1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( &lt;span class=&quot;k&quot;&gt;\bigcap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k = m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;K E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k&lt;span class=&quot;p&quot;&gt;^&lt;/span&gt;c &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\prod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k=m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; [1-&lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; ( E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ) &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; ]&lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\geq&lt;/span&gt; 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\exp&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\{&lt;/span&gt; -&lt;span class=&quot;k&quot;&gt;\sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k=m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;K &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt;(E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k) &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\}\\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\verbose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%BEGIN VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1- &lt;span class=&quot;k&quot;&gt;\lim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;m &lt;span class=&quot;k&quot;&gt;\to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\exp&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\left&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\{&lt;/span&gt; -&lt;span class=&quot;k&quot;&gt;\sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;_{&lt;/span&gt;k=m&lt;span class=&quot;p&quot;&gt;}^&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\infty&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\Pr&lt;/span&gt;(E&lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;k) &lt;span class=&quot;k&quot;&gt;\right&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;\}\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1- 0&lt;span class=&quot;k&quot;&gt;\\&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%END VERBOSE&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;amp;&lt;/span&gt;= 1,
&lt;span class=&quot;nt&quot;&gt;\end{align}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s all there is to it.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;Bonus: if you use &lt;a href=&quot;https://github.com/joaotavora/yasnippet&quot;&gt;yasnippet&lt;/a&gt; in emacs or similar tools in neovim etc., it is very handy to have a snippet that creates the following.&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;language-LaTeX highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;\verbose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%BEGIN VERBOSE&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;%&amp;lt;content goes here&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;%END VERBOSE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;center&gt;&lt;em&gt;(This is an updated version of an older &lt;a href=&quot;/blogposts/toggling-verbosity-latex-old&quot;&gt;post&lt;/a&gt; on the same topic)&lt;/em&gt;&lt;/center&gt;

</content>
 </entry>
 
 <entry>
   <title>A beamer theme inspired by macOS Keynote aesthetics</title>
   <link href="https://ianws.com/blogposts/beamertheme-pittsburgh/"/>
   <updated>2025-07-28T00:00:00+00:00</updated>
   <id>https://ianws.com/blogposts/beamertheme-pittsburgh</id>
   <content type="html">&lt;p&gt;A few years ago, I made &lt;a href=&quot;https://github.com/WannabeSmith/beamertheme-pittsburgh/&quot;&gt;a LaTeX beamer theme&lt;/a&gt; for presentations. In a nutshell, I began to adore the types of slides that could be made in Keynote on macOS but noticed three shortcomings:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Keynote does not run on Linux,&lt;/li&gt;
  &lt;li&gt;Its files are large relative to their content, and&lt;/li&gt;
  &lt;li&gt;Its math fonts don’t match the LaTeX ones.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Points 2 and 3 are minor annoyances but 1 is a deal-breaker for me. Fortunately, beamer is cross-platform, is very space-efficient, and math fonts are obviously native. However, I could not find a theme with the aesthetic sensibilities of Keynote so I attempted to make one and I have been using it ever since. Some screenshots of demo slides can be found below.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;images-beamerthemepgh&quot; src=&quot;/assets/images/blogposts/beamertheme-pittsburgh/demo_titlepage.jpg&quot; /&gt;
&lt;br /&gt;
&lt;img class=&quot;images-beamerthemepgh&quot; src=&quot;/assets/images/blogposts/beamertheme-pittsburgh/demo_collaborators.jpg&quot; /&gt;
&lt;br /&gt;
&lt;img class=&quot;images-beamerthemepgh&quot; src=&quot;/assets/images/blogposts/beamertheme-pittsburgh/demo_textbox.jpg&quot; width=&quot;400&quot; /&gt;
&lt;br /&gt;
&lt;img class=&quot;images-beamerthemepgh&quot; src=&quot;/assets/images/blogposts/beamertheme-pittsburgh/demo_width.jpg&quot; width=&quot;400&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The rest of the demo slides can be found &lt;a href=&quot;https://github.com/WannabeSmith/beamertheme-pittsburgh/blob/main/demo/demo_presentation.pdf&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 

 
 <entry>
   <title>Singapore</title>
   <link href="https://ianws.com/photos/singapore2025"/>
   <updated>2025-12-08T00:00:00+00:00</updated>
   <id>https://ianws.com/photos/singapore2025</id>
   <content type="html">
</content>
 </entry>
 
 <entry>
   <title>Taipei, Taiwan</title>
   <link href="https://ianws.com/photos/taiwan2025"/>
   <updated>2025-12-08T00:00:00+00:00</updated>
   <id>https://ianws.com/photos/taiwan2025</id>
   <content type="html">
</content>
 </entry>
 
 <entry>
   <title>Butte-aux-Cailles, Paris, France</title>
   <link href="https://ianws.com/photos/parisdecember2025"/>
   <updated>2025-12-10T00:00:00+00:00</updated>
   <id>https://ianws.com/photos/parisdecember2025</id>
   <content type="html">
</content>
 </entry>
 
 <entry>
   <title>Seville, Spain</title>
   <link href="https://ianws.com/photos/seville2025"/>
   <updated>2025-12-10T00:00:00+00:00</updated>
   <id>https://ianws.com/photos/seville2025</id>
   <content type="html">
</content>
 </entry>
 

</feed>
