如何设置xelatex生成的pdf横向页面的旋转属性?

如何设置xelatex生成的pdf横向页面的旋转属性?

我已经采用了这个答案旋转表格及其标题。我不是想要旋转页眉、页脚、章节标题而不是同一页面上的段落。

现在我想按照描述更改旋转属性这里以便查看器应用程序将页面转换为横向。我知道同样的问题在此重复,但我需要使用 xelatex,并且编译器抱怨 pdfpageattr 是一个未定义的控制序列。

我是否可以正确地假设 pdflscape 没有选项可以防止在景观环境中更改布局?

母语:

\documentclass[a4paper]{scrartcl}
\usepackage{%
  ,adjustbox%
  ,tabularx%
  ,ragged2e%
  ,blindtext%
  ,placeins%
  % ,pdflscape% <- I only want the pdf viewer to rotate the page
}
\begin{document}

\section{Portrait page}

\Blindtext[3][1]
\pagebreak[4]
% \global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}
% --> Undefined control sequence. <--

% I can't use pdflscape's landscape environment as it changes the layout.

\section{Landscape page}

This running text should be ``portrait''--readable.

% (leave 10ex room for the title and the paragraph.)
\begin{table}[ht]
  \begin{adjustbox}{minipage=\textwidth-10ex,%
      addcode={\begin{minipage}{\width}}{%
          \caption{%
            Here is a caption of the table which is so long that 
            it has to be wrapped over multiple lines, but should 
            not exceed the width (height after the rotation) of the table.
          }%
    \end{minipage}},rotate=90,center}
  \begin{tabularx}{\linewidth}{|r|XXXXX|}
    \multicolumn{6}{c}{{\Large\slshape rotated table}}\\
      & 1 & 2 & 3 & 4 & 5 \\\hline
    a & b & c & d & e & f \\
    a & b & c & d & e & f \\
    a & b & c & d & e & f \\
    a & b & c & d & e & f \\
    a & b & c & d & e & f \\\hline
  \end{tabularx}
  \end{adjustbox}
\end{table}
\FloatBarrier
\pagebreak[4]
% \global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}
\Blindtext[2][1]
\end{document}

答案1

xetex 不认识 \pdfpageattr,你需要使用 \special

  \special{pdf: put @thispage <</Rotate #1>>}%

(#1 是角度)。

您可以使用 pdflscape 的内部命令来获得正确的效果:

\documentclass{article}
\usepackage{pdflscape}
\begin{document}
blblb

\makeatletter\PLS@AddRotate{90}\makeatletter

\newpage

\makeatletter\PLS@RemoveRotate\makeatother
blblb

\end{document}

相关内容