I am working on a project where in the .cls and .sty files installed by the TeX distributions are too old, but they have been patched by other users on github. I wish to use these updated versions of these .cls and .sty files for my project. For various personal reasons (easy portability across computers), I do not wish to use texmf-local tree and wish to put them in a folder titled custom_cls_sty_files in the root of my project directory.
I am using latexmk as my build tool. Following the solution proposed here, I tried configuring my latexmkrc as
$ENV{'TEXINPUTS'}='./custom_cls_sty_files//:' . $ENV{'TEXINPUTS'};
However, this broke everything. latexmk is not only unable to find the .sty and .cls files, it could not find even main.tex!
Here is an mwe of main.tex
\documentclass{article}
\usepackage{setspace}
\usepackage{blindtext}
\begin{document}
\doublespacing
\blinddocument
\end{document}
where a local copy of setspace.sty is located in the folder custom_cls_sty_files.
Presently, I am encountering this issue on a Windows 10 machine on TL 2018. But I have a mac laptop at home and a linux machine at work where I work on this project through git/github combo. Therefore, I would like a single cross-platform latexmkrc file that can solve this issue (i.e. assuming that this issue arose in the first place due to OS differences)
Error message when trying the suggested solution
Use of uninitialized value in concatenation (.) or string at (eval 17) line 59, <GEN0> chunk 1.
Latexmk: This is Latexmk, John Collins, 25 October 2018, version: 4.61.
Latexmk: applying rule 'lualatex'...
Rule 'lualatex': Rules & subrules not known to be previously run:
lualatex
Rule 'lualatex': The following rules & subrules became out-of-date:
'lualatex'
------------
Run number 1 of rule 'lualatex'
------------
------------
Running 'lualatex -recorder "main.tex"'
------------
This is LuaTeX, Version 1.07.0 (TeX Live 2018/W32TeX)
restricted system commands enabled.
! I can't find file `main.tex'.
<*> main.tex
(Press Enter to retry, or Control-Z to exit)
Please type another input file name:
./custom_cls_sty_files//would need to be a subfolder of where the .tex is which may constantly change and not work always as expected & certainly above will not work like that on windows even if working on mac or nix since windows uses different separators. When you say across computers do you mean cross-platform which would require at least two different approaches or do you mean across flavours of Windows since if that is the case the approach will be different to the one you are pursuing. Please EDIT/clarify question – Feb 13 '19 at 20:13custom_cls_sty_filesis just a folder in my project's root where all thestyandclsfiles exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform. – Dr Krishnakumar Gopalakrishnan Feb 13 '19 at 20:16texmftrees. But I need this custom subfolder approach for archival purposes. Some package that I use are constantly changing breaking backwards compatibility with updates. I wish to use a specific version of these dependency files that can be fully controlled by me, and which will be automatically used bylatexmkpreferred over the system-widestyfiles. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course) – Dr Krishnakumar Gopalakrishnan Feb 13 '19 at 20:24OS/platformwithinlatexmkrcand accordingly handle this case? – Dr Krishnakumar Gopalakrishnan Feb 13 '19 at 20:45latexmkrcbased solution? Btw, the;did not work too. It proceeded quite farther, but finally errored out with! Undefined control sequence. l.40 \@writefbal }– Dr Krishnakumar Gopalakrishnan Feb 13 '19 at 20:52TL 2018installed as a non-root user. – Dr Krishnakumar Gopalakrishnan Feb 13 '19 at 20:59$ENV{'TEXINPUTS'}='./custom_cls_sty_files//;' . $ENV{'TEXINPUTS'};. The colon is replaced by a semicolon, which is the correct separator for the MSWin version of TeXLive. – John Collins Feb 13 '19 at 22:00linux, mac and windows. can we write conditionals to detect the OS withinlatexmkrcand adjust the expression accordingly? – Dr Krishnakumar Gopalakrishnan Feb 13 '19 at 22:01$ENV{'TEXINPUTS'}='./custom_cls_sty_files//' . $search_path_separator . $ENV{'TEXINPUTS'};. Better still, you can use a not-currently documented subroutine in latexmk, and writeensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );. – John Collins Feb 14 '19 at 16:41ensure_pathis brilliant and works beautifully. Can you please write this as an answer? This is exactly what I was looking for. Quick question: If we have a directory hierarchy likecustom_cls_sty_files/pkg_1andcustom_cls_sty_files/pkg_2, how will the correspondingensure_pathinvocation need to be changed? – Dr Krishnakumar Gopalakrishnan Feb 14 '19 at 17:16ensure_pathto thelatexmkdocumentation. – John Collins Feb 14 '19 at 17:48