Given the nature of the document you're trying to create -- a single set of lecture notes -- I wonder if you'd be better off not more or less simply combining the existing files (which, from your description, are standalone TeX files with \title, \author, etc information) but, instead, took the time to (re)organize them a bit more flexibly, along the following lines.
- Take each individual lecture file -- for concreteness, suppose you're working on
lecture1.tex -- and cut out everything between (but not including) the \maketitle and \end{document} commands. Paste the cut-out code into a new file named lecture1-body.tex, and insert the instruction \input lecture1-body in the "main" file (lecture1.tex). Repeat 28 times. This way, you'll preserve all of your "old" files, should the need to print them out as separate standalone files arise.
- Create a new LaTeX style file named, say,
discmath.sty. In this file, you should load the various LaTeX packages you've already been loading as well as all macros and shortcuts you've created so far for the individual lectures. Go through the preambles of your 28 "main" files and scan them for \usepackage, \newcommand, and \renewcommand (and similar) instructions, and then copy-and-paste them into the new "style" file, omitting duplicates as needed. If you've been slipping in the habit of creating new macros "on the fly" inside the main bodies of the lecture files (not encouraged, obviously, but not impossible either), now's the time to move them into the main style file.
- Create a new driver file, say
discmath-lectures.tex. Given the nature of the document you're trying to create, the book or report document classes would seem more appropriate than the article class for this new driver file. In this file, you'll first load your new style file, create a new overall title as well as a table of contents, and then (in the body of the file) load each of the 28 ...-body.tex files in turn.
This file would look something likeX
\documentclass[11pt]{book}
\usepackage{discmath}
\title{Lecture Notes\\Discrete Mathematics}
\author{Alex Taylor}
\date{\nodate} % use \nodate if you don't want to show a date at all
\begin{document}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\chapter{Introduction to Discrete Mathematics (or some other title)}
\include lecture1-body
\chapter{Xyz}
\include lecture2-body
...
\chapter{Additional thoughts}
\include lecture28-body
\begin{bibliography}{99}
... [to be created by you]
\end{thebibliography}
\end{document}
An issue you don't raise in your answer is whether or not each lecture is a self-contained unit (or "chapter", for the purposes of this document). The MWE above assumes that this is the case. If that's not the case, however, you should of course adjust the \chapter commands appropriately. Happy TeXing!
Addendum after the OP posted the log file of his program. I noticed the following lines toward the very end, just before "Here is how much of TeX's memory you used":
Chapter 3.
[7]
\openout2 = `l.aux'.
No file l.tex
This message strongly suggests that LaTeX is being instructed to open a file named l.tex, which doesn't exist. Is there a typo in your .tex file, possibly in the area where lecture3-body.tex should be loaded?
\documentstyledeclaration instead of latex2e's\documentclass; (3) duplicate files: lecture2/3, lecture 27/28; (4) lecture4 does not compile, crashes with aRunaway argument?message. You should probably address these issues before you ask others for advice on how to stitch together the separate files. – Mico Sep 25 '11 at 17:31