
Estoy intentando utilizar tanto el paquete bbm (para escribir mi estilo preferido de variables indicadoras) como el paquete hyperref (para hacer referencia a las URL web).
Sin embargo, parece suceder algo extraño cada vez que uso bbm en el título de una subsección. ¿Alguna idea de lo que podría estar pasando aquí? Ejemplo sencillo:
\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}
Las matemáticas en sí se compilan en pdf muy bien, al igual que el texto del cuerpo, de hecho.
Sin embargo, tiende a aparecer un cuadro rojo en algún lugar del documento (que desaparece si hago clic en algún lugar del .pdf). Además, mi compilador (estoy usando el complemento LaTeXTools para SublimeText 3 en Linux que opera en latexmk) me da los siguientes mensajes de advertencia, que no tengo idea de cómo interpretar.
./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.
Si excluyo la mathbbm
instancia del subsection
título, el cuadro rojo aleatorio sigue apareciendo, pero las advertencias se detienen.
Respuesta1
El equivalente Unicode \mathbb{1}
es el carácter 1D7D9
, que debe insertarse \texorpdfstring
usando\unicode{"1D7D9}
\documentclass[12pt,titlepage]{article}
\usepackage[utf8]{inputenc}
\usepackage{bbm}
\usepackage[pdfencoding=auto,unicode=true]{hyperref}
\begin{document}
\subsection{Model: Logistic Regression of \texorpdfstring{$\mathbbm{1}}{\unichar{"1D7D9}}\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}
Se puede obtener una lista visual de caracteres y sus códigos, por ejemplo, en http://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols