如何在本地激活或停用 Babel 布局

如何在本地激活或停用 Babel 布局

考虑这个例子,如何在 RTL 上下文中停用表格布局

\documentclass{article}
\usepackage[nil,bidi=basic-r,layout=counters.lists.tabular]{babel}
\babelprovide[import, main]{arabic}
\babelfont{rm}{Amiri}

\begin{document}

\begin{tabular}{c|c}
right text & left text  
\end{tabular}

% macro to deactivate tabular layout  

\begin{tabular}{c|c}
left text & right text  
\end{tabular}

\end{document}

答案1

没有内置命令,但你可以在加载 babel 之前保存原始定义:

\documentclass{article}
\makeatletter
\let\@oritabular\@tabular
\newcommand\restoretabularlayout{\let\@tabular\@oritabular}
\makeatother

\usepackage[nil,bidi=basic-r,layout=counters.lists.tabular]{babel}
\babelprovide[import, main]{arabic}
\babelfont{rm}{Amiri}

\begin{document}

\begin{tabular}{c|c}
right text & left text
\end{tabular}

% macro to deactivate tabular layout
{
\restoretabularlayout

\begin{tabular}{c|c}
left text & right text
\end{tabular}
}

\begin{tabular}{c|c}
left text & right text
\end{tabular}


\end{document}

在此处输入图片描述

相关内容