LaTeX printing only first two pages of a document

风流意气都作罢 提交于 2019-12-12 20:33:08

问题


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


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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




回答5:


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.



来源:https://stackoverflow.com/questions/2677426/latex-printing-only-first-two-pages-of-a-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!