表格环境中的 \foreignlanguage

表格环境中的 \foreignlanguage

\foreignlanguage在 中不起作用tabular。如何在 中切换语言tabular

\documentclass[spanish,russian]{scrbook}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{misccorr}
\usepackage{array}

\begin{document}

\selectlanguage{russian}

\foreignlanguage{spanish}{This text is ok.} Здесь всё хорошо.

\begin{tabular}{ll}
\foreignlanguage{spanish}{Not work: some words in spanish.} & А здесь по-русски. \\
\end{tabular}

\end{document}

pdfLaTeX 说:

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.15 ...spanish}{Not work: some words in spanish.}
                                                   & А здесь по-ру...

? 

答案1

哦,这有点奇怪,你也许应该将其报告为 babel 中的一个错误,但是一个额外的小组修复了它:

\documentclass[spanish,russian]{scrbook}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{misccorr}
\usepackage{array}

\begin{document}

\selectlanguage{russian}

\foreignlanguage{spanish}{This text is ok.} Здесь всё хорошо.

\begin{tabular}{ll}
{\foreignlanguage{spanish}{Not work: some words in spanish.}}& А здесь по-русски. \\
\end{tabular}

\end{document}

相关内容