0

Folks: I am a Latex newbie. I have a book consisting of 24 chapters in word. I would like to be able to work on each chapter separately, but compile them as one Latex file. I copied code from elsewhere and am able to get one chapter. But the code will not get the second chapter. (If I reverse the order, I can get chapter two, but then not chapter one). The code I am struggling with is:

\begin{document}
\frontmatter
\import{./}{title.tex}
\clearpage
\thispagestyle{empty}
\tableofcontents
\mainmatter

%%% START PROBLEM CODE 
%%% HAVE ALSO TRIED INPUT BUT NOT SURE OF WHICH IS BETTER (INPUT, INCLUDE, IMPORT)
\chapter{First chapter}
\import{C-20-1/}{C-20-1.latex}
\chapter{C-20-2}
\import{C-20-2/}{C-20-2.latex}
%%% END PROBLEM CODE 

\backmatter
\import{./}{bibliography.tex}
\end{document}

Thank you for any advice anyone can provide.

1 Answer 1

4

Please make your code an example of the problem it is very hard to see the issue when they are fragments missing \documentclass and other details.

I would start by using the standard mechanism not packages such as import. Move each of your \chapter heading commands out of the main file and into the .tex for each chapter, then \include each chapter into the main file.

First check the complete document is working as intended, then if you need to work on just one chapter add

\includeonly{C-20-2}

to your main document. Note you should use the default .tex extension if using \include not the rather unusual .latex

See a tutorial such as https://www.learnlatex.org/en/lesson-13

5
  • David, thank you so much for your time, courtesy, and advice. Based on your suggestions and the helpful tutorial I have (a) converted my chapter files to ".tex"; (b) used \include instead of \import. Also, from the tutorial, I am using the code below.
    – gandolfo
    Commented Jun 2 at 2:40
  • I could not show the code as I was exceeding the length of the edit. Short question. Instead of \include{Chapter1} I want to be able to put chapters in a folder. How would I say something like \include{Chapters}{Chapter1}. thank you.
    – gandolfo
    Commented Jun 2 at 3:08
  • @gandolfo you can always show a full document example (in the question posts, not comments). Your original document is not important to the question, you could make an example with just one chapter that was \chapter{Abc} xyz and the whole document took less than a dozen lines or so and still showed whatever problem you wanted to show. just use \include{Chapters/chapter1} if the file is in a Chapters subdirectory. Commented Jun 2 at 8:12
  • Appreciate the suggestion to post separately. I have done that. My apologies that the font (in the separate post) is bold and larger than intended. Thanks again.
    – gandolfo
    Commented Jun 2 at 13:06
  • @gandolfo don't post separately that makes it impossible to understand, delete that new post and edit your question here to have a usable example. Commented Jun 2 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .