documentation.tex assume to be a specific location relative to Cactus root directory

Create issue
Issue #2638 new
Roland Haas created an issue

Currently the LaTeX documentation files must include a relative path to cactus.sty like so:

\usepackage{../../../../doc/latex/cactus}

which, assuming the “typical” directory layout, accidentally works both when calling pdflatex directly (and manually) on the LaTeX input file in the source code location and via the various -ThornDoc and -ThornGuide make targets.

This is however fragile and fails if e.g. the thorn lives in a git repository of its own so that the directory layout is:

Cactus
|
+- repos
   |
   +- ThornRepo
      |
      +- doc
         |
         +- documenation.tex

rather than the expected

Cactus
|
+- repos
   |
   +- ArrRepo
      |
      +- Thorn
         |
         +- doc
            |
            +- documenation.tex

or (the initially envisioned one assumes):

Cactus
|
+- arrangements
   |
   +- ArrangeMent
      |
      +- Thorn
         |
         +- doc
            |
            +- documenation.tex

One way to handle this is to use conditionals to try both locations:

\IfFileExists{../../../doc/latex/cactus.sty}
% then
{\usepackage{../../../doc/latex/cactus}}
% else
{\usepackage{../../../../doc/latex/cactus}}

which is somewhat cumbersome and only works for those two locations so must be adjusted for each thorn. Another, likely the officially suggested way, is to the TEXINPUTS such that cactus.sty is directly found. E.g. something like:

export TEXTIPUTS=$TOP/doc/latex/:

in the Makefile and then use \usepackage{cactus} in documentation.tex. This however means one can no longer run pdflatex directly on the LaTeX sources. There is, since TeX does not actually itself do the searching, no way to set TEXINPUTS or a similar thing in TeX files it seems.

\IfFileExists may rely on LuaTeX features (not sure) and one may even have to resort to pure TeX for say tex4ht to work (https://tex.stackexchange.com/questions/98203/can-i-test-if-a-file-exists).

Comments (0)

  1. Log in to comment