Standalone chapters with separate references and counters











up vote
0
down vote

favorite
2












I'm looking for a convenient way to integrate standalone chapters in a main.tex (scrbook) file. More specifically, they will be already published papers within a thesis framework text and should




  • each have their own counters for figures, tables, equations

  • each have their own references with the references not showing up in the references of main.tex (preferably natbib)

  • inherit everthing else like formatting, header, footer, packages from main.tex

  • preferably compile with main.tex


I have looked at the standalone and subfiles packages, together with chapterbib or bibunits and with resetting the counters before each paper. Although I think I could somehow get this to work, this seems like an ugly workaround for something that has probably been encountered by someone else earlier.










share|improve this question






















  • Welcome to TeX.SX! This post is related tex.stackexchange.com/questions/101325/…
    – Andrew
    Jun 19 '15 at 7:59










  • You could also use pdfpages to simply insert the papers as is.
    – suvayu
    Jun 19 '15 at 9:55












  • Do you see a way to combine pdfpages with subfiles or standalone so that the documentclass and packages are inherited from the main file? @suvayu
    – Leo
    Jun 19 '15 at 12:54










  • I think maybe you are misunderstanding how pdfpages work. AFAIU, it simply includes the specified pages from the existing pdf, almost like including a figure. Something like this example (see page 65 onwards).
    – suvayu
    Jun 20 '15 at 10:59

















up vote
0
down vote

favorite
2












I'm looking for a convenient way to integrate standalone chapters in a main.tex (scrbook) file. More specifically, they will be already published papers within a thesis framework text and should




  • each have their own counters for figures, tables, equations

  • each have their own references with the references not showing up in the references of main.tex (preferably natbib)

  • inherit everthing else like formatting, header, footer, packages from main.tex

  • preferably compile with main.tex


I have looked at the standalone and subfiles packages, together with chapterbib or bibunits and with resetting the counters before each paper. Although I think I could somehow get this to work, this seems like an ugly workaround for something that has probably been encountered by someone else earlier.










share|improve this question






















  • Welcome to TeX.SX! This post is related tex.stackexchange.com/questions/101325/…
    – Andrew
    Jun 19 '15 at 7:59










  • You could also use pdfpages to simply insert the papers as is.
    – suvayu
    Jun 19 '15 at 9:55












  • Do you see a way to combine pdfpages with subfiles or standalone so that the documentclass and packages are inherited from the main file? @suvayu
    – Leo
    Jun 19 '15 at 12:54










  • I think maybe you are misunderstanding how pdfpages work. AFAIU, it simply includes the specified pages from the existing pdf, almost like including a figure. Something like this example (see page 65 onwards).
    – suvayu
    Jun 20 '15 at 10:59















up vote
0
down vote

favorite
2









up vote
0
down vote

favorite
2






2





I'm looking for a convenient way to integrate standalone chapters in a main.tex (scrbook) file. More specifically, they will be already published papers within a thesis framework text and should




  • each have their own counters for figures, tables, equations

  • each have their own references with the references not showing up in the references of main.tex (preferably natbib)

  • inherit everthing else like formatting, header, footer, packages from main.tex

  • preferably compile with main.tex


I have looked at the standalone and subfiles packages, together with chapterbib or bibunits and with resetting the counters before each paper. Although I think I could somehow get this to work, this seems like an ugly workaround for something that has probably been encountered by someone else earlier.










share|improve this question













I'm looking for a convenient way to integrate standalone chapters in a main.tex (scrbook) file. More specifically, they will be already published papers within a thesis framework text and should




  • each have their own counters for figures, tables, equations

  • each have their own references with the references not showing up in the references of main.tex (preferably natbib)

  • inherit everthing else like formatting, header, footer, packages from main.tex

  • preferably compile with main.tex


I have looked at the standalone and subfiles packages, together with chapterbib or bibunits and with resetting the counters before each paper. Although I think I could somehow get this to work, this seems like an ugly workaround for something that has probably been encountered by someone else earlier.







standalone subfiles document-configuration bibunits






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 19 '15 at 7:27









Leo

383




383












  • Welcome to TeX.SX! This post is related tex.stackexchange.com/questions/101325/…
    – Andrew
    Jun 19 '15 at 7:59










  • You could also use pdfpages to simply insert the papers as is.
    – suvayu
    Jun 19 '15 at 9:55












  • Do you see a way to combine pdfpages with subfiles or standalone so that the documentclass and packages are inherited from the main file? @suvayu
    – Leo
    Jun 19 '15 at 12:54










  • I think maybe you are misunderstanding how pdfpages work. AFAIU, it simply includes the specified pages from the existing pdf, almost like including a figure. Something like this example (see page 65 onwards).
    – suvayu
    Jun 20 '15 at 10:59




















  • Welcome to TeX.SX! This post is related tex.stackexchange.com/questions/101325/…
    – Andrew
    Jun 19 '15 at 7:59










  • You could also use pdfpages to simply insert the papers as is.
    – suvayu
    Jun 19 '15 at 9:55












  • Do you see a way to combine pdfpages with subfiles or standalone so that the documentclass and packages are inherited from the main file? @suvayu
    – Leo
    Jun 19 '15 at 12:54










  • I think maybe you are misunderstanding how pdfpages work. AFAIU, it simply includes the specified pages from the existing pdf, almost like including a figure. Something like this example (see page 65 onwards).
    – suvayu
    Jun 20 '15 at 10:59


















Welcome to TeX.SX! This post is related tex.stackexchange.com/questions/101325/…
– Andrew
Jun 19 '15 at 7:59




Welcome to TeX.SX! This post is related tex.stackexchange.com/questions/101325/…
– Andrew
Jun 19 '15 at 7:59












You could also use pdfpages to simply insert the papers as is.
– suvayu
Jun 19 '15 at 9:55






You could also use pdfpages to simply insert the papers as is.
– suvayu
Jun 19 '15 at 9:55














Do you see a way to combine pdfpages with subfiles or standalone so that the documentclass and packages are inherited from the main file? @suvayu
– Leo
Jun 19 '15 at 12:54




Do you see a way to combine pdfpages with subfiles or standalone so that the documentclass and packages are inherited from the main file? @suvayu
– Leo
Jun 19 '15 at 12:54












I think maybe you are misunderstanding how pdfpages work. AFAIU, it simply includes the specified pages from the existing pdf, almost like including a figure. Something like this example (see page 65 onwards).
– suvayu
Jun 20 '15 at 10:59






I think maybe you are misunderstanding how pdfpages work. AFAIU, it simply includes the specified pages from the existing pdf, almost like including a figure. Something like this example (see page 65 onwards).
– suvayu
Jun 20 '15 at 10:59












2 Answers
2






active

oldest

votes

















up vote
2
down vote













Personally I think this comes down to file and document organization. Few comments based on the work flow I evolved into using:




  • Unless preparing a MWE, I never have a single file for a project or even part of a document.

  • I agree it can be very helpful to keep chapters or other types of hierarchy as stand-alone and fully compilable document because you never know what you will want to examine or share.

  • I separate each stand-alone document, such as a chapter in a larger report, into a main file that loads my particular class file and/or preamble used begin{document} input{../Files/ActualStandAloneContent} end{document} to direct the compiler to my chapter content.

  • I keep all source files in subfolders of my project, such as the /Files/ mentioned above.

  • I keep all possible main files in a common folder where I have batch files prepared to compile ALL Tex files in this directory. Note this is where it is crucial not to have incomplete Tex files because the compiler will fail if they don't try and load a document class and begin/end the document. This means I may have a folder with main.tex main_Ch1.tex main_Ch2.tex etc... and when I run my xelatexCompile.bat I will get main.pdf main_Ch1.pdf main_Ch2.pdf which keeps everything current.

  • whether you manage your references (I like bibunits) in the main files by using a syntax like begin{bibunit} input{File} putbib end{bibunit} or you include this process in your standalone chapter, it doesn't make much difference. Personally, I keep this stuff in the main file as I never know when I am going to subdivide stand-alone files.

  • if you have common front-matter like Tables of Contents, figures, equations, nomenclature from glossaries or something, I recommend a distinct file to load via something like input{../Files/FrontMatter.tex} which you would always include in your main file to save repetition.

  • your header footer structure would be aspects I control in my cls file, but could also be done in main specific tex file preambles if you need customization.






share|improve this answer




























    up vote
    0
    down vote













    Following is the folder-file structure I have been using for many years after trying includeonly for about a year. It uses jobname a lot for automating things.





    • GRAPHICS (Folder for the editable graphics from which the pdfs were made.)



      1   Folder for the graphics for Chapter 1
      2 Folder for the graphics for Chapter 2
      101 Folder for the graphics for Appendix 1


      FIGURES (Folder for the pdfs used in the includegraphics)



      1   Folder for the pdfs for Chapter 1
      2 Folder for the pdfs for Chapter 2
      101 Folder for the pdfs for Appendix 1



    • STYLESHEETS  Folder containing only the following two files:



      GraphicsPaths.sty    contains only the following command:

      graphicspath%
      {%
      {../Figures/1/}
      {../Figures/2/}
      {../Figures/101/}
      Preamble.sty    This file contains the various  usepackage and the definition of the various definecolor, newcounter, newcommand, etc.


      TEXT-CONTENTS (Folder for the files containing just the CONTENT of the chapter)



      1.tex   Content of Chapter 1
      2.tex Content of Chapter 2
      101.tex Content of Appendix 1


      Each of the above files contains the following code followed by the content of the chapter



          %!TEX root = ../Text-controls/jobname.tex
      %!TEX TS-program = pdflatexmk  
      chapter{Name}
      ChapterToc


      BOOK.tex This is the content file for the whole book and contains ONLY the following code:

      %!TEX root = ../Text-controls/jobname.tex
      %!TEX TS-program = pdflatexmk  
      mainmatter
      include{../Text-contents/1}
      include{../Text-contents/2}



    • TEXT-CONTROLS folder for the files controlling the content files. (After compilation, this folder will also contains the aux files, toc files, etc and the pdf for each chapter.)



      1.tex  Control of Chapter 1
      2.tex  Control of Chapter 2
      101.tex  Control of Appendix 1

      Each of the above files contains ONLY the following code:
      % !TEX TS-program = pdflatexmk
      documentclass[11pt]{book}
      usepackage{../StyleSheets/Preamble}
      usepackage{../StyleSheets/GraphicsPaths}
      begin{document}
      addtocounter{page}{n} (where n+1 will be the number of the first page of the chapter.)
      addtocounter{chapter}{jobname-1}
      include{../Text-contents/jobname}
      printindex
      end{document}

      BOOK.tex is the control file for the whole book and contains ONLY the following code:
      % !TEX TS-program = pdflatexmk
      documentclass[11pt]{book}
      usepackage{../StyleSheets/Preamble}
      usepackage{../StyleSheets/GraphicsPaths}
      begin{document}
      frontmatter
      thispagestyle{empty}
      hspace{-12mm}{Large textsc{Name of the Book}}
      cleartooddpage[thispagestyle{empty}]

      etc, etc

      tableofcontents
      input{../Text-contents/BOOK}

      appendix
      addtocontents{toc}{protectsetcounter{tocdepth}{2}}
      include{../Text-contents/101}

      backmatter
      phantomsection
      addcontentsline{toc}{chapter}{Index}
      printindex
      end{document}



    The same structure can be used for the ancillaries. See http://tug.org/pracjourn/2010-2/schremmer.html






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f251087%2fstandalone-chapters-with-separate-references-and-counters%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote













      Personally I think this comes down to file and document organization. Few comments based on the work flow I evolved into using:




      • Unless preparing a MWE, I never have a single file for a project or even part of a document.

      • I agree it can be very helpful to keep chapters or other types of hierarchy as stand-alone and fully compilable document because you never know what you will want to examine or share.

      • I separate each stand-alone document, such as a chapter in a larger report, into a main file that loads my particular class file and/or preamble used begin{document} input{../Files/ActualStandAloneContent} end{document} to direct the compiler to my chapter content.

      • I keep all source files in subfolders of my project, such as the /Files/ mentioned above.

      • I keep all possible main files in a common folder where I have batch files prepared to compile ALL Tex files in this directory. Note this is where it is crucial not to have incomplete Tex files because the compiler will fail if they don't try and load a document class and begin/end the document. This means I may have a folder with main.tex main_Ch1.tex main_Ch2.tex etc... and when I run my xelatexCompile.bat I will get main.pdf main_Ch1.pdf main_Ch2.pdf which keeps everything current.

      • whether you manage your references (I like bibunits) in the main files by using a syntax like begin{bibunit} input{File} putbib end{bibunit} or you include this process in your standalone chapter, it doesn't make much difference. Personally, I keep this stuff in the main file as I never know when I am going to subdivide stand-alone files.

      • if you have common front-matter like Tables of Contents, figures, equations, nomenclature from glossaries or something, I recommend a distinct file to load via something like input{../Files/FrontMatter.tex} which you would always include in your main file to save repetition.

      • your header footer structure would be aspects I control in my cls file, but could also be done in main specific tex file preambles if you need customization.






      share|improve this answer

























        up vote
        2
        down vote













        Personally I think this comes down to file and document organization. Few comments based on the work flow I evolved into using:




        • Unless preparing a MWE, I never have a single file for a project or even part of a document.

        • I agree it can be very helpful to keep chapters or other types of hierarchy as stand-alone and fully compilable document because you never know what you will want to examine or share.

        • I separate each stand-alone document, such as a chapter in a larger report, into a main file that loads my particular class file and/or preamble used begin{document} input{../Files/ActualStandAloneContent} end{document} to direct the compiler to my chapter content.

        • I keep all source files in subfolders of my project, such as the /Files/ mentioned above.

        • I keep all possible main files in a common folder where I have batch files prepared to compile ALL Tex files in this directory. Note this is where it is crucial not to have incomplete Tex files because the compiler will fail if they don't try and load a document class and begin/end the document. This means I may have a folder with main.tex main_Ch1.tex main_Ch2.tex etc... and when I run my xelatexCompile.bat I will get main.pdf main_Ch1.pdf main_Ch2.pdf which keeps everything current.

        • whether you manage your references (I like bibunits) in the main files by using a syntax like begin{bibunit} input{File} putbib end{bibunit} or you include this process in your standalone chapter, it doesn't make much difference. Personally, I keep this stuff in the main file as I never know when I am going to subdivide stand-alone files.

        • if you have common front-matter like Tables of Contents, figures, equations, nomenclature from glossaries or something, I recommend a distinct file to load via something like input{../Files/FrontMatter.tex} which you would always include in your main file to save repetition.

        • your header footer structure would be aspects I control in my cls file, but could also be done in main specific tex file preambles if you need customization.






        share|improve this answer























          up vote
          2
          down vote










          up vote
          2
          down vote









          Personally I think this comes down to file and document organization. Few comments based on the work flow I evolved into using:




          • Unless preparing a MWE, I never have a single file for a project or even part of a document.

          • I agree it can be very helpful to keep chapters or other types of hierarchy as stand-alone and fully compilable document because you never know what you will want to examine or share.

          • I separate each stand-alone document, such as a chapter in a larger report, into a main file that loads my particular class file and/or preamble used begin{document} input{../Files/ActualStandAloneContent} end{document} to direct the compiler to my chapter content.

          • I keep all source files in subfolders of my project, such as the /Files/ mentioned above.

          • I keep all possible main files in a common folder where I have batch files prepared to compile ALL Tex files in this directory. Note this is where it is crucial not to have incomplete Tex files because the compiler will fail if they don't try and load a document class and begin/end the document. This means I may have a folder with main.tex main_Ch1.tex main_Ch2.tex etc... and when I run my xelatexCompile.bat I will get main.pdf main_Ch1.pdf main_Ch2.pdf which keeps everything current.

          • whether you manage your references (I like bibunits) in the main files by using a syntax like begin{bibunit} input{File} putbib end{bibunit} or you include this process in your standalone chapter, it doesn't make much difference. Personally, I keep this stuff in the main file as I never know when I am going to subdivide stand-alone files.

          • if you have common front-matter like Tables of Contents, figures, equations, nomenclature from glossaries or something, I recommend a distinct file to load via something like input{../Files/FrontMatter.tex} which you would always include in your main file to save repetition.

          • your header footer structure would be aspects I control in my cls file, but could also be done in main specific tex file preambles if you need customization.






          share|improve this answer












          Personally I think this comes down to file and document organization. Few comments based on the work flow I evolved into using:




          • Unless preparing a MWE, I never have a single file for a project or even part of a document.

          • I agree it can be very helpful to keep chapters or other types of hierarchy as stand-alone and fully compilable document because you never know what you will want to examine or share.

          • I separate each stand-alone document, such as a chapter in a larger report, into a main file that loads my particular class file and/or preamble used begin{document} input{../Files/ActualStandAloneContent} end{document} to direct the compiler to my chapter content.

          • I keep all source files in subfolders of my project, such as the /Files/ mentioned above.

          • I keep all possible main files in a common folder where I have batch files prepared to compile ALL Tex files in this directory. Note this is where it is crucial not to have incomplete Tex files because the compiler will fail if they don't try and load a document class and begin/end the document. This means I may have a folder with main.tex main_Ch1.tex main_Ch2.tex etc... and when I run my xelatexCompile.bat I will get main.pdf main_Ch1.pdf main_Ch2.pdf which keeps everything current.

          • whether you manage your references (I like bibunits) in the main files by using a syntax like begin{bibunit} input{File} putbib end{bibunit} or you include this process in your standalone chapter, it doesn't make much difference. Personally, I keep this stuff in the main file as I never know when I am going to subdivide stand-alone files.

          • if you have common front-matter like Tables of Contents, figures, equations, nomenclature from glossaries or something, I recommend a distinct file to load via something like input{../Files/FrontMatter.tex} which you would always include in your main file to save repetition.

          • your header footer structure would be aspects I control in my cls file, but could also be done in main specific tex file preambles if you need customization.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 21 '15 at 4:51









          EngBIRD

          2,4002731




          2,4002731






















              up vote
              0
              down vote













              Following is the folder-file structure I have been using for many years after trying includeonly for about a year. It uses jobname a lot for automating things.





              • GRAPHICS (Folder for the editable graphics from which the pdfs were made.)



                1   Folder for the graphics for Chapter 1
                2 Folder for the graphics for Chapter 2
                101 Folder for the graphics for Appendix 1


                FIGURES (Folder for the pdfs used in the includegraphics)



                1   Folder for the pdfs for Chapter 1
                2 Folder for the pdfs for Chapter 2
                101 Folder for the pdfs for Appendix 1



              • STYLESHEETS  Folder containing only the following two files:



                GraphicsPaths.sty    contains only the following command:

                graphicspath%
                {%
                {../Figures/1/}
                {../Figures/2/}
                {../Figures/101/}
                Preamble.sty    This file contains the various  usepackage and the definition of the various definecolor, newcounter, newcommand, etc.


                TEXT-CONTENTS (Folder for the files containing just the CONTENT of the chapter)



                1.tex   Content of Chapter 1
                2.tex Content of Chapter 2
                101.tex Content of Appendix 1


                Each of the above files contains the following code followed by the content of the chapter



                    %!TEX root = ../Text-controls/jobname.tex
                %!TEX TS-program = pdflatexmk  
                chapter{Name}
                ChapterToc


                BOOK.tex This is the content file for the whole book and contains ONLY the following code:

                %!TEX root = ../Text-controls/jobname.tex
                %!TEX TS-program = pdflatexmk  
                mainmatter
                include{../Text-contents/1}
                include{../Text-contents/2}



              • TEXT-CONTROLS folder for the files controlling the content files. (After compilation, this folder will also contains the aux files, toc files, etc and the pdf for each chapter.)



                1.tex  Control of Chapter 1
                2.tex  Control of Chapter 2
                101.tex  Control of Appendix 1

                Each of the above files contains ONLY the following code:
                % !TEX TS-program = pdflatexmk
                documentclass[11pt]{book}
                usepackage{../StyleSheets/Preamble}
                usepackage{../StyleSheets/GraphicsPaths}
                begin{document}
                addtocounter{page}{n} (where n+1 will be the number of the first page of the chapter.)
                addtocounter{chapter}{jobname-1}
                include{../Text-contents/jobname}
                printindex
                end{document}

                BOOK.tex is the control file for the whole book and contains ONLY the following code:
                % !TEX TS-program = pdflatexmk
                documentclass[11pt]{book}
                usepackage{../StyleSheets/Preamble}
                usepackage{../StyleSheets/GraphicsPaths}
                begin{document}
                frontmatter
                thispagestyle{empty}
                hspace{-12mm}{Large textsc{Name of the Book}}
                cleartooddpage[thispagestyle{empty}]

                etc, etc

                tableofcontents
                input{../Text-contents/BOOK}

                appendix
                addtocontents{toc}{protectsetcounter{tocdepth}{2}}
                include{../Text-contents/101}

                backmatter
                phantomsection
                addcontentsline{toc}{chapter}{Index}
                printindex
                end{document}



              The same structure can be used for the ancillaries. See http://tug.org/pracjourn/2010-2/schremmer.html






              share|improve this answer

























                up vote
                0
                down vote













                Following is the folder-file structure I have been using for many years after trying includeonly for about a year. It uses jobname a lot for automating things.





                • GRAPHICS (Folder for the editable graphics from which the pdfs were made.)



                  1   Folder for the graphics for Chapter 1
                  2 Folder for the graphics for Chapter 2
                  101 Folder for the graphics for Appendix 1


                  FIGURES (Folder for the pdfs used in the includegraphics)



                  1   Folder for the pdfs for Chapter 1
                  2 Folder for the pdfs for Chapter 2
                  101 Folder for the pdfs for Appendix 1



                • STYLESHEETS  Folder containing only the following two files:



                  GraphicsPaths.sty    contains only the following command:

                  graphicspath%
                  {%
                  {../Figures/1/}
                  {../Figures/2/}
                  {../Figures/101/}
                  Preamble.sty    This file contains the various  usepackage and the definition of the various definecolor, newcounter, newcommand, etc.


                  TEXT-CONTENTS (Folder for the files containing just the CONTENT of the chapter)



                  1.tex   Content of Chapter 1
                  2.tex Content of Chapter 2
                  101.tex Content of Appendix 1


                  Each of the above files contains the following code followed by the content of the chapter



                      %!TEX root = ../Text-controls/jobname.tex
                  %!TEX TS-program = pdflatexmk  
                  chapter{Name}
                  ChapterToc


                  BOOK.tex This is the content file for the whole book and contains ONLY the following code:

                  %!TEX root = ../Text-controls/jobname.tex
                  %!TEX TS-program = pdflatexmk  
                  mainmatter
                  include{../Text-contents/1}
                  include{../Text-contents/2}



                • TEXT-CONTROLS folder for the files controlling the content files. (After compilation, this folder will also contains the aux files, toc files, etc and the pdf for each chapter.)



                  1.tex  Control of Chapter 1
                  2.tex  Control of Chapter 2
                  101.tex  Control of Appendix 1

                  Each of the above files contains ONLY the following code:
                  % !TEX TS-program = pdflatexmk
                  documentclass[11pt]{book}
                  usepackage{../StyleSheets/Preamble}
                  usepackage{../StyleSheets/GraphicsPaths}
                  begin{document}
                  addtocounter{page}{n} (where n+1 will be the number of the first page of the chapter.)
                  addtocounter{chapter}{jobname-1}
                  include{../Text-contents/jobname}
                  printindex
                  end{document}

                  BOOK.tex is the control file for the whole book and contains ONLY the following code:
                  % !TEX TS-program = pdflatexmk
                  documentclass[11pt]{book}
                  usepackage{../StyleSheets/Preamble}
                  usepackage{../StyleSheets/GraphicsPaths}
                  begin{document}
                  frontmatter
                  thispagestyle{empty}
                  hspace{-12mm}{Large textsc{Name of the Book}}
                  cleartooddpage[thispagestyle{empty}]

                  etc, etc

                  tableofcontents
                  input{../Text-contents/BOOK}

                  appendix
                  addtocontents{toc}{protectsetcounter{tocdepth}{2}}
                  include{../Text-contents/101}

                  backmatter
                  phantomsection
                  addcontentsline{toc}{chapter}{Index}
                  printindex
                  end{document}



                The same structure can be used for the ancillaries. See http://tug.org/pracjourn/2010-2/schremmer.html






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Following is the folder-file structure I have been using for many years after trying includeonly for about a year. It uses jobname a lot for automating things.





                  • GRAPHICS (Folder for the editable graphics from which the pdfs were made.)



                    1   Folder for the graphics for Chapter 1
                    2 Folder for the graphics for Chapter 2
                    101 Folder for the graphics for Appendix 1


                    FIGURES (Folder for the pdfs used in the includegraphics)



                    1   Folder for the pdfs for Chapter 1
                    2 Folder for the pdfs for Chapter 2
                    101 Folder for the pdfs for Appendix 1



                  • STYLESHEETS  Folder containing only the following two files:



                    GraphicsPaths.sty    contains only the following command:

                    graphicspath%
                    {%
                    {../Figures/1/}
                    {../Figures/2/}
                    {../Figures/101/}
                    Preamble.sty    This file contains the various  usepackage and the definition of the various definecolor, newcounter, newcommand, etc.


                    TEXT-CONTENTS (Folder for the files containing just the CONTENT of the chapter)



                    1.tex   Content of Chapter 1
                    2.tex Content of Chapter 2
                    101.tex Content of Appendix 1


                    Each of the above files contains the following code followed by the content of the chapter



                        %!TEX root = ../Text-controls/jobname.tex
                    %!TEX TS-program = pdflatexmk  
                    chapter{Name}
                    ChapterToc


                    BOOK.tex This is the content file for the whole book and contains ONLY the following code:

                    %!TEX root = ../Text-controls/jobname.tex
                    %!TEX TS-program = pdflatexmk  
                    mainmatter
                    include{../Text-contents/1}
                    include{../Text-contents/2}



                  • TEXT-CONTROLS folder for the files controlling the content files. (After compilation, this folder will also contains the aux files, toc files, etc and the pdf for each chapter.)



                    1.tex  Control of Chapter 1
                    2.tex  Control of Chapter 2
                    101.tex  Control of Appendix 1

                    Each of the above files contains ONLY the following code:
                    % !TEX TS-program = pdflatexmk
                    documentclass[11pt]{book}
                    usepackage{../StyleSheets/Preamble}
                    usepackage{../StyleSheets/GraphicsPaths}
                    begin{document}
                    addtocounter{page}{n} (where n+1 will be the number of the first page of the chapter.)
                    addtocounter{chapter}{jobname-1}
                    include{../Text-contents/jobname}
                    printindex
                    end{document}

                    BOOK.tex is the control file for the whole book and contains ONLY the following code:
                    % !TEX TS-program = pdflatexmk
                    documentclass[11pt]{book}
                    usepackage{../StyleSheets/Preamble}
                    usepackage{../StyleSheets/GraphicsPaths}
                    begin{document}
                    frontmatter
                    thispagestyle{empty}
                    hspace{-12mm}{Large textsc{Name of the Book}}
                    cleartooddpage[thispagestyle{empty}]

                    etc, etc

                    tableofcontents
                    input{../Text-contents/BOOK}

                    appendix
                    addtocontents{toc}{protectsetcounter{tocdepth}{2}}
                    include{../Text-contents/101}

                    backmatter
                    phantomsection
                    addcontentsline{toc}{chapter}{Index}
                    printindex
                    end{document}



                  The same structure can be used for the ancillaries. See http://tug.org/pracjourn/2010-2/schremmer.html






                  share|improve this answer












                  Following is the folder-file structure I have been using for many years after trying includeonly for about a year. It uses jobname a lot for automating things.





                  • GRAPHICS (Folder for the editable graphics from which the pdfs were made.)



                    1   Folder for the graphics for Chapter 1
                    2 Folder for the graphics for Chapter 2
                    101 Folder for the graphics for Appendix 1


                    FIGURES (Folder for the pdfs used in the includegraphics)



                    1   Folder for the pdfs for Chapter 1
                    2 Folder for the pdfs for Chapter 2
                    101 Folder for the pdfs for Appendix 1



                  • STYLESHEETS  Folder containing only the following two files:



                    GraphicsPaths.sty    contains only the following command:

                    graphicspath%
                    {%
                    {../Figures/1/}
                    {../Figures/2/}
                    {../Figures/101/}
                    Preamble.sty    This file contains the various  usepackage and the definition of the various definecolor, newcounter, newcommand, etc.


                    TEXT-CONTENTS (Folder for the files containing just the CONTENT of the chapter)



                    1.tex   Content of Chapter 1
                    2.tex Content of Chapter 2
                    101.tex Content of Appendix 1


                    Each of the above files contains the following code followed by the content of the chapter



                        %!TEX root = ../Text-controls/jobname.tex
                    %!TEX TS-program = pdflatexmk  
                    chapter{Name}
                    ChapterToc


                    BOOK.tex This is the content file for the whole book and contains ONLY the following code:

                    %!TEX root = ../Text-controls/jobname.tex
                    %!TEX TS-program = pdflatexmk  
                    mainmatter
                    include{../Text-contents/1}
                    include{../Text-contents/2}



                  • TEXT-CONTROLS folder for the files controlling the content files. (After compilation, this folder will also contains the aux files, toc files, etc and the pdf for each chapter.)



                    1.tex  Control of Chapter 1
                    2.tex  Control of Chapter 2
                    101.tex  Control of Appendix 1

                    Each of the above files contains ONLY the following code:
                    % !TEX TS-program = pdflatexmk
                    documentclass[11pt]{book}
                    usepackage{../StyleSheets/Preamble}
                    usepackage{../StyleSheets/GraphicsPaths}
                    begin{document}
                    addtocounter{page}{n} (where n+1 will be the number of the first page of the chapter.)
                    addtocounter{chapter}{jobname-1}
                    include{../Text-contents/jobname}
                    printindex
                    end{document}

                    BOOK.tex is the control file for the whole book and contains ONLY the following code:
                    % !TEX TS-program = pdflatexmk
                    documentclass[11pt]{book}
                    usepackage{../StyleSheets/Preamble}
                    usepackage{../StyleSheets/GraphicsPaths}
                    begin{document}
                    frontmatter
                    thispagestyle{empty}
                    hspace{-12mm}{Large textsc{Name of the Book}}
                    cleartooddpage[thispagestyle{empty}]

                    etc, etc

                    tableofcontents
                    input{../Text-contents/BOOK}

                    appendix
                    addtocontents{toc}{protectsetcounter{tocdepth}{2}}
                    include{../Text-contents/101}

                    backmatter
                    phantomsection
                    addcontentsline{toc}{chapter}{Index}
                    printindex
                    end{document}



                  The same structure can be used for the ancillaries. See http://tug.org/pracjourn/2010-2/schremmer.html







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 4 hours ago









                  schremmer

                  8861015




                  8861015






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f251087%2fstandalone-chapters-with-separate-references-and-counters%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                      Calculate evaluation metrics using cross_val_predict sklearn

                      Insert data from modal to MySQL (multiple modal on website)