<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    A long time ago I was involved in preparing some  notes on linear
    algebra, a task divided into<br>
    chapters, section, subsections, real text to be typeset. We
    persuaded Latex to do a lot<br>
    of the work by defining a top-level, driver file LinalgDRV.tex and a
    nested sequence of<br>
    minor drivers.<br>
    <br>
    BEFORE the \begin{document} command in LinalgDRV.tex there were
    these2 lines (among many others)<br>
      \newcommand{\dirsep}{/}<br>
     \newcommand{\dirprefix}{}<br>
    <br>
    AFTER the \begin{document} there were a series of commands to
    identify chapters:<br>
    <br>
    \include{Linalg-CH1}<br>
    <br>
    Linalg-CH1/tex started, for example, with<br>
    <br>
    \chapter{Zot}<br>
    \input{\dirprefix CH1\dirsep CH1-Sec3.tex}<br>
    <br>
    The file CH1/CH1-Sec3.tex started, for example, with<br>
    <br>
    \section{Yep}<br>
    \input{\dirprefix CH1\dirsep Sec3\dirsep CH1-Sec3-Sub2.tex}<br>
    <br>
    The file CH1/CH1/Sec3-Sub2.tex started, for example, with<br>
    \subsection{At last}<br>
    Real mathematics to be typeset<br>
    <br>
    You may not want the \section and \subsection headers, of course<br>
    <br>
    Then it was just a matter of running LinalgDRV.tex through our TeX
    compiler (TeXStudio, as it happens)<br>
    and the low-level files of real mathematics were all processed in
    sequence.<br>
    <br>
    It was also quite easy to splice in new pieces or take out ones no
    longer needed .. just edit the intermediate<br>
    driver files.<br>
    <br>
    Hope this helps a bit.<br>
    <br>
    Greg Bennett<br>
    <br>
    <div class="moz-cite-prefix">On 2024-11-16 18:39, zhutao qian wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAO3+VC_mcNjeNc5qq8_y55nKZMPNc8DaKcBjDcYCH31+x5G3Pw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p dir="ltr">Works perfect! Thanks a lot for your help!</p>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Stefan Löffler <<a
            href="mailto:st.loeffler@gmail.com" moz-do-not-send="true"
            class="moz-txt-link-freetext">st.loeffler@gmail.com</a>>
          于 2024年11月16日周六 下午10:41写道:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div> I would add the following two recommendations:<br>
            <br>
            *) Avoid paths with spaces (e.g., try something like
            "Latex-works" instead of "Latex works")<br>
            <br>
            *) Avoid absolute paths for files that "belong together",
            use relative paths instead (this also makes it much easier
            to copy/move the files, e.g., for a backup). E.g.,
            "\include{sections/1.tex}" instead of "\include{F:/LaTex
            works/test/sections/1.tex}" in F:/LaTex works/test/main.tex<br>
            <br>
            HTH<br>
            Stefan<br>
            <br>
            <div>On 16.11.24 20:32, Charles Nix wrote:<br>
            </div>
            <blockquote type="cite">
              <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;direction:null;color:#000000">
                <div>First off, I'm not a windows user, but no one else
                  has replied, so I will offer a couple of thoughts for
                  you to try.</div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000"> </div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000">1)
                  The error is coming from your TeX engine, not
                  TeXworks, so a general TeX mail list might get you
                  more answers.</div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000"> </div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000">2)
                  The error appears to be a problem writing an .aux file
                  in the subdirectory with the chapter .tex files.  Is
                  writing to that directory available to your TeX
                  engine?</div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000"> </div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000">3)
                  A quick search shows several similar questions on
                  stack exchange forums.  One thing mentioned is that
                  writing .aux files is restricted to a single directory
                  for security reasons, unless you set a command line
                  option.</div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000"> </div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000">I
                  would try moving the main and all chapters into the
                  same directory, adjusting your path settings to match,
                  and see if that works.</div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000"> </div>
                <div
style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:#000000">Charles
                  Nix </div>
                <div> </div>
                <div>
                  <div id="m_-4259129097663088950OLK_SRC_BODY_SECTION">
                    <div id="m_-4259129097663088950OLK_SRC_BODY_SECTION">
                      <blockquote
style="margin:0 0 0 .8em;border-left:1px #ccc solid;padding-left:1em">
                        <hr
                          id="m_-4259129097663088950MESSAGE_DATA_MARKER"><strong>From:
                        </strong>qian <a
                          href="mailto:zhutaoqian@gmail.com"
                          target="_blank" rel="noreferrer"
                          moz-do-not-send="true"><zhutaoqian@gmail.com></a><br>
                        <strong>To: </strong>texworks <a
                          href="mailto:texworks@tug.org" target="_blank"
                          rel="noreferrer" moz-do-not-send="true"><texworks@tug.org></a><br>
                        <strong>Date: </strong>Friday, 15 November 2024
                        5:57 PM EST<br>
                        <strong>Subject: </strong>[texworks] Problem of
                        compiling several tex files in one main file<br>
                        <br>
                        <div style="color:#000000">Hello! </div>
                        <div style="color:#000000"> </div>
                        <div style="color:#000000">It's really a
                          pleasure to use Texworks to write papers,
                          useful and extremely easy to handle.</div>
                        <div style="color:#000000"> </div>
                        <div style="color:#000000">However, I've
                          encountered a problem with several tex files
                          in one main file. I don't quite understand the
                          instructions in the manual. I'm writing an
                          article with more than 10 sections, and I want
                          to do them seperately in 10 tex files and then
                          use \include command to add them to the main
                          file, but it keeps sending errors.</div>
                        <div style="color:#000000"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">In
                          the main file when I compile it shows the
                          following:</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">"!
                          I can't write on file `"F:/LaTex
                          works/test/sections/1.aux"'.</div>
                        <div
style="text-indent:0px;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">\@include ...mmediate \openout \@partaux "#1.aux"</div>
                        <div
style="text-indent:0px;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">                                                 \immediate \write \@partau...</div>
                        <div
style="text-indent:0px;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">l.49 \include{F:/LaTex works/test/sections/1.tex}</div>
                        <div
style="text-indent:0px;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">                                               </div>
                        <div
style="text-indent:0px;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">(Press Enter to retry, or Control-Z to exit; default file extension is `.tex')</div>
                        <div
style="text-indent:0px;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#570606">Please type another output file name: "</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c"> </div>
                        <div style="color:#000000">And after I enter the
                          output file name, like "111", it worked but
                          created a new tex file "111.tex" sort like
                          this</div>
                        <div style="color:#06400c"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">"
                          \relax</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\providecommand\hyper@newdestlabel[2]{}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent }</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\@setckpt{F:/LaTex works/test/sections/1}{</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{page}{2}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{equation}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{enumi}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{enumii}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{enumiii}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{enumiv}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{footnote}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{mpfootnote}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{part}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{section}{1}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subsection}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subsubsection}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{paragraph}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subparagraph}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{figure}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{table}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{parentequation}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{section@level}{1}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{Item}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{Hfootnote}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{bookmark@seq@number}{1}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{caption@flags}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{continuedfloat}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{KVtest}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subfigure}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subfigure@save}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{lofdepth}{1}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subtable}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{subtable@save}{0}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">\setcounter{lotdepth}{1}</div>
                        <div
style="text-indent:0px;line-height:100%;white-space:pre-wrap;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c">}"</div>
                        <div
style="text-indent:0px;line-height:100%;margin:0px;font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#06400c"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">My
                          working location for the subfiles is  </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#c3971d">F:/LaTex
                          works/test/sections,</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">So
                          my include command is </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#c3971d">\include{F:/LaTex
                          works/test/sections/1.tex}</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">And
                          the main file is in </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#c3971d">F:/LaTex
                          works/test/,</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">so
                          as wrote in  the manual I add this</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#c3971d">%
                          !TeX root = F:/LaTex works/test/main.tex</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;color:#000000">at
                          the begining og the subdocument with no <span
                            style="font-size:12pt">preamble or
                            a document environment.</span></div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">I
                          would like to know whether it is a normal
                          situation, or I've done something wrong. </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">If
                          there's problem with my side, I'd like to know
                          how to solve this problem, cause it's bit
                          annoying to type something for everying single
                          subfile included in the main file.</div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000"> </div>
                        <div
style="font-family:'aptos','aptos_embeddedfont','aptos_msfontservice','calibri','helvetica',sans-serif;font-size:12pt;color:#000000">Thanks
                          a lot and wish you a very happy weekend!</div>
                        <div><br>
                          ----- configuration info -----<br>
                          TeXworks version : 0.6.8 ("github")
                          [r.6b1c6ab, 2023/2/18 上午 11:42]<br>
                          Install location : D:/Program Files
                          (x86)/texlive/2023/tlpkg/texworks/texworks.exe<br>
                          Library path :
                          C:/Users/Schlichting/AppData/Roaming/TUG/TeXworks/<br>
                          pdfTeX location : D:/Program Files
                          (x86)/texlive/2023/bin/windows/pdftex.exe<br>
                          Operating system : Windows 10, 64-bit<br>
                          Qt version : 5.15.8 (build) / 5.15.8 (runtime)<br>
                          ------------------------------</div>
                      </blockquote>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>