
嘗試使用 tikz 命令在我的頁面周圍製作邊框時,tikz 命令後的第一行文字未對齊(正弦文檔為阿拉伯語(主要語言設定)),其中文字在左側對齊,而不是在右側對齊。此外,單字輸入正確,但順序相反。取消邊框後,文字輸出正確。我正在使用 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
問題是雙重的。
當您將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}