I have been looking for a way to produce books with a collection of articles of different authors. The combine class somewhat satisfies that need. I also found a somewhat simpler solution online (or see the code below) that redefines some commands. However, I can't get it to work, LaTeX throws "command already defined" errors, e.g. for title.
Anyone around here that spots the error and can make this work? It seems rather trivial, but I'm too fresh to LaTeX to make it work myself.
This is very simple to use. It creates a new environment papers that can be used to enter the individual papers. I have assumed that each paper is included as an individual document; this means, that each paper can have its own preamble, and each paper can be edited individually. To include the papers in the main document, use it like this.
Code: Select all
\begin{papers}
\include{paper1}
\include{paper2}
\end{papers}
Code: Select all
\documentclass[
% class options
]{article} % or whatever
\usepackage{necessary}
\usepackage{cool}
\begin{document}
\title{A paper of the best practices}
\author{Johnny B. Good}
\maketitle
\section{Introduction}
In this paper \ldots
\end{document}
The code below redefines some preamble commands and the document environment to be ignored, and the \maketitle command so that the titles of the paper are printed and added to the table of contents and to the marks for headers. How they are used is a matter of your page style.
Code: Select all
% This code includes small pieces from combine.cls and some other sources.
% No guarantees of any kind given. Use at your own discretion.
% Feel free to modify and distribute in any way you see fit.
\long\def\symbolfootnote[#1]#2{\begingroup%
\def\thefootnote{\fnsymbol{footnote}}\footnote[#1]{#2}\endgroup}
\makeatletter
\newenvironment{papers}{\renewcommand{\documentclass}[2][]{}%
\newcommand{\@@title}{}%
\newcommand{\@@subtitle}{}%
\renewcommand{\usepackage}[2][]{}%
\renewenvironment{document}{\begingroup}{\endgroup}%
\newcommand{\title}[1]{\renewcommand{\@title}{##1}\begingroup%
\renewcommand{\thanks}[1]{}\protected@xdef\@@title{##1}
\endgroup}
\renewcommand{\subtitle}[1]{\renewcommand{\@@subtitle}{##1}}%
\newcommand{\author}[1]{\renewcommand{\@author}{##1}}
\newcommand{\thanks}[1]{\symbolfootnote[1]{##1}}
\newcommand{\maketitle}{
\thispagestyle{empty}
\vspace*{5\baselineskip}
\begin{center}\sf
\LARGE\@title%
\ifthenelse{\equal{\@@subtitle}{}}{%emtpy subtitle
}{%not empty subtitle
\bigskip
\Large\@@subtitle
}
\bigskip
\large\@author%
\end{center}%
\markboth{\@@title}{\@author}%
\addcontentsline{toc}{chapter}{\MakeUppercase{\@author}\\\@@title}%
\setcounter{footnote}{0}\noindent%
\ignorespacesafterend}
}{
}