![更新 2020/08/22](https://linux22.com/image/419521/%E6%9B%B4%E6%96%B0%202020%2F08%2F22.png)
使用\pagedir TRT
来自 包\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm,landscape]
的pgfpages
生成逻辑页面将移出页面。
布局也有同样的问题4 on 1
,,8 on 1
。16 on 1
% lualatex
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm,landscape]
\begin{document}
\pagedir TRT \bodydir TRT \pardir TRT
\Huge
Page 1
\newpage
Page 2
\end{document}
更新 2020/08/22
我找到了一种使用来移动逻辑页面的方法\pagerightoffset
,问题是对于每个布局我都需要手动添加移动量。
2 对 1 布局横向页面示例
% lualatex
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}[a4paper,landscape]
\begin{document}
\pagerightoffset = .55\pgfphysicalwidth % <--
\pagedir TRT \bodydir TRT \pardir TRT
\Huge
Page 1
\newpage
Page 2
\end{document}
答案1
我认为您必须制作一个将页面以 RTL 形式布局的新布局。
我将布局中的一行2 on 1
从:
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
到:
center=\pgfpoint{-.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
可以使用以下方法执行此操作xpatch
:
\usepackage{xpatch}
\expandafter\xpatchcmd\csname pgfpages@layout@2 on 1\endcsname
{center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}}
{center=\pgfpoint{-.25\pgfphysicalwidth}{.5\pgfphysicalheight}}
{}
{}
对于每页包含更多页面的布局,您需要多次调用xpatchcmd
。
完整示例:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{pgfpages}
\pgfpagesdeclarelayout{rtl 2 on 1}
{
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default
\edef\pgfpageoptionwidth{\the\paperheight}
\def\pgfpageoptionborder{0pt}
\def\pgfpageoptionfirstshipout{1}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=2,%
physical height=\pgfpageoptionheight,%
physical width=\pgfpageoptionwidth,%
current logical shipout=\pgfpageoptionfirstshipout%
}
\ifdim\paperheight>\paperwidth\relax
% put side-by-side
\pgfpageslogicalpageoptions{1}
{%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{2}
{%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
center=\pgfpoint{-.25\pgfphysicalwidth}{.5\pgfphysicalheight}% <- Shift second page to left hand side
}%
\else
% stack on top of one another
\pgfpageslogicalpageoptions{1}
{%
border shrink=\pgfpageoptionborder,%
resized width=\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{2}
{%
border shrink=\pgfpageoptionborder,%
resized width=\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
}%
\fi
}
\pgfpagesuselayout{rtl 2 on 1}[a4paper,border shrink=5mm,landscape]
\usepackage[bidi=basic-r,nil]{babel}
\babelprovide[import,main]{arabic}
\babelfont{rm}{Amiri}
\begin{document}
\Huge
نص من اليمين الى اليسار
الصفحة الأولى 1
\newpage
\Huge
نص من اليمين الى اليسار
الصفحة الثانية 2
\end{document}