
Estou tentando usar o bbm (para escrever meu estilo preferido de variáveis de indicador) e os pacotes hyperref (para fazer referência a URLs da web).
No entanto, algo estranho parece acontecer sempre que uso bbm no título de uma subseção. Alguma ideia do que pode estar acontecendo aqui? Exemplo simples:
\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}
A matemática em si é compilada perfeitamente em PDF, assim como o corpo do texto, nesse caso.
No entanto, uma caixa vermelha tende a aparecer em algum lugar do documento (que desaparece se eu clicar em algum lugar do .pdf). Além disso, meu compilador (estou usando o plugin LaTeXTools para SublimeText 3 no Linux que opera em latexmk) me dá as seguintes mensagens de aviso, que não tenho ideia de como 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.
Se eu excluir a mathbbm
instância do subsection
título, a caixa vermelha aleatória ainda aparecerá, mas os avisos pararão.
Responder1
O equivalente unicode de \mathbb{1}
é o caractere 1D7D9
, que deve ser inserido no \texorpdfstring
uso\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}
Uma lista visual de caracteres e seus códigos pode ser obtida, por exemplo, em http://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols