On Mon, Dec 23, 2024 at 11:27:51PM +0100, Patrice Dumas wrote: > On Thu, Dec 12, 2024 at 08:59:52AM -0500, Benjamin Kalish wrote: > > Two related questions: > > > > - I believe that @include paths are always relative to the location of > > the root file. Is that correct? > > Not necessarily, the @include arguments are searched for > * in directories specified with -P > * in the root file directory > * in the current directory > * in directories specified with -I > > > I'd love to be able to @include using paths > > relative to the file doing the including. Is that possible? > > It is not possible, and I think that it would be confusing, but you can > use -I to add the directory to the @include files search path. It is > not exactly the same, but I think that it is close enough.
Coming back to this, it may not be possible to make @include relative to the location of an included file. If I understand, it is like file.texi has "@include A/one.texi", and then "A/one.texi" has "@include two.texi", which is found as "@include A/two.texi". This would mean that we changed the search path for included files during an include. It no would longer operates as a simple textual inclusion. It would, of course, be possible to implement anything with texi2any, but possibly not with TeX. There is a discussion of this in the TeX FAQ: > Unfortunately, TeX doesn’t have a changeable "current directory", > so that all files you refer to have to be specified relative to the same > directory as the main file. Most people find this counter-intuitive. https://texfaq.org/FAQ-docotherdir That FAQ link refers to an "import" package for LaTeX that is a possible solution, which we would have to reimplement for texinfo.tex if were to try to accommodate such possibilities, but I doubt that it is worth the effort. It would involve adding a new command other than @include (like "@import") with a different syntax. In response to your query: > For example, if you have a directory of Texinfo files to be included, do > you have an index file to include them all in the proper order? What do you > call it, and does it live in that directory, or the directory above? I > haven't settled on a convention yet, and the mix of approaches is > definitely getting confusing. I don't have a clear idea of what to recommend. I assume that whatever you come up with is fine. One larger manual is emacs.texi, which uses @include, but not with subdirectories: https://git.savannah.gnu.org/cgit/emacs.git/tree/doc/emacs https://git.savannah.gnu.org/cgit/emacs.git/tree/doc/emacs/emacs.texi The Lilypond manuals use subdirectories although I'm not familiar with these. You could look at these links: https://git.savannah.gnu.org/cgit/lilypond.git/tree/Documentation/en https://git.savannah.gnu.org/cgit/lilypond.git/tree/Documentation/en/notation.tely You see the "notation" file includes files under a "notation" subdirectory, with lines such as: @include en/notation/notation.itely That seems similar to the layout you described.