
Tengo dos archivos. Mi archivo tex principal y un archivo con varias definiciones (no un archivo .sty sino otro archivo .tex).
Si intento configurar mis metadatos PDF desde mis \@title
macros con el \AtBeginDocument
comando (pero definido en el archivo externo), obtengo algunos errores como:
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing `\spacefactor' on input line 14.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing `\@m' on input line 14.
y mis metadatos son simplemente "título". Sin embargo, si coloco el código en mi archivo principal, funciona como se esperaba. Un mwe sería el siguiente:
% main file
\documentclass{scrartcl}
\input{externalfile.tex}
\title{This is a test}
% WORKS
% \makeatletter
% \hypersetup{
% pdftitle={\@title}
% }
% \makeatother
\begin{document}
test
\end{document}
% external file
\usepackage{hyperref}
% DOESN'T WORK
\AtBeginDocument{
\makeatletter
\hypersetup{
pdftitle={\@title}
}
\makeatother
}
Se agradece cualquier idea. Sin embargo, me gustaría mantener el archivo externo como un archivo .tex (y no cambiar a un archivo .sty. Si esto hace alguna diferencia)