I included a MWE (a main file and three articles) that uses the combine
class with book
option. There are two problems. The formatting process creates the LaTeX Error: Environment abstract undefined, and formatting stops at the first \begin{abstract}
command in first input file. Press “r” to continue the formatting process. The resulting PDF is almost correct except for the section numbering (0.1, 0.2 … instead of 1, 2 …) in the input article documents. The article documents include the command \setcounter{section}{0}
in the preamble. The file formats if I replace book
with report
, but the section-numbering problem persists. The main document is an accurate example of what I need (A book with parts, several chapters with no input files, and several chapters with input files.) All input files use the article document class. I use MiKTeX 2.9 on Windows 7.
\documentclass[book]{combine}
\usepackage[english]{babel}
\usepackage{blindtext}
\title{The collection}
\author{A. N. Editor}
\begin{document}
\maketitle
\tableofcontents
\part{First part}
\blindtext[1]
\chapter{First chapter}
\section{Introduction}
\blindtext[1]
\chapter{Second chapter}
\section{Introduction}
\ldots
\begin{papers}
\coltoctitle{First article}
\coltocauthor{Author of first article}
\import{inputDoc1}
\coltoctitle{Second article}
\coltocauthor{Author of second article}
\import{inputDoc2}
\end{papers}
\chapter{Third chapter}
\section{Introduction}
\ldots
\begin{papers}
\coltoctitle{Third article}
\coltocauthor{Author of third article}
\import{inputDoc3}
\end{papers}
\chapter{Chapter 4}
\section{Final introduction}
\end{document}
%first article
\documentclass[]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\title{First article}
\author{Author of first article}
\maketitle
\begin{abstract}
\blindtext[2]
\end{abstract}
\section{first section}
\blindtext[3]
\end{document}
%second article
\documentclass[]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\setcounter{section}{0}
\begin{document}
\title{Second article}
\author{Author of second article}
\maketitle
\begin{abstract}
\blindtext[1]
\end{abstract}
\section{first section}
\blindtext[1]
\end{document}
%third article
\documentclass[]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\setcounter{section}{0}
\begin{document}
\title{Document 1a}
\author{Author of document 1a}
\maketitle
\begin{abstract}
\blindtext[3]
\end{abstract}
\section{first section}
\blindtext[1]
\section{second section}
\blindtext[1]
\end{document}
Best Answer
Since you only import articles, and the
article
document class doesn't define the\chapter
the result is that you will have a value of0
for the chapters of each imported article. As @Papiro pointed, you can avoid the display of chapter counter with\renewcommand*\thesection{\arabic{section}}
. However, with that, you lose the format\thechapter.\thesection
for the sections in the main document, which in my case would be fine.Below I present other solution that keeps the format
\thechapter.\thesection
(without the need to add to add\makeatletter \@ifclassloaded{combine}{\renewcommand*\thesection{\arabic{savechapter}.\arabic{section}}}{}\makeatother
at each input articles).