7

(Other answers (A, B) with similar error message do not actually take care of the situation.)

I have memoir document which should contain title both in Bangla and English. But when compiled (using xelatex), I get an error message,

! Argument of \reserved@a has an extra }.

Here is the MWE which causes the error.

\documentclass{memoir}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[numerals=Devanagari]{bengali}

\title{\begin{bengali} বইয়ের টাইটেল\end{bengali}
  Book Title}

\begin{document}

\maketitle

\end{document}

If the part \begin{bengali} বইয়ের টাইটেল\end{bengali} is taken out of the file, the error disappears. So, that line must the culprit here.

As is advised in the questions (or answers) mentioned at the top, I need to protect something. However, I am a little confused what to protect here. I even tried putting \protect around \begin{bengali} বইয়ের টাইটেল\end{bengali}, without any avail. (Just a hunch, not an educated one.)

1
  • 1
    You need to protect commands, so you could try \protect\begin .... and \protect\end... (but using an already robust command as suggested in the answer is easier). – Ulrike Fischer Mar 5 '16 at 8:25
5

The \begin macro which starts an environment is "fragile", which means it cannot be used inside a moving argument. The \title command expands its argument, and therefore fragile commands can't be used inside it.

See the following question for an explanation of this.

So the solution is to not use the {bengali} environment inside the title.

(You could actually "protect" the environment by using \protect\begin{bengali} .... \protect\end{bengali}) but there is a simpler solution:

Just use \textbengali{}:

\documentclass{memoir}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[numerals=Devanagari]{bengali}
\newfontfamily\bengalifont[]{Bangla MN}
\title{\textbengali{বইয়ের টাইটেল}
  Book Title}

\begin{document}

\maketitle
\end{document}

output of code

2
  • 1
    If you could enrich answer a bit by letting us know why the \bengali environment can not be used inside the title, it would be more enlightening. – Masroor Mar 5 '16 at 6:53
  • This answer actually helped me with another issue, not related to language environments but returning the same error and stemming from the same basic cause. Turned out I needed to similarly \protect my use of \includegraphics within \lettrine. – Frigo Jan 16 '20 at 13:59
0

In order to add a complement. After upgrade texlive 2017 to 2019, I had an equivalent problem.

And i solved problem by add \protect my use of \includegraphics within \lettrine

\documentclass{book}
% test-remarque_01
\usepackage{graphics}
\graphicspath{{images/}}
\usepackage[most]{tcolorbox}
\usepackage{lettrine}

\newtcolorbox{myremarque}{
enhanced,
boxrule=0pt,frame hidden,
borderline west={4pt}{0pt}{red},
colback=white,
sharp corners
}

\newcommand{\remarquestart}{\lettrine[findent=2pt]{\protect\includegraphics[height=\baselineskip]{remarque.png}}{ }\textbf{Remarque:}\quad}

\usepackage{lipsum}

\begin{document}
\begin{myremarque}
  \remarquestart
  \lipsum[4]
\end{myremarque}
\lipsum[1]
\end{document} 

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.