# Funky interactions of bbm and hyperref packages [duplicate]

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]$}

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.