请参阅下面给出的 MWE,其中我们使用两种语言。英语是主要语言,孟加拉 是第二语言。
\documentclass[11pt]{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\newfontfamily\englishfont{Times New Roman}
\setotherlanguage[numerals=Devanagari]{bengali}
\newfontfamily\bengalifont[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\newfontfamily\bengalifontbf[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\newfontfamily\bengalifonttt[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\newfontfamily\bengalifontsf[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi}
\begin{document}
English text.
% Languages switching works fine in normal text.
\begin{bengali}
বাংলা লেখা
\end{bengali}
% Languages switching fails in section name.
\section{English text \begin{bengali}বাংলা লেখা\end{bengali}}
% Even protecting does not work
\protect{\section{English text \begin{bengali}বাংলা লেখা\end{bengali}}}
\end{document}
编译时,我们收到一条错误消息:
! Argument of \@sect has an extra }. <inserted text> \par l.22 ...বাংলা লেখা\end{bengali}}
我们怎样解决这个问题?