0

Let's say I have a document for which all sections and subsections are separate .tex-files. As I cannot nest \include, I'm using \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}

Where e.g. section_A.tex looks like this:

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

And subsection-files do not contain any further inputs. E.g:

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

If I parse that, the sub-sections will start on new pages. How can I prevent that from happening?

David Carlisle
  • 757,742
User1291
  • 545
  • 2
    neither \input nor \subsection causes a page break with the default definitions, so you need to give some hint about the code you are using. – David Carlisle Jun 10 '15 at 09:26
  • Don't think I've touched them, though. Please see edit above, that's pretty much the whole document, there. – User1291 Jun 10 '15 at 09:34
  • If you take exactly the above files and run through latex do you get unwanted page breaks? If so we can copy the above and debug why the break occurs. If you do not, please edit so you do get breaks. In particular you have posted sub_A1.tex but not sub_A2.tex so we can not run the example. – David Carlisle Jun 10 '15 at 09:40
  • Why have you redefined the primitive command \indent ????? redefining a Tex primitive is very brave! – David Carlisle Jun 10 '15 at 09:41
  • Just eliminate the lines \input{section_B} and \input{sub_A2} and you should be getting a linebreak after Some general blather about A and such.. As for redefining \indent, that was the accepted answer in the question linked to in the comment. – User1291 Jun 10 '15 at 09:49
  • Please edit the example rather than requiring an edit. It may be an accepted answer but do you really mean to redefine every list \item and every tabbing environment for example (both of which use \indent internally) – David Carlisle Jun 10 '15 at 09:52
  • No I get `! Missing $ inserted. $ l.3 \subsubsection*{A1_1}` – David Carlisle Jun 10 '15 at 09:55

1 Answers1

2

If I fix the unrelated errors in your example (missing files and unescaped _ in headings) then as expected there are no page breaks between the headings:

enter image description here


\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}
...


David Carlisle
  • 757,742