3
votes

I am working in LaTeX, and when I create a pdf file (using LaTeX button or pdfLaTeX button or using yap) the pdf has only the first two pages. No errors. It just stops. If I make the first page longer by adding text, it still stops at end of 2nd page. Any ideas?

OK, responding to first comment, here is the code

\documentclass{article}
\title{Outline of Book}
\author{Peter L. Flom}
    \begin{document}
\maketitle
\section*{Preface}
     \subsection*{Audience}
     \subsection*{What makes this book different?}
     \subsection*{Necessary background}
     \subsection*{How to read this book}
\section{Introduction}
    \subsection{The purpose of logistic regression}
    \subsection{The need for logistic regression}
    \subsection{Types of logistic regression}
\section{General issues in logistic regression}
    \subsection{Transforming independent and dependent variables}
    \subsection{Interactions}
    \subsection{Model selection}
    \subsection{Parameter estimates, confidence intervals, p values}
    \subsection{Summary and further reading}
\section{Dichotomous logistic regression}
    \subsection{Introduction, theory, examples}
    \subsection{Exploratory plots and analysis}
    \subsection{Basic model fitting}
    \subsection{Advanced and special issues in model fitting}
    \subsection{Diagnostic and descriptive plots and analysis}
    \subsection{Traps and gotchas}
    \subsection{Power analysis}
    \subsection{Summary and further reading}
    \subsection{Exercises}
\section{Ordinal logistic regression}
    \subsection{Introduction, theory, examples}
       \subsubsection{Introduction - what are ordinal variables?}
       \subsubsection{Theory of the model}
       \subsubsection{Examples for this chapter}
    \subsection{Exploratory plots and analysis}
    \subsection{Basic model fitting}
    \subsection{Advanced and special issues in model fitting}
    \subsection{Diagnostic and descriptive plots and analysis}
    \subsection{Traps and gotchas}
    \subsection{Power analysis}
    \subsection{Summary and further reading}
    \subsection{Exercises}
\section{Multinomial logistic regression}
    \subsection{Introduction, theory, examples}
    \subsection{Exploratory plots and analysis}
    \subsection{Basic model fitting}
    \subsection{Advanced and special issues in model fitting}
    \subsection{Diagnostic and descriptive plots and analysis}
    \subsection{Traps and gotchas}
    \subsection{Power analysis}
    \subsection{Summary and further reading}
    \subsection{Exercises}
\section{Choosing a model}
    \subsection{NOIR and its problems}
    \subsection{Linear vs. ordinal}
    \subsection{Ordinal vs. multinomial}
    \subsection{Summary and further reading}
    \subsection{Exercises}
\section{Extensions and related models}
    \subsection{Other logistic models}
    \subsection{Multilevel models - PROC NLMIXED and GLIMMIX}
    \subsection{Loglinear models - PROC CATMOD}
\section{Summary}
\end{document} 

thanks

Peter

5
Try putting a \eject just before the \end{document}.Charles Stewart
You should use \tableofcontents instead of abusing the section commands.Svante
Thanks all. I now realize I abused the sectioning commands.Peter Flom

5 Answers

7
votes

The LaTeX macros \section, \subsection and so on are intended to have some text after them. They deliberately prevent a break with the material immediately following. As you have a series of sectioning macros with nothing else, there is nowhere for a break to occur. If you look at your log, you'll see an overfull vbox: I get

Overfull \vbox (712.84044pt too high) has occurred while \output is active []

This means that the content of \box 255 (which actually contains the typeset page) is much too big, and runs off the bottom. As the section commands were never intended to be used like this, you may have to rethink your approach, or perhaps write your own versions that do not mess with the line-breaking.

4
votes

Add a tilde (~) after each of these section and subsection commands. If you have no content for a section LaTeX will not break the box (a tilde is a non-breaking space and will count as content).

i.e.

    \section*{Preface}~
         \subsection*{Audience}~
    ...

To meet your goal (of an outline) it may be better to use nested enumerations:

\begin{enumerate}
    \item Preface
    \begin{enumerate}
        \item  Audience
        \item  What makes this book different?
        \item  Necessary background
        \item  How to read this book
    \end{enumerate}
    \item Introduction
    \begin{enumerate}
        \item The purpose of logistic regression
        \item The need for logistic regression
        \item Types of logistic regression
    \end{enumerate}
    ...
\end{enumerate}

See other posts for customization of enumeration environment.

1
votes

More information is needed! Can you reproduce this behaviour with minimal document?

What I would've done is:

  1. Try removing all blocks of text and replacing them with a single word, but keep all latex commands. Can you still see the last block of text?
  2. Now try to remove all trivial latex commands (\subject{} formulas, etc.).
  3. If the problem still reproduce, try to remove one by one each suspected latex command until you've found the culprit.
  4. Google for the documentation of the offending command, and try to understand what went wrong.

My guess is, you used some TeX command which "switches" the state of the document, and somehow removes all text from a certain point.

Something like using the \em command once on a single word, and have the rest of the document boldface.

0
votes

I am still not sure what was going on, but when I added a little bit of text to each section, the problem disappeared.

0
votes

So I had a different issue, but I just want to point out that when I was searching for a similar problem, when using Overleaf to compile my Latex doc, it stopped at 2 pages because I didn't end a fraction correctly (I had one too few end curly braces). I only figured this out after I checked the logs, though.