On Tue, Jun 22, 2021 at 09:51:38PM +0100, Gavin Smith wrote: > On Tue, Jun 22, 2021 at 10:19:19PM +0200, Christopher Dimech wrote: > > > > Doing as instructed fails to find files containing macros > > > > texi2pdf --clean 06a-amcoh.texi > > > > -------- > > > > texi2pdf --clean 06a-amcoh.texi > > This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) > > (preloaded format=pdfetex) > > restricted \write18 enabled. > > entering extended mode > > (../../.././06a-amcoh.texi (/home/hagbard/01cuneus/tdr/06ch/texinfo.tex > > Loading texinfo [version 2020-10-24.12]: pdf, fonts, markup, glyphs, > > page headings, tables, conditionals, indexing, sectioning, toc, > > environments, > > defuns, macros, cross references, insertions, > > (/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex > > This is `epsf.tex' v2.7.4 <14 February 2011> > > ) localization, formatting, and turning on texinfo input format.) > > ../../.././06a-amcoh.texi:85: I can't find file `../mastaba/ramasutra.texi'. > > @temp ->@input ../mastaba/ramasutra.texi > > > > @includezzz ...and @input #1 }@expandafter }@temp > > @popthisfilestack > > l.85 @include ../mastaba/ramasutra.texi > > > > (Press Enter to retry, or Control-D to exit) > > Please type another input file name: > > ../../.././06a-amcoh.texi:85: Emergency stop. > > @temp ->@input ../mastaba/ramasutra.texi > > > > @includezzz ...and @input #1 }@expandafter }@temp > > @popthisfilestack > > l.85 @include ../mastaba/ramasutra.texi > > > > ../../.././06a-amcoh.texi:85: ==> Fatal error occurred, no output PDF file > > pro > > duced! > > Transcript written on 06a-amcoh.log. > > /usr/local/bin/texi2dvi: pdfetex exited with bad status, quitting. > > There may be a problem with changing to a temporary directory in texi2dvi, > this should work but I would have to investigate.
The issue appears to be with the use of subdirectories with @include and specifically relative file names beginning "../". I tested with texi2pdf --clean for an include file in a subdirectory, like - @include subdir/thefile.texi - but this worked fine. However, when it looks like - @include ../include.texi - this breaks. Running KPATHSEA_DEBUG=32 texi2pdf --clean main.texi |& tee log shows the following: kdebug:start search(files=[texinfo.cnf.tex texinfo.cnf], must_exist=0, find_all=0, path=/home/g/src/texinfo/GIT/doc/test/subdir:/home/g/src/texinfo/GIT/doc/test/subdir/.:.:/home/g/.texlive2017/texmf-config/tex/plain//:/home/g/.texlive2017/texmf-var/tex/plain//:/home/g/texmf/tex/plain//:!!/usr/local/share/texmf/tex/plain//:/etc/texmf/tex/plain//:!!/var/lib/texmf/tex/plain//:!!/usr/share/texmf/tex/plain//:!!/usr/share/texlive/texmf-dist/tex/plain//:/home/g/.texlive2017/texmf-config/tex/generic//:/home/g/.texlive2017/texmf-var/tex/generic//:/home/g/texmf/tex/generic//:!!/usr/local/share/texmf/tex/generic//:/etc/texmf/tex/generic//:!!/var/lib/texmf/tex/generic//:!!/usr/share/texmf/tex/generic//:!!/usr/share/texlive/texmf-dist/tex/generic//:/home/g/.texlive2017/texmf-config/tex///:/home/g/.texlive2017/texmf-var/tex///:/home/g/texmf/tex///:!!/usr/local/share/texmf/tex///:/etc/texmf/tex///:!!/var/lib/texmf/tex///:!!/usr/share/texmf/tex///:!!/usr/share/texlive/texmf-dist/tex///). kdebug:search([texinfo.cnf.tex texinfo.cnf]) => )kdebug:kpse_find_file: searching for ../include.texi of type tex (from TEXINPUTS environment variable) kdebug:start search(files=[../include.texi.tex ../include.texi], must_exist=0, find_all=0, path=/home/g/src/texinfo/GIT/doc/test/subdir:/home/g/src/texinfo/GIT/doc/test/subdir/.:.:/home/g/.texlive2017/texmf-config/tex/plain//:/home/g/.texlive2017/texmf-var/tex/plain//:/home/g/texmf/tex/plain//:!!/usr/local/share/texmf/tex/plain//:/etc/texmf/tex/plain//:!!/var/lib/texmf/tex/plain//:!!/usr/share/texmf/tex/plain//:!!/usr/share/texlive/texmf-dist/tex/plain//:/home/g/.texlive2017/texmf-config/tex/generic//:/home/g/.texlive2017/texmf-var/tex/generic//:/home/g/texmf/tex/generic//:!!/usr/local/share/texmf/tex/generic//:/etc/texmf/tex/generic//:!!/var/lib/texmf/tex/generic//:!!/usr/share/texmf/tex/generic//:!!/usr/share/texlive/texmf-dist/tex/generic//:/home/g/.texlive2017/texmf-config/tex///:/home/g/.texlive2017/texmf-var/tex///:/home/g/texmf/tex///:!!/usr/local/share/texmf/tex///:/etc/texmf/tex///:!!/var/lib/texmf/tex///:!!/usr/share/texmf/tex///:!!/usr/share/texlive/texmf-dist/tex///). kdebug:search([../include.texi.tex ../include.texi]) => kdebug:start search(files=[../include.texi], must_exist=1, find_all=0, path=/home/g/src/texinfo/GIT/doc/test/subdir:/home/g/src/texinfo/GIT/doc/test/subdir/.:.:/home/g/.texlive2017/texmf-config/tex/plain//:/home/g/.texlive2017/texmf-var/tex/plain//:/home/g/texmf/tex/plain//:!!/usr/local/share/texmf/tex/plain//:/etc/texmf/tex/plain//:!!/var/lib/texmf/tex/plain//:!!/usr/share/texmf/tex/plain//:!!/usr/share/texlive/texmf-dist/tex/plain//:/home/g/.texlive2017/texmf-config/tex/generic//:/home/g/.texlive2017/texmf-var/tex/generic//:/home/g/texmf/tex/generic//:!!/usr/local/share/texmf/tex/generic//:/etc/texmf/tex/generic//:!!/var/lib/texmf/tex/generic//:!!/usr/share/texmf/tex/generic//:!!/usr/share/texlive/texmf-dist/tex/generic//:/home/g/.texlive2017/texmf-config/tex///:/home/g/.texlive2017/texmf-var/tex///:/home/g/texmf/tex///:!!/usr/local/share/texmf/tex///:/etc/texmf/tex///:!!/var/lib/texmf/tex///:!!/usr/share/texmf/tex///:!!/usr/share/texlive/texmf-dist/tex///). kdebug:search([../include.texi]) => ../../.././main.texi:5: I can't find file `../include.texi'. @temp ->@input ../include.texi @includezzz ...and @input #1 }@expandafter }@temp @popthisfilestack l.5 @include ../include.texi (Press Enter to retry, or Control-D to exit) Please type another input file name: ../../.././main.texi:5: Emergency stop. @temp ->@input ../include.texi @includezzz ...and @input #1 }@expandafter }@temp @popthisfilestack l.5 @include ../include.texi ../../.././main.texi:5: ==> Fatal error occurred, no output PDF file produced! Transcript written on main.log. /usr/local/bin/texi2dvi: pdfetex exited with bad status, quitting. $ The relevant documentation is in the "kpathsea" Info manual: >>> Each path element is checked in turn: first the database, then the disk. If a match is found, the search stops and the result is returned. This avoids possibly-expensive processing of path specifications that are never needed on a particular run. (Unless the search explicitly requested all matches.) Although the simplest and most common path element is a directory name, Kpathsea supports additional features in search paths: layered default values, environment variable names, config file values, users' home directories, and recursive subdirectory searching. Thus, we say that Kpathsea "expands" a path element, meaning transforming all the magic specifications into the basic directory name or names. This process is described in the sections below. It happens in the same order as the sections. Exception to all of the above: If the filename being searched for is absolute or explicitly relative, i.e., starts with '/' or './' or '../', Kpathsea simply checks if that file exists. >>> Under texi2pdf --clean, processing takes place in a different subdirectory to the input file. Hence a route to the file beginning ".." based at the location of the input file will be incorrect. I cannot see any hope of making this work, either in Texinfo or kpathsea. Therefore, I recommend you avoid the use of file names beginning "../" with @include commands. There are a couple of ways you could do this: * Restructure your project to put include files in lower-level directories * If that is not possible, you could use the TEXINPUTS variable. Replace @include ../mastaba/ramasutra.texi with @include mastaba/ramasutra.texi and then when you are running texi2pdf, you have to make sure that the directory containing the "mastaba" directory is found via TEXINPUTS. See the "kpathsea" manual for more information.