perkee's blog

I heard you like science. tags
May 15
Permalink
LaTeX math with anotations that doesn’t look horrible.
Of note is the use of align with multiple points of alignment, each denoted by a single ampersand.
I’m pretty proud of this. Source is below, with some stuff taken out.
Sorry I can’t post full source anymore.


\usepackage{commath}
\newcommand\cartesian\times
\newcommand\union\cup

…

Let us choose $a\in A$ and let $A'=A-\set a$.
Then $\absolute{A'}=k$ and so---by our inductive
hypothesis---$\absolute{A'\cartesian A'}=k^2$
\begin{align*}
  &\text{But}&\absolute{A\cartesian A}
  &=\absolute{\left(A'\union\set a\right)\cartesian
    \left(A'\union\set a\right)}&\\
  &&&=\absolute{\left(A'\cartesian A'\right)\union
    \left(\set a\cartesian A'\right)\union
    \left(A'\cartesian\set a\right)\union
    \left(\set a\cartesian\set a\right)}&
      \parbox{10em}{
        \raggedleft
          \scriptsize{%\noindent
          The cartesian product
          distributes over union.
          }
      }\\
  &&&=\underbrace{\absolute{A'\cartesian A'}}_
    {\parbox{4em}
      {
        \centering
          \scriptsize{
            $k^2$
            \begin{flushleft}
              by the inductive hypothesis
            \end{flushleft}
          }
        %centering ends here
      }
    }+
    \underbrace{\absolute{\set a\cartesian A'}}_
    {\parbox{4.5em}
      {
        \centering
          \scriptsize{
            $k$
            \begin{flushleft}
              because each one of the $k$
              elements in $A'$ matches up
              once with the single element
              in $\set a$
            \end{flushleft}
          }
        %centering ends here
      }
    }+
    \underbrace{\absolute{A'\cartesian\set a}}_
    {\parbox{4em}
      {
        \centering
          \scriptsize{
            $k$
            \begin{flushleft}
              likewise
            \end{flushleft}
          }
        %centering ends here
      }
    }+
    \underbrace{\absolute{\ordered{a,a}}}_1&
    \parbox{10em}{
      \raggedleft
      \scriptsize{
      The size of a union of sets is equal to the 
      sum of the sizes of the constituent sets.}
    }\\
  &&&=k^2+2k+1&\\
  &&&={(k+1)}^2&\text{as desired.}
\end{align*}

LaTeX math with anotations that doesn’t look horrible. Of note is the use of align with multiple points of alignment, each denoted by a single ampersand. I’m pretty proud of this. Source is below, with some stuff taken out. Sorry I can’t post full source anymore.

\usepackage{commath}
\newcommand\cartesian\times
\newcommand\union\cup

Let us choose $a\in A$ and let $A'=A-\set a$.
Then $\absolute{A'}=k$ and so---by our inductive
hypothesis---$\absolute{A'\cartesian A'}=k^2$
\begin{align*}
  &\text{But}&\absolute{A\cartesian A}
  &=\absolute{\left(A'\union\set a\right)\cartesian
    \left(A'\union\set a\right)}&\\
  &&&=\absolute{\left(A'\cartesian A'\right)\union
    \left(\set a\cartesian A'\right)\union
    \left(A'\cartesian\set a\right)\union
    \left(\set a\cartesian\set a\right)}&
      \parbox{10em}{
        \raggedleft
          \scriptsize{%\noindent
          The cartesian product
          distributes over union.
          }
      }\\
  &&&=\underbrace{\absolute{A'\cartesian A'}}_
    {\parbox{4em}
      {
        \centering
          \scriptsize{
            $k^2$
            \begin{flushleft}
              by the inductive hypothesis
            \end{flushleft}
          }
        %centering ends here
      }
    }+
    \underbrace{\absolute{\set a\cartesian A'}}_
    {\parbox{4.5em}
      {
        \centering
          \scriptsize{
            $k$
            \begin{flushleft}
              because each one of the $k$
              elements in $A'$ matches up
              once with the single element
              in $\set a$
            \end{flushleft}
          }
        %centering ends here
      }
    }+
    \underbrace{\absolute{A'\cartesian\set a}}_
    {\parbox{4em}
      {
        \centering
          \scriptsize{
            $k$
            \begin{flushleft}
              likewise
            \end{flushleft}
          }
        %centering ends here
      }
    }+
    \underbrace{\absolute{\ordered{a,a}}}_1&
    \parbox{10em}{
      \raggedleft
      \scriptsize{
      The size of a union of sets is equal to the 
      sum of the sizes of the constituent sets.}
    }\\
  &&&=k^2+2k+1&\\
  &&&={(k+1)}^2&\text{as desired.}
\end{align*}
Comments (View)
blog comments powered by Disqus