我需要让以下内容产生两个相反的列表,分别用英语(左对齐)和阿拉伯语(右对齐),同时理解警告背后的原因
语言“Arabic”不适用于字体(fontspec)“Scheherazade”和脚本“Arabic”。
此外,为什么没有\hrules
在 tcbraster 之前和之后绘制?
\documentclass[12pt, a4paper]{article}
\usepackage[tuenc,no-math]{fontspec}
\setmainfont[
Ligatures = {
NoCommon, % liga
NoRare,% dlig
}
]{Latin Modern Roman}
\newfontfamily\arabicfont{Scheherazade}[ Script = Arabic, RawFeature={+anum}, Scale = 1]
\usepackage[english, bidi = basic]{babel}
\babelprovide[import, onchar = ids fonts]{arabic}
\babelfont[arabic]{rm}{Scheherazade} % [Scale = 2]{Scheherazade}
\babelfont[arabic]{sf}{Scheherazade}
\usepackage[xparse,breakable,raster,skins, fitting]{tcolorbox}
\usepackage{ulem, enumitem}
\parindent=0pt
\begin{document}
\begin{tcbraster}[
raster columns = 2,
valign = center,
raster before skip = 1ex,
raster after skip = 1ex,
blankest,
height = 3em,
before = \hrule,
after = \hrule
]
\tcboxfit[ halign = flush left , right = 1ex ]{
\textbf{\uline{Important Rules:}}
\begin{itemize}[
label = \textbullet, leftmargin=*, labelsep = \fontdimen2\font, itemsep = 0.5\baselineskip, %nosep
topsep = 0.5\baselineskip,
font=\bfseries, before=\bfseries % https://tex.stackexchange.com/a/164268/2288
]
\item First rule.
\item Second rule
\end{itemize}%
}
\tcboxfit[ halign = flush right, left = 1ex ]{%
\textbf{\uline{%
قواعد هامة:%
}}
\begin{itemize}[
label = \textbullet, leftmargin=*, labelsep=\fontdimen2\font, itemsep = 0\baselineskip, %nosep
topsep = 0.5\baselineskip, font=\bfseries, before=\bfseries
]
\item القاعدة الأولى
\item القاعدة الثانية
\end{itemize}%
}%
\end{tcbraster}%
\end{document}
答案1
此外,为什么不在
\hrule
tcbraster 之前和之后绘制 s?
tcbraster
环境不是从 派生而来的tcolorbox
,而更像是一个简单的minipage
。因此tcolorbox
选项before=<code>
和after=<code>
被忽略。
此外,\hrule
它只适用于类似表格的环境。请尝试\par\noindent\hrulefill\par
一下。
为了从右到左排版阿拉伯语文本,\begin{otherlanguage}{arabic} ... \end{otherlanguage}
添加了环境(参见Overleaf.com 上的指南),并halign = flush right
从第二个 中删除该选项\tcbboxfit
。
% !TeX TS-program = lualatex
\documentclass[12pt, a4paper]{article}
\usepackage[tuenc,no-math]{fontspec}
\setmainfont[
Ligatures = {
NoCommon, % liga
NoRare,% dlig
}
]{Latin Modern Roman}
\newfontfamily\arabicfont{Scheherazade}[ Script = Arabic, RawFeature={+anum}, Scale = 1]
\usepackage[english, bidi = basic]{babel}
\babelprovide[import, onchar = ids fonts]{arabic}
\babelfont[arabic]{rm}{Scheherazade} % [Scale = 2]{Scheherazade}
\babelfont[arabic]{sf}{Scheherazade}
\usepackage[xparse,breakable,raster,skins, fitting]{tcolorbox}
\usepackage{ulem, enumitem}
\parindent=0pt
\begin{document}
\noindent\hrulefill\par
\begin{tcbraster}[
raster columns = 2,
valign = center,
raster before skip = 1ex,
raster after skip = 1ex,
blankest,
height = 3em,
before = abc\hrulefill,
after = \hrulefill
]
\tcboxfit[ halign = flush left , right = 1ex ]{
\textbf{\uline{Important Rules:}}
\begin{itemize}[
label = \textbullet, leftmargin=*, labelsep = \fontdimen2\font, itemsep = 0.5\baselineskip, %nosep
topsep = 0.5\baselineskip,
font=\bfseries, before=\bfseries % https://tex.stackexchange.com/a/164268/2288
]
\item First rule.
\item Second rule
\end{itemize}%
}
\tcboxfit[ left = 1ex ]{%
\begin{otherlanguage}{arabic}
\textbf{\uline{%
قواعد هامة:%
}}
\begin{itemize}[
label = \textbullet, leftmargin=*, labelsep=\fontdimen2\font, itemsep = 0\baselineskip, %nosep
topsep = 0.5\baselineskip, font=\bfseries, before=\bfseries
]
\item القاعدة الأولى
\item القاعدة الثانية
\end{itemize}%
\end{otherlanguage}
}%
\end{tcbraster}%
\noindent\hrulefill\par
\end{document}