Text runs off the bottom of a pdf page in rmarkdown - R 3.6.2, RStudio 1.2.5033, Dec 20 distribution of TexLive

I'm having a problem when compiling this rmarkdown file to pdf in RStudio. This problems is that, in the pdf file, the pdf compiler doesn't create a new page when the text reaches the bottom (about 1/2-way through) and appears to continue to write the remaining text onto an invisible extended page, like it doesn't know that page size or margins. If I take the .tex file from rmarkdown and load it into TeXworks, the pdf version has the same problem. I've used R markdown for several years and have never seen this, though this is the first time I've had all Headers (#, ##, ###) in the file. Adding 'normal' text under one of the headers does not help. Here're are the file contents. Sorry it's so long but it has to be long to display the problem. Any help is welcome.

---
title: "Class 3670 Book Outline"
author: "Professor"
date: "`r Sys.Date()`"
output:
  pdf_document:
    fig_caption: yes
    keep_tex: yes
    number_sections: no
    toc: yes
    toc_depth: 3
---

# Energy Transfer  

## Thermal Equilibrium  

### Thermal equilibrium and the Laws of Thermodynamics  
### Non-equilibrium Thermodynamics and the Transport of Energy  
### Temperature in Living Systems  
### Temperature in the Environment    
### Temperature Scales  

## Modes of Heat Transfer  

### Conductive heat transfer  
### Convective heat transfer  
### Radiative heat transfer  

## Governing Equation and Boundary Conditions of Heat Transfer  

### Governing equation for heat transfer derived  
### General boundary conditions  
### Bioheat transfer equation for mammalian tissue  
### Governing equation derived in cylindrical coordinates  
### Governing equations in various coordinate systems   
### Solution techniques: Analytical vs. Numerical  
### Problem formulations: an algorithm to solve transport problems  
### Problem solving: A general approach  

## Conduction heat transfer - Steady State  

### Steady state heat conduction in a slab  
### Steady state heat conduction in a cylinder  
### Geometry effect: slab, cylinder, and sphere  
### Steady state heat conduction in a slab with internal heat generation  
### Steady state heat transfer from extended surfaces: Fins  

## Conduction heat transfer - Unsteady state  

### Transient heat transfer with no internal resistance  
### Biot number: deciding when to ignore the internal resistance  
### Transient heat transfer with internal resistance  
### Transient heat transfer in a finite geometry - multidimensional problems  
### Semi-infinite region  

## Convection Heat Transfer  

### Governing equation for convection  
### Temperature profiles and boundary layers over a surface  
### Laminar and turbulent flows  
### Convective heat transfer coefficient defined  
### Significant parameters in convective heat transfer  
### Convective heat transfer coefficient calculations  
### Orders of magnitude for heat transfer coefficient values  

## Heat Transfer with Change of Phase  

### Freezing and thawing  
### Freezing of pure water  
### Freezing of solutions and biomaterials  
### Temperature profiles and freezing time  
### Evaporation  

## Radiative Heat Transfer  

### The electromagnetic spectrum  
### Reflection, absorption, and transmission of waves at a surface  
### Thermal Radiation from an ideal (black) body  
### Fraction of energy emitted  
### Thermal radiation from a real body: emissivity  
### Solar, atmospheric, and earth surface radiation  
### Radiative exchange between bodies  

I was curious and did some tests.

If you leave one block line, and add some text, it seems to work correctly.
See this example`with dummy text.

---
title: "Class 3670 Book Outline"
author: "Professor"
date: "`r Sys.Date()`"
output:
  pdf_document:
    fig_caption: yes
    keep_tex: yes
    number_sections: no
    toc: yes
    toc_depth: 3
---

# Energy Transfer  

## Thermal Equilibrium  

### Thermal equilibrium and the Laws of Thermodynamics  

fezfazfzafzefzefzaefzaefzefzefaz

### Non-equilibrium Thermodynamics and the Transport of Energy  

fezfazfzafzefzefzaefzaefzefzefaz

### Temperature in Living Systems  

fezfazfzafzefzefzaefzaefzefzefaz

### Temperature in the Environment    

fezfazfzafzefzefzaefzaefzefzefaz

### Temperature Scales  

fezfazfzafzefzefzaefzaefzefzefaz

## Modes of Heat Transfer  

### Conductive heat transfer  

fezfazfzafzefzefzaefzaefzefzefaz

### Convective heat transfer  

fezfazfzafzefzefzaefzaefzefzefaz

### Radiative heat transfer  

fezfazfzafzefzefzaefzaefzefzefaz

## Governing Equation and Boundary Conditions of Heat Transfer  

### Governing equation for heat transfer derived  

fezfazfzafzefzefzaefzaefzefzefaz

### General boundary conditions  

fezfazfzafzefzefzaefzaefzefzefaz

### Bioheat transfer equation for mammalian tissue  

fezfazfzafzefzefzaefzaefzefzefaz

### Governing equation derived in cylindrical coordinates  

fezfazfzafzefzefzaefzaefzefzefaz

### Governing equations in various coordinate systems   

fezfazfzafzefzefzaefzaefzefzefaz

### Solution techniques: Analytical vs. Numerical  

fezfazfzafzefzefzaefzaefzefzefaz

### Problem formulations: an algorithm to solve transport problems  

fezfazfzafzefzefzaefzaefzefzefaz

### Problem solving: A general approach  

fezfazfzafzefzefzaefzaefzefzefaz

## Conduction heat transfer - Steady State  


### Steady state heat conduction in a slab  

fezfazfzafzefzefzaefzaefzefzefaz

### Steady state heat conduction in a cylinder  

fezfazfzafzefzefzaefzaefzefzefaz

### Geometry effect: slab, cylinder, and sphere  

fezfazfzafzefzefzaefzaefzefzefaz

### Steady state heat conduction in a slab with internal heat generation  

fezfazfzafzefzefzaefzaefzefzefaz

### Steady state heat transfer from extended surfaces: Fins  

fezfazfzafzefzefzaefzaefzefzefaz

## Conduction heat transfer - Unsteady state  


### Transient heat transfer with no internal resistance  

fezfazfzafzefzefzaefzaefzefzefaz

### Biot number: deciding when to ignore the internal resistance  

fezfazfzafzefzefzaefzaefzefzefaz

### Transient heat transfer with internal resistance  

fezfazfzafzefzefzaefzaefzefzefaz

### Transient heat transfer in a finite geometry - multidimensional problems  

fezfazfzafzefzefzaefzaefzefzefaz

### Semi-infinite region  

fezfazfzafzefzefzaefzaefzefzefaz

## Convection Heat Transfer  


### Governing equation for convection  

fezfazfzafzefzefzaefzaefzefzefaz

### Temperature profiles and boundary layers over a surface  

fezfazfzafzefzefzaefzaefzefzefaz

### Laminar and turbulent flows  

fezfazfzafzefzefzaefzaefzefzefaz


### Convective heat transfer coefficient defined  

fezfazfzafzefzefzaefzaefzefzefaz


### Significant parameters in convective heat transfer  

fezfazfzafzefzefzaefzaefzefzefaz

### Convective heat transfer coefficient calculations  

fezfazfzafzefzefzaefzaefzefzefaz

### Orders of magnitude for heat transfer coefficient values  

fezfazfzafzefzefzaefzaefzefzefaz

## Heat Transfer with Change of Phase  


### Freezing and thawing  

fezfazfzafzefzefzaefzaefzefzefaz

### Freezing of pure water  

fezfazfzafzefzefzaefzaefzefzefaz

### Freezing of solutions and biomaterials  

fezfazfzafzefzefzaefzaefzefzefaz

### Temperature profiles and freezing time  

fezfazfzafzefzefzaefzaefzefzefaz

### Evaporation  

fezfazfzafzefzefzaefzaefzefzefaz

## Radiative Heat Transfer  


### The electromagnetic spectrum  

fezfazfzafzefzefzaefzaefzefzefaz

### Reflection, absorption, and transmission of waves at a surface  

fezfazfzafzefzefzaefzaefzefzefaz

### Thermal Radiation from an ideal (black) body  

fezfazfzafzefzefzaefzaefzefzefaz

### Fraction of energy emitted  

fezfazfzafzefzefzaefzaefzefzefaz

### Thermal radiation from a real body: emissivity  

fezfazfzafzefzefzaefzaefzefzefaz

### Solar, atmospheric, and earth surface radiation  

fezfazfzafzefzefzaefzaefzefzefaz

### Radiative exchange between bodies

fezfazfzafzefzefzaefzaefzefzefaz

I have no explanation but I suppose you always want some paragraphs below headers right ?

1 Like

Curious. I found in the original file that even a single . and an empty line after ### Transient heat transfer with no internal resistance will run the rest of the file, albeit treating the following sequential headers without text as plain text rather than headers. Guess it's a \LaTeX thing.

Interesting. I'd done a similar thing by putting a large paragraph below one of the headers and that didn't help. I'll experiment some more. In this case, what I wanted was just an outline so I hadn't intended to put text between headers. I wonder if latex has a 'keep with next' or 'keep with previous' rule that I'm not aware of that might cause this. I take it that the respondents had the same issue with my text before trying to fix it. Thanks for the replies.

1 Like

I tried technocrat's solution and that did the trick and it kept the headers as headers. Moving the '. blank line' around in the file had all kinds of curious results. Generally, if it was place where technocrat said or below, all was fine. Otherwise not. Thanks.

2 Likes

Great! Please mark a solution for the benefit of anyone else who runs across this.

1 Like