
tikz コマンドを使用してページの周囲に境界線を作成しようとすると、tikz コマンド後のテキストの最初の行がずれてしまいます (ドキュメントがアラビア語 (メイン言語設定) であるため)。テキストは RHS ではなく LHS に揃えられています。また、単語は正しく入力されていますが、逆の順序になっています。境界線をキャンセルすると、テキスト出力は正しくなります。私は XELATEX + POLYGLYOSSIA を使用しています。簡略化されたアラビア語フォントのリンクはこちらです (コードを正しく実行するには、Windows にインストールしてください :https://fontzone.net/font-details/simplified-arabic
コードは次のとおりです:
\documentclass[a4paper,12pt,twoside]{book}
\usepackage{fontspec}
\usepackage{tcolorbox}
\usepackage{url,graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,arrows,positioning,matrix,quotes, shapes.geometric,calc}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,locale=default,numerals=mashriq]{arabic}
\setotherlanguages{english}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Simplified Arabic}
\title{jhhjjhhj}
\author{}
\date{}
\begin{document}
\chapter{شكر وتقدير}
\begin{tikzpicture}[remember picture, overlay]
\draw[line width = 4pt] ($(current page.north west) + (1in,-1in)$) rectangle ($(current page.south east) + (-1in,1in)$);
\end{tikzpicture}
\textbf{
يتقدم المؤلف بالشكر لكل من:}
\end{document}
答え1
問題は2つあります。
tikz
画像を直接実行すると\textbf{}
、テキストの RTL フローが乱れます。
これを修正するために段落スペースを残すと、不要な垂直スペースが生じます。
eso-pic
出荷時にページの背景に境界線を追加するには、パッケージに含まれているような方法を使用する必要があります。
ムウェ
この MWE は、コマンドを含むすべてのページに境界線を追加します\insertpageborder
。
\documentclass[a4paper,12pt,twoside]{book}
\usepackage{fontspec}
\usepackage{tcolorbox}
\usepackage{url,graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,arrows,positioning,matrix,quotes, shapes.geometric,calc}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,locale=default,numerals=mashriq]{arabic}
\setotherlanguages{english}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\usepackage{eso-pic}
\newcommand{\insertpageborder}{%
\AddToShipoutPictureBG*{%
\begin{tikzpicture}[remember picture, overlay]
\draw[line width = 4pt] ($(current page.north west) + (1in,-1in)$) rectangle ($(current page.south east) + (-1in,1in)$);
\end{tikzpicture}}}
\begin{document}
\chapter{شكر وتقدير}
\insertpageborder
\textbf{يتقدم المؤلف بالشكر لكل من:}
\end{document}