在双面文档的附录中切换到单面模式

在双面文档的附录中切换到单面模式

我有一个较大的文档 (book类),应该双面排版,即使用twopage类选项。但是,在附录中,我有一些技术图表,这些图表不应该双面打印,而应该打印在奇数页上,同一页的后面偶数页为空,就像打印onepage在一面的单面 ( ) 文档一样。这些页面不包含页码,并且使用\includepdf(pdfpages包) 或\includegraphics带有一些额外命令的插入。

我如何启用此伪onepage模式?我可能需要切换回正常模式,以便稍后添加不同的附录。基本上,empty必须在每个正常页面后插入一页。我不想\clearpage\thispagestyle{empty}\cleardoublepage在每个真实页面后手动添加。

答案1

这只会打印在奇数页上,中间会发送空白页

\documentclass[twoside]{book}


\begin{document}

\makeatletter
\let\ol@outputpage\@outputpage
\def\@outputpage{%
\ifodd\c@page\else\shipout\vbox{}\advance\c@page\@ne\fi
\ol@outputpage}
\makeatother

\fbox{\parbox{3in}{1\vskip .7\textheight}}

\fbox{\parbox{3in}{2\vskip .7\textheight}}

\fbox{\parbox{3in}{3\vskip .7\textheight}}

and back to normal:

\makeatletter
\let\@outputpage\ol@outputpage
\makeatother

\fbox{\parbox{3in}{4\vskip .7\textheight}}

\fbox{\parbox{3in}{5\vskip .7\textheight}}

\fbox{\parbox{3in}{6\vskip .7\textheight}}

\end{document}

答案2

下面的例子应该可以满足您的要求。将“dummyfig”替换为您选择的实际图形文件名。类似的构造将处理包含的 pdf 页面,但必须一次插入一个。

\documentclass{book}
\usepackage{graphicx}

\newcommand{\onesidegraphic}[1]{%
  \cleardoublepage
  \includegraphics{#1}}

\begin{document}

some text, with page number

\newpage
some more text; this should be two-sided.

\clearpage
\pagestyle{empty}

\onesidegraphic{dummyfig}

this page and the following ones should be
one-sided and have no page numbers.

\onesidegraphic{dummyfig}
\onesidegraphic{dummyfig}
\end{document}

答案3

值得一提的是,以下是如何在 ConTeXt 中切换到单面布局。

\setuppagenumbering[alternative=doublesided, location=outermargin]

\starttext
\dorecurse{3}{ \chapter{Test \recurselevel} \input knuth \page }

\page[right] % Start with a right page
\setuppagenumbering[alternative=singlesided] %switch to singlesided

\dorecurse{3}{ \chapter{Test \recurselevel} \input knuth \page }
\stoptext

答案4

David 关于使用阿特别格什在这种情况下,这一点很重要。这就是阿特别格什确实(使用 Heiko 提供的众多技巧中的最后一个 kern 技巧):

\shipout :=
  \begingroup
  \setbox\mybox=\hbox\bgroup
    \kern1pt
    \afterassignment\shipouttest
    \global\setbox\mybox=

\shipouttest :=
  \ifdim\lastkern=0pt % we have a 'direct box'
    \aftergroup\egroup
    \aftergroup\endgroup
    \aftergroup\@output
  \else
    \egroup
    \endgroup
    \@output
  \fi

现在\shipouttest要做马丁想做的事已经太晚了。

顺便说一句,就我自己而言,我希望在空白页上有一个评分标准。所以我这样做了

\documentclass[twoside]{book}
\begin{document}

\makeatletter
\def\blankpage@hook{}
\protected\def\addtoblankpage{\g@addto@macro\blankpage@hook}
\let\old@outputpage\@outputpage
\protected\def\@outputpage{%
  \ifodd\c@page\else
    \shipout\vbox{%
      \begingroup
      \setbox\z@=\vbox{\blankpage@hook}%
      \ifdim\ht0>\dimexpr\vsize-\baselineskip\relax
        \@latexerr{The content of `blank page' is too high}\@ehd
      \else
        \box\z@
      \fi
      \endgroup
    }%
    \advance\c@page\@ne
  \fi
  \old@outputpage
}

\makeatother

\addtoblankpage{%
  \vskip.5\textheight
  \textbf{Page \thepage.}
  This page was intentionally left blank.
}

% Content too high:
% \addtoblankpage{\fbox{\parbox{3in}{1\vskip .9\textheight}}}

\fbox{\parbox{3in}{1\vskip .9\textheight}}

\fbox{\parbox{3in}{3\vskip .9\textheight}}

\fbox{\parbox{3in}{5\vskip .9\textheight}}

\fbox{\parbox{3in}{7\vskip .9\textheight}}

\fbox{\parbox{3in}{9\vskip .9\textheight}}

\end{document}

相关内容