-1

This only throws the error when running it with TexLive 2017 on Debian 9. If I run the same example on Windows 10 with MikTex, everything works fine:

\PassOptionsToPackage{main=brazil,english,spanish,french}{babel}
\documentclass[brazilian,brazil,10pt,a4paper,]{memoir}

\usepackage{babel}
\usepackage{hyperref}

\newcommand{\autor}[1]{\author{#1}}
\newcommand{\imprimirautor}{\theauthor}
\newcommand{\brazilword}[1]{\foreignlanguage{brazil}{#1}}

\autor{\brazilword{Your Name}}
\hypersetup{
  pdfauthor={\imprimirautor},
}

\begin{document}
Hi.
\end{document}
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
! Argument of \bbl@tempd has an extra }.
<inserted text>
                \par
l.14 }

? H
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
  • 1
    Your example does not work fine with miktex: check the author in the pdf properties, you will see the word "brazil" there. Adding \protect helps, but in general it is not a good idea to add lots of complicated commands like \foreignlanguage to stuff that should end in the pdf booksmarks or info dictionary. – Ulrike Fischer Oct 21 '19 at 9:16
  • @UlrikeFischer, MikTex should throw an error as TexLive does at least. – user Oct 21 '19 at 17:26
  • a current texlive doesn't give an error either. – Ulrike Fischer Oct 21 '19 at 17:33
0

Researching for it, I could find these related questions:

  1. microtype expansion leads to error in pdfauthor
  2. XeLaTex + babel (\addto\extras{lang}) + hyperref

I tried both of these answers, but none of them worked.

After looking over the code, I found that adding \protect before the \foreignlanguage babel command, fixed it for TexLive 2017 and MikTeX. The only question is why it worked correctly before for MikTeX without "protection" while it throw errors for TexLive.

  1. https://texfaq.org/FAQ-protect
  2. What is the purpose of \protect?
  3. What is the difference between Fragile and Robust commands?
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.