编辑

编辑
\documentclass{article}
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{flowfram}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{changepage}
\usepackage{ifoddpage}
\usepackage{lipsum}

\geometry{paperwidth=29.7cm,paperheight=7cm,margin=0cm}
\pagestyle{empty}

\newcommand{\pechafront}{
    \newdynamicframe{29.7cm}{7cm}{0cm}{0cm}[front]
    \setdynamiccontents*{front}{
        \vfil\hfil
        \begin{tikzpicture}
            \draw[color=black,very thick] (2.7,.93) rectangle +(24.3,5.14)
            (2.77,1) rectangle +(24.16,5)
            (3.77,1) rectangle +(.07,5)
            (25.97,1) rectangle +(.07,5);
            \node[rotate=-90] at (3.2,3.5) {\huge \thepage};
            \node[rotate=90] at (26.47,3.5) {\huge \thepage};
        \end{tikzpicture}
    }
    \newflowframe{21.7cm}{4.9cm}{4cm}{.9cm}[frontframe]
}

\newcommand{\pechaback}{
    \newdynamicframe{29.7cm}{7cm}{0cm}{0cm}[back]
    \setdynamiccontents*{back}{
        \begin{tikzpicture}
            \draw[color=black] (0,0) +(29.7,7)
            (3.77,1) rectangle +(22.16,5.12)
            (2.77,1) rectangle +(24.16,5.12);
            \node[rotate=90] at (3.43,3.5) {\huge \thepage};
            \node[rotate=-90] at (26.33,3.5) {\huge \thepage};
    \end{tikzpicture}}
    \newflowframe{21.7cm}{4.9cm}{4.0cm}{0.9cm}[backframe]
}

\sloppy

\checkoddpage
\ifoddpage
    \pechafront
\else
    \pechaback
\fi
\begin{document}
\lipsum
\lipsum
\end{document}

页面渲染得很奇怪。我做错了什么?

编辑:我在 LuaLaTeX 下运行它

答案1

我认为您可以在定义动态框架时将页面列表指定为evenodd在可选参数中指定。

\documentclass{article}
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{flowfram}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{changepage}
\usepackage{ifoddpage}
\usepackage{lipsum}

\geometry{paperwidth=29.7cm,paperheight=7cm,margin=0cm}
\pagestyle{empty}


\newdynamicframe[odd]{29.7cm}{7cm}{0cm}{0cm}[front]
\setdynamiccontents*{front}{
    \vfil\hfil
    \begin{tikzpicture}
        \draw[color=black,very thick] (2.7,.93) rectangle +(24.3,5.14)
        (2.77,1) rectangle +(24.16,5)
        (3.77,1) rectangle +(.07,5)
        (25.97,1) rectangle +(.07,5);
        \node[rotate=-90] at (3.2,3.5) {\huge \thepage};
        \node[rotate=90] at (26.47,3.5) {\huge \thepage};
    \end{tikzpicture}
}
\newdynamicframe[even]{29.7cm}{7cm}{0cm}{0cm}[back]
\setdynamiccontents*{back}{
    \begin{tikzpicture}
        \draw[color=black] (0,0) +(29.7,7)
        (3.77,1) rectangle +(22.16,5.12)
        (2.77,1) rectangle +(24.16,5.12);
        \node[rotate=90] at (3.43,3.5) {\huge \thepage};
        \node[rotate=-90] at (26.33,3.5) {\huge \thepage};
\end{tikzpicture}}
\newflowframe{21.7cm}{4.9cm}{4cm}{.9cm}[myframe]

\sloppy% this is very bad - do you really need this for your entire document?

\begin{document}
\lipsum
\lipsum
\end{document}

交替设计

编辑

更改单个页面的内容不太简单。但是,你可以afterpage像这样使用并进行一些调整:

\documentclass{article}
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{flowfram}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{afterpage}

\geometry{paperwidth=29.7cm,paperheight=7cm,margin=0cm}
\pagestyle{empty}


\newdynamicframe[odd]{29.7cm}{7cm}{0cm}{0cm}[front]
\newdynamicframe[even]{29.7cm}{7cm}{0cm}{0cm}[back]
\newflowframe{21.7cm}{4.9cm}{4cm}{.9cm}[myframe]
\setdynamiccontents*{front}{
    \vfil\hfil
    \begin{tikzpicture}
        \draw[color=black,very thick] (2.7,.93) rectangle +(24.3,5.14)
        (2.77,1) rectangle +(24.16,5)
        (3.77,1) rectangle +(.07,5)
        (25.97,1) rectangle +(.07,5);
        \node[rotate=-90] at (3.2,3.5) {\huge \thepage};
        \node[rotate=90] at (26.47,3.5) {\huge \thepage};
    \end{tikzpicture}
}
\setdynamiccontents*{back}{
    \begin{tikzpicture}
        \draw[color=black] (0,0) +(29.7,7)
        (3.77,1) rectangle +(22.16,5.12)
        (2.77,1) rectangle +(24.16,5.12);
        \node[rotate=90] at (3.43,3.5) {\huge \thepage};
        \node[rotate=-90] at (26.33,3.5) {\huge \thepage};
\end{tikzpicture}}

\sloppy

\begin{document}
\lipsum[1-2]
\lipsum[3-4]
\dynamicsetpagelist{2}{none}
\dynamicsetpagelist{1}{\thepage}
\afterpage{%
  \dynamicsetpagelist{2}{even}
  \dynamicsetpagelist{1}{odd}
}
\lipsum[5-8]
\end{document}

切换到第 2 页

相关内容