I am writing a multi-chapter document, each chapter as a separate file. How do I merge the files to update footnotes, index and etc.