嵌套输入包含不必要的分页符

嵌套输入包含不必要的分页符

假设我有一个文档,其中所有章节和子章节都是单独的 .tex 文件。由于无法嵌套\include,因此我使用\input

\documentclass[a4paper,11pt,titlepage]{article}
\title{...}
\author{...}

%%Packages
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{float}
\usepackage{caption}

%%Commands
%http://tex.stackexchange.com/questions/59245/how-to-disable-automatic-indent
\newlength\inLength
\setlength{\inLength}{\parindent}
\setlength{\parindent}{0pt}
\renewcommand{\indent}{\hspace*{\inLength}}

\begin{document}
    \maketitle
    \pagestyle{headings}
    \input{section_A}
    ...

    \bibliography{...}
    \bibliographystyle{plain}
\end{document}

例如,section_A.tex 如下所示:

\section{A}
Some general blather about A and such.
\input{sub_A1}
...

并且子部分文件不包含任何其他输入。例如:

\subsection{A1}
Blah blah and so on.
\subsubsection*{A1_1}
...
\subsubsection*{A1_2}
...

如果我解析它,子部分将从新页面开始。我该如何防止这种情况发生?

答案1

如果我修复了示例中不相关的错误(缺少文件和_标题未转义),那么正如预期的那样,标题之间没有分页符:

在此处输入图片描述


\documentclass[a4paper,11pt,titlepage]{article}
\title{...}
\author{...}

%%Packages
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{float}
\usepackage{caption}

%%Commands
%http://tex.stackexchange.com/questions/59245/how-to-disable-automatic-indent
\newlength\inLength
\setlength{\inLength}{\parindent}
\setlength{\parindent}{0pt}
\renewcommand{\indent}{\hspace*{\inLength}}%%don't do this!

\begin{document}
    \maketitle
    \pagestyle{headings}
    \input{section_A}
      ...

    \bibliography{...}
    \bibliographystyle{plain}
\end{document}

\section{A}
Some general blather about A and such.
\input{sub_A1}
...

\subsection{A1}
Blah blah and so on.
\subsubsection*{A1\_1}
...
\subsubsection*{A1\_2}
...


相关内容