0

an interesting question is how to combine several lab report written in LaTeX into one document. Of-course, few things are essential to take account to. For example, a contents list, unifying fig and table numbers, etc. Any suggestion or worked example would be helpful.

My current code is

\documentclass{report}
% same configuration as for your lab reports (to be compatible with this one)

\begin{document}
\tableofcontents

\part{cleaning wafer}
\input{lab1.tex}
% and so on, until
\part{E-beam evaporation}
\input{lab5.tex}

\end{document}

Here is an error

enter image description here

enter image description here

Mohammad
  • 966

1 Answers1

1

I consider your lab reports to be like this one:

\documentclass{report}

% configuration
\title{Lab i}

\begin{document}
\maketitle
\tableofcontents

\input{content/lab-i-body.tex} % this is important

\end{document}

And the content of content/lab-i-body.tex looks like this:

\chapter{Presets}
% and so on, including figures and tables

And the collection of the lab reports will look like this:

\documentclass{book}

% same configuration as for your lab reports (to be compatible with this one), but:
\title{Collected Lab Reports}

\begin{document}
\maketitle
\tableofcontents

\part{Title of Lab 1}
\input{lab-1-body.tex}
% and so on, until
\part{Title of Lab n}
\input{lab-n-body.tex}

\end{document}

And because book is a "bigger" class than report, that mean's the chapters will be "collected" by the parts like subsections are "collected" by sections, you don't have to adjust anything inside the lab-i-body.tex files. figures and tables will be counted as expected because they are now part of a single document.

  • @Ecofritza can you write a pseudo code here, that I can follow it – Mohammad Apr 10 '16 at 19:29
  • For whole chapters you can use also \include. On the other hand, it is not the needed specify the extension .tex within the \input command. – Fran Apr 10 '16 at 20:53
  • @ Ecofritze : I updated the problems statement above for the error that I got after I used your code. – Mohammad Apr 11 '16 at 21:48
  • @Mohammad: Try \title{My Lab Reports} in your preamble or remove \maketitle. You should replace it by your preferred title. – jonas-schulze Apr 12 '16 at 13:04
  • @ Ecofritze, I deleted \maketitle. Now I have new error saying that \documentclass[preprint,12pt,authoryear]{elsarticle} while I recommended above in the answer use \documentclass{book}. In fact, the separate reports are in \documentclass[preprint,12pt,authoryear]{elsarticle}. Any idea how to fix this? I have uploaded error message in the problem statement. – Mohammad Apr 16 '16 at 19:33
  • No answers yet! – Mohammad Apr 22 '16 at 06:45
  • @Mohammad: It seem's that you are \inputing the whole lab report file, which starts with \documentclass. Be sure to only \input the inner part of your document as mentioned in my original post. You use some kind of article, so the "biggest" sectioning command available is \section. By "inner part of your document" I mean everything between \begin{document} and \end{document} (excluding these two) --- each should start with \section{Title One}. – jonas-schulze Apr 23 '16 at 22:10
  • It would be easier if you could provide a MWE, or a minimal non-working example in your case. And by the way, take a look at https://support.apple.com/en-la/HT201361 --- using cmd+shift+4 and space afterwards, you can take better looking screenshots of single windows. – jonas-schulze Apr 23 '16 at 22:12