I'm trying to use both the bbm (to write my preferred style of indicator variables) and the hyperref packages (to reference web URLs).
However, something strange seems to be going on whenever I use bbm in a subsection title. Any idea what might be going on here? Simple example:
\documentclass[12pt,titlepage]{article}
\usepackage{bbm}
\usepackage{hyperref}
\begin{document}
\subsection{Model: Logistic Regression of $\mathbbm{1}\left[var\right]$}
\href{http://www.google.com}{This} is a hyperlink, and
this\footnote{footnote} is a footnote.
$\mathbbm{1}\left[x\in S\right]$ is an indicator in plain text
\end{document}
The math itself compiles to pdf just fine, as well as the body text, for that matter.
However, a red box tends to show up somewhere in the document (which goes away if I click somewhere in the .pdf). Further, my compiler (I'm using the LaTeXTools plugin to SublimeText 3 on Linux which operates on latexmk) gives me the following warning messages, which I've no idea how to interpret.
./test.tex:8: Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `math shift' on input line 8.
./test.tex:8: Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\left' on input line 8.
./test.tex:8: Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\right' on input line 8.
./test.tex:8: Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `math shift' on input line 8.
If I exclude the mathbbm instance from the subsection title, the random red box still appears, but the warnings stop.

TeXcode intobookmarks(that's what your doing with\subsection{$\mathbb{1}}effectively. You need\texorpdfstring{\mathbb{1}}{something for bookmark}– Feb 16 '15 at 00:05hyperrefpackage is ?loaded?/?invoked?,sectionandsubsectionheaders are translated asbookmarks (for, e.g., linking from a ToC--even though I don't have a ToC). So while including math in these headers is generally kosher, combining withhyperrefengenders some parsing issues. – MichaelChirico Feb 16 '15 at 00:16{something for bookmark}bit? 3) What about this ephemeral red box? – MichaelChirico Feb 16 '15 at 00:17