如何制作includepdf RTL的nup布局?(pdfpages)

如何制作includepdf RTL的nup布局?(pdfpages)

我正在尝试打印出包含多个朗诵内容的各种备忘单。使用 \includepdf 标签的“nup”设置,pdfpages 应该能够完全满足我的需要。

但是,我遇到了布局问题,因为朗诵是用希伯来语写的,这需要从右到左的布局(这意味着包含的 PDF 页面应该从右到左出现)。

举例来说,实现列中的“从右到左”的行为将如下所示:

\includepdf[pages={7-9,4-6,1-3}, column=true, nup=3x3,landscape=true, pagecommand=\subsection*{}]{Recitation 1 - Complexity.pdf}

常规 RTL 布局如下所示:

\includepdf[pages={3-1,6-4,9-7}, nup=3x3,landscape=true, pagecommand=\subsection*{}]{Recitation 1 - Complexity.pdf}

而不是仅仅写“pages={1-9}”。

我不知道如何实现这一自动化,并且使用常规的 LTR 布局会使这个备忘单对于希伯来语母语人士来说很烦人(我想适当的解决方案对所有 RTL 语言使用者也会有用)。

如何实现正确的 RTL 行为?有没有什么解决方法?

先感谢您!

以下是总体 RTL 布局的草图: RTL 布局 3x3

答案1

一种可能的解决方法是使用该pdfpages包包含全尺寸页面,然后使用该pgfpages包每页安排 9 页。

pgfpages包允许定义任意布局,因此您可以为 LTR 行和列创建布局。下面是一个例子:

\documentclass{article}

\usepackage{pdfpages}

\usepackage{pgfpages}
  
\pgfpagesdeclarelayout{9 on 1 RTL columns}
{
  \edef\pgfpageoptionheight{\the\paperheight} % landscaped by default
  \edef\pgfpageoptionwidth{\the\paperwidth}
  \def\pgfpageoptionborder{0pt}
}
{
  \pgfpagesphysicalpageoptions
  {%
    logical pages=9,%
    physical height=\pgfpageoptionheight,%
    physical width=\pgfpageoptionwidth%
  }
  \pgfpageslogicalpageoptions{1}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.833\pgfphysicalwidth}{0.833\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{4}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.5\pgfphysicalwidth}{0.833\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{7}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.166\pgfphysicalwidth}{0.833\pgfphysicalheight}%
  }%  
  \pgfpageslogicalpageoptions{2}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.833\pgfphysicalwidth}{0.5\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{5}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.5\pgfphysicalwidth}{0.5\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{8}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.166\pgfphysicalwidth}{0.5\pgfphysicalheight}%
  }%    
  \pgfpageslogicalpageoptions{3}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.833\pgfphysicalwidth}{0.166\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{6}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.5\pgfphysicalwidth}{0.166\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{9}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.166\pgfphysicalwidth}{0.166\pgfphysicalheight}%
  }%    
}
    
\pgfpagesdeclarelayout{9 on 1 RTL rows}
{
  \edef\pgfpageoptionheight{\the\paperheight} % landscaped by default
  \edef\pgfpageoptionwidth{\the\paperwidth}
  \def\pgfpageoptionborder{0pt}
}
{
  \pgfpagesphysicalpageoptions
  {%
    logical pages=9,%
    physical height=\pgfpageoptionheight,%
    physical width=\pgfpageoptionwidth%
  }
  \pgfpageslogicalpageoptions{1}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.833\pgfphysicalwidth}{0.833\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{2}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.5\pgfphysicalwidth}{0.833\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{3}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.166\pgfphysicalwidth}{0.833\pgfphysicalheight}%
  }%  
  \pgfpageslogicalpageoptions{4}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.833\pgfphysicalwidth}{0.5\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{5}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.5\pgfphysicalwidth}{0.5\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{6}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.166\pgfphysicalwidth}{0.5\pgfphysicalheight}%
  }%    
  \pgfpageslogicalpageoptions{7}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.833\pgfphysicalwidth}{0.166\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{8}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.5\pgfphysicalwidth}{0.166\pgfphysicalheight}%
  }%
  \pgfpageslogicalpageoptions{9}
  {%
    border shrink=\pgfpageoptionborder,%
    resized width=.33\pgfphysicalwidth,%
    resized height=.33\pgfphysicalheight,%
    center=\pgfpoint{0.166\pgfphysicalwidth}{0.166\pgfphysicalheight}%
  }%    
}    
  



\begin{document}

\pgfpagesuselayout{9 on 1 RTL columns}[landscape]

\includepdf[pages=1-]{example-image-a4-numbered}

\pgfpagesuselayout{9 on 1 RTL rows}

\includepdf[pages=1-]{example-image-a4-numbered}
  
\end{document}

在此处输入图片描述

相关内容