[texworks] Problem of compiling several tex files in one main file
Greg Bennett
gwbennett at sentex.ca
Sun Nov 17 02:09:40 CET 2024
A long time ago I was involved in preparing some notes on linear
algebra, a task divided into
chapters, section, subsections, real text to be typeset. We persuaded
Latex to do a lot
of the work by defining a top-level, driver file LinalgDRV.tex and a
nested sequence of
minor drivers.
BEFORE the \begin{document} command in LinalgDRV.tex there were these2
lines (among many others)
\newcommand{\dirsep}{/}
\newcommand{\dirprefix}{}
AFTER the \begin{document} there were a series of commands to identify
chapters:
\include{Linalg-CH1}
Linalg-CH1/tex started, for example, with
\chapter{Zot}
\input{\dirprefix CH1\dirsep CH1-Sec3.tex}
The file CH1/CH1-Sec3.tex started, for example, with
\section{Yep}
\input{\dirprefix CH1\dirsep Sec3\dirsep CH1-Sec3-Sub2.tex}
The file CH1/CH1/Sec3-Sub2.tex started, for example, with
\subsection{At last}
Real mathematics to be typeset
You may not want the \section and \subsection headers, of course
Then it was just a matter of running LinalgDRV.tex through our TeX
compiler (TeXStudio, as it happens)
and the low-level files of real mathematics were all processed in sequence.
It was also quite easy to splice in new pieces or take out ones no
longer needed .. just edit the intermediate
driver files.
Hope this helps a bit.
Greg Bennett
On 2024-11-16 18:39, zhutao qian wrote:
>
> Works perfect! Thanks a lot for your help!
>
>
> Stefan Löffler <st.loeffler at gmail.com> 于 2024年11月16日周六
> 下午10:41写道:
>
> I would add the following two recommendations:
>
> *) Avoid paths with spaces (e.g., try something like "Latex-works"
> instead of "Latex works")
>
> *) 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
>
> HTH
> Stefan
>
> On 16.11.24 20:32, Charles Nix wrote:
>> 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.
>> 1) The error is coming from your TeX engine, not TeXworks, so a
>> general TeX mail list might get you more answers.
>> 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?
>> 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.
>> I would try moving the main and all chapters into the same
>> directory, adjusting your path settings to match, and see if that
>> works.
>> Charles Nix
>>
>> ------------------------------------------------------------------------
>> *From: *qian <zhutaoqian at gmail.com> <mailto:zhutaoqian at gmail.com>
>> *To: *texworks <texworks at tug.org> <mailto:texworks at tug.org>
>> *Date: *Friday, 15 November 2024 5:57 PM EST
>> *Subject: *[texworks] Problem of compiling several tex files
>> in one main file
>>
>> Hello!
>> It's really a pleasure to use Texworks to write papers,
>> useful and extremely easy to handle.
>> 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.
>> In the main file when I compile it shows the following:
>> "! I can't write on file `"F:/LaTex works/test/sections/1.aux"'.
>> \@include ...mmediate \openout \@partaux "#1.aux"
>> \immediate
>> \write \@partau...
>> l.49 \include{F:/LaTex works/test/sections/1.tex}
>> (Press Enter to retry, or Control-Z to exit; default file
>> extension is `.tex')
>> Please type another output file name: "
>> And after I enter the output file name, like "111", it worked
>> but created a new tex file "111.tex" sort like this
>> " \relax
>> \providecommand\hyper at newdestlabel[2]{}
>> \@writefile{toc}{\contentsline {section}{\numberline
>> {1}Introduction}{1}{section.1}\protected at file@percent }
>> \@setckpt{F:/LaTex works/test/sections/1}{
>> \setcounter{page}{2}
>> \setcounter{equation}{0}
>> \setcounter{enumi}{0}
>> \setcounter{enumii}{0}
>> \setcounter{enumiii}{0}
>> \setcounter{enumiv}{0}
>> \setcounter{footnote}{0}
>> \setcounter{mpfootnote}{0}
>> \setcounter{part}{0}
>> \setcounter{section}{1}
>> \setcounter{subsection}{0}
>> \setcounter{subsubsection}{0}
>> \setcounter{paragraph}{0}
>> \setcounter{subparagraph}{0}
>> \setcounter{figure}{0}
>> \setcounter{table}{0}
>> \setcounter{parentequation}{0}
>> \setcounter{section at level}{1}
>> \setcounter{Item}{0}
>> \setcounter{Hfootnote}{0}
>> \setcounter{bookmark at seq@number}{1}
>> \setcounter{caption at flags}{0}
>> \setcounter{continuedfloat}{0}
>> \setcounter{KVtest}{0}
>> \setcounter{subfigure}{0}
>> \setcounter{subfigure at save}{0}
>> \setcounter{lofdepth}{1}
>> \setcounter{subtable}{0}
>> \setcounter{subtable at save}{0}
>> \setcounter{lotdepth}{1}
>> }"
>> My working location for the subfiles is
>> F:/LaTex works/test/sections,
>> So my include command is
>> \include{F:/LaTex works/test/sections/1.tex}
>> And the main file is in
>> F:/LaTex works/test/,
>> so as wrote in the manual I add this
>> % !TeX root = F:/LaTex works/test/main.tex
>> at the begining og the subdocument with no preamble or
>> a document environment.
>> I would like to know whether it is a normal situation, or
>> I've done something wrong.
>> 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.
>> Thanks a lot and wish you a very happy weekend!
>>
>> ----- configuration info -----
>> TeXworks version : 0.6.8 ("github") [r.6b1c6ab, 2023/2/18 上午
>> 11:42]
>> Install location : D:/Program Files
>> (x86)/texlive/2023/tlpkg/texworks/texworks.exe
>> Library path : C:/Users/Schlichting/AppData/Roaming/TUG/TeXworks/
>> pdfTeX location : D:/Program Files
>> (x86)/texlive/2023/bin/windows/pdftex.exe
>> Operating system : Windows 10, 64-bit
>> Qt version : 5.15.8 (build) / 5.15.8 (runtime)
>> ------------------------------
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texworks/attachments/20241116/d98996fc/attachment-0001.htm>
More information about the texworks
mailing list.