LaTeX:删除 \part 或 \chapter 之后的空白页

发布于 2024-08-03 15:54:23 字数 1459 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

奢华的一滴泪 2024-08-10 15:54:23

我认为您可以简单地在图书类中添加 oneside 选项吗?

\documentclass[oneside]{book}

虽然我没有测试它:)

I think you can simply add the oneside option the book class?

i.e.

\documentclass[oneside]{book}

Although I didn't test it :)

冬天旳寂寞 2024-08-10 15:54:23

它会留下空白页,以便新的部分或章节从右侧开始。您可以使用文档类的“openany”选项来修复此问题。 ;)

It leaves blank pages so that a new part or chapter start on the right-hand side. You can fix this with the "openany" option for the document class. ;)

紫南 2024-08-10 15:54:23

有效的解决方案:

使用下面提供的代码包装需要此修改行为的文档部分。就我而言,要换行的部分是 \part{} 及其后面的一些文本。

\makeatletter\@openrightfalse
\part{Whatever}

Some text

\chapter{Foo}
\@openrighttrue\makeatother 

包装部分还应包括需要停止此行为的章节。否则 LaTeX 可能会在本章之前生成一个空页面。

资料来源:irc.freenode.net 上 #latex IRC 频道的人们

A solution that works:

Wrap the part of the document that needs this modified behavior with the code provided below. In my case the portion to wrap is a \part{} and some text following it.

\makeatletter\@openrightfalse
\part{Whatever}

Some text

\chapter{Foo}
\@openrighttrue\makeatother 

The wrapped portion should also include the chapter at the beginning of which this behavior needs to stop. Otherwise LaTeX may generate an empty page before this chapter.

Source: folks at the #latex IRC channel on irc.freenode.net

伴梦长久 2024-08-10 15:54:23

你没有说你正在使用什么类,但我猜它是标准的book。在这种情况下,页面清除是该类的一项功能,您可以将其覆盖为 Mica建议,或者通过切换到另一个类来解决。标准的 report 类类似于 bookmemoir 是一本改进的book,而且确实非常灵活。

You don't say what class you are using, but I'm guessing it is the standard book. In which case the page clearing is a feature of he class which you can override as Mica suggests, or solve by switching to another class. The standard report class is similar to book, or the memoir class is an improved book and is very flexible indeed.

再浓的妆也掩不了殇 2024-08-10 15:54:23

虽然我猜你不再需要答案,但我正在为那些来看这篇文章的人提供解决方案。

源自 book.cls

\def\@endpart{\vfil\newpage
              \if@twoside
                \null
                \thispagestyle{empty}%
                \newpage
              \fi
              \if@tempswa
                \twocolumn
              \fi}

该片段第一行的“\newpage”在部件标题页之后添加了一个冗余空白页。所以你必须重新定义命令\@endpart。将以下代码片段添加到 tex 文件的开头。

\makeatletter
\renewcommand\@endpart{\vfil
              \if@twoside
                \null
                \thispagestyle{empty}%
                \newpage
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother

Although I guess you do not need an answer any longer, I am giving the solution for those who will come to see this post.

Derived from book.cls

\def\@endpart{\vfil\newpage
              \if@twoside
                \null
                \thispagestyle{empty}%
                \newpage
              \fi
              \if@tempswa
                \twocolumn
              \fi}

It is "\newpage" at the first line of this fragment that adds a redundant blank page after the part header page. So you must redefine the command \@endpart. Add the following snippet to the beggining of your tex file.

\makeatletter
\renewcommand\@endpart{\vfil
              \if@twoside
                \null
                \thispagestyle{empty}%
                \newpage
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother
情栀口红 2024-08-10 15:54:23

我相信在书本课程中,所有 \part 和 \chapter 都设置为从右页开始。

来自 book.cls:

\newcommand\part{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{plain}%
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null\vfil
  \secdef\@part\@spart}

您应该能够更新该命令,以及 \chapter 的类似命令。

I believe that in the book class all \part and \chapter are set to start on a recto page.

from book.cls:

\newcommand\part{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{plain}%
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null\vfil
  \secdef\@part\@spart}

you should be able to renew that command, and something similar for the \chapter.

带上头具痛哭 2024-08-10 15:54:23

我知道有点晚了,但我刚刚看到这篇文章,想提一下,我真的不认为每个人都想以困难的方式做到这一点......
这里的问题只是 book 类默认使用 Twoside ,所以,正如 gromgull 所说,只需将 oneside 作为参数传递即可解决。

I know it's a bit late, but I just came across this post and wanted to mention that I don't really see way everybody wants to do it in a difficult way...
The problem here is just that the book class takes twoside as default, so, as gromgull said, just pass oneside as argument and it's solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文