How to suitably configure the TEXINPUTS variable in latexmkrc for detecting the sty and cls files present in...












2















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:









share|improve this question

























  • first off relative directories should be relative to main thus AFAIK ./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

    – KJO
    Feb 13 at 20:13











  • @KJO I did not fully understand your comment about the relative directory? This custom_cls_sty_files is just a folder in my project's root where all the sty and cls files exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform.

    – Krishna
    Feb 13 at 20:16











  • Also if later on you don't want to use those custom stuff you'll need to update your latexmkrc. I'd recommend something else. Learn to use custom texmf trees. Both texlive and miktex has tools to add and remove these.

    – daleif
    Feb 13 at 20:18











  • @daleif I really prefer this particular approach. I know about local texmf trees. 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 by latexmk preferred over the system-wide sty files. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course)

    – Krishna
    Feb 13 at 20:24








  • 1





    A few basics windows uses ; where nix and mac use : so your syntax needs to change for windows versus others. You can place the sty in the same project folder as .tex no need to mess about with varieties of // ./ \ etc

    – KJO
    Feb 13 at 20:43


















2















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:









share|improve this question

























  • first off relative directories should be relative to main thus AFAIK ./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

    – KJO
    Feb 13 at 20:13











  • @KJO I did not fully understand your comment about the relative directory? This custom_cls_sty_files is just a folder in my project's root where all the sty and cls files exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform.

    – Krishna
    Feb 13 at 20:16











  • Also if later on you don't want to use those custom stuff you'll need to update your latexmkrc. I'd recommend something else. Learn to use custom texmf trees. Both texlive and miktex has tools to add and remove these.

    – daleif
    Feb 13 at 20:18











  • @daleif I really prefer this particular approach. I know about local texmf trees. 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 by latexmk preferred over the system-wide sty files. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course)

    – Krishna
    Feb 13 at 20:24








  • 1





    A few basics windows uses ; where nix and mac use : so your syntax needs to change for windows versus others. You can place the sty in the same project folder as .tex no need to mess about with varieties of // ./ \ etc

    – KJO
    Feb 13 at 20:43
















2












2








2








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:









share|improve this question
















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:






packages paths latexmk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 14 at 21:51







Krishna

















asked Feb 13 at 19:36









KrishnaKrishna

1,151620




1,151620













  • first off relative directories should be relative to main thus AFAIK ./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

    – KJO
    Feb 13 at 20:13











  • @KJO I did not fully understand your comment about the relative directory? This custom_cls_sty_files is just a folder in my project's root where all the sty and cls files exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform.

    – Krishna
    Feb 13 at 20:16











  • Also if later on you don't want to use those custom stuff you'll need to update your latexmkrc. I'd recommend something else. Learn to use custom texmf trees. Both texlive and miktex has tools to add and remove these.

    – daleif
    Feb 13 at 20:18











  • @daleif I really prefer this particular approach. I know about local texmf trees. 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 by latexmk preferred over the system-wide sty files. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course)

    – Krishna
    Feb 13 at 20:24








  • 1





    A few basics windows uses ; where nix and mac use : so your syntax needs to change for windows versus others. You can place the sty in the same project folder as .tex no need to mess about with varieties of // ./ \ etc

    – KJO
    Feb 13 at 20:43





















  • first off relative directories should be relative to main thus AFAIK ./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

    – KJO
    Feb 13 at 20:13











  • @KJO I did not fully understand your comment about the relative directory? This custom_cls_sty_files is just a folder in my project's root where all the sty and cls files exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform.

    – Krishna
    Feb 13 at 20:16











  • Also if later on you don't want to use those custom stuff you'll need to update your latexmkrc. I'd recommend something else. Learn to use custom texmf trees. Both texlive and miktex has tools to add and remove these.

    – daleif
    Feb 13 at 20:18











  • @daleif I really prefer this particular approach. I know about local texmf trees. 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 by latexmk preferred over the system-wide sty files. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course)

    – Krishna
    Feb 13 at 20:24








  • 1





    A few basics windows uses ; where nix and mac use : so your syntax needs to change for windows versus others. You can place the sty in the same project folder as .tex no need to mess about with varieties of // ./ \ etc

    – KJO
    Feb 13 at 20:43



















first off relative directories should be relative to main thus AFAIK ./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

– KJO
Feb 13 at 20:13





first off relative directories should be relative to main thus AFAIK ./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

– KJO
Feb 13 at 20:13













@KJO I did not fully understand your comment about the relative directory? This custom_cls_sty_files is just a folder in my project's root where all the sty and cls files exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform.

– Krishna
Feb 13 at 20:16





@KJO I did not fully understand your comment about the relative directory? This custom_cls_sty_files is just a folder in my project's root where all the sty and cls files exist. For the 2nd part of the comment, I have updated the question to clarify what I meant by cross-platform.

– Krishna
Feb 13 at 20:16













Also if later on you don't want to use those custom stuff you'll need to update your latexmkrc. I'd recommend something else. Learn to use custom texmf trees. Both texlive and miktex has tools to add and remove these.

– daleif
Feb 13 at 20:18





Also if later on you don't want to use those custom stuff you'll need to update your latexmkrc. I'd recommend something else. Learn to use custom texmf trees. Both texlive and miktex has tools to add and remove these.

– daleif
Feb 13 at 20:18













@daleif I really prefer this particular approach. I know about local texmf trees. 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 by latexmk preferred over the system-wide sty files. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course)

– Krishna
Feb 13 at 20:24







@daleif I really prefer this particular approach. I know about local texmf trees. 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 by latexmk preferred over the system-wide sty files. This way, everything I need for reproducibility is self-contained in the project (at the expense of an increased size, of course)

– Krishna
Feb 13 at 20:24






1




1





A few basics windows uses ; where nix and mac use : so your syntax needs to change for windows versus others. You can place the sty in the same project folder as .tex no need to mess about with varieties of // ./ \ etc

– KJO
Feb 13 at 20:43







A few basics windows uses ; where nix and mac use : so your syntax needs to change for windows versus others. You can place the sty in the same project folder as .tex no need to mess about with varieties of // ./ \ etc

– KJO
Feb 13 at 20:43












2 Answers
2






active

oldest

votes


















4














Latexmk actually has a subroutine for adding items to search paths. You can write



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


This takes care of using the correct operating-system-dependent separator between items in the variable. It also gracefully handles the case where the search-path variable doesn't already exist.



This subroutine is not yet documented, but it will be in the next release.



Documentation of ensure_path



ensure_path( var, values ...)


The first parameter is the name of one of the system's environment
variables for search paths. The remaining parameters are values that
should be in the variable. For each of the value parameters, if it
isn't already in the variable, then it is prepended to the variable;
in that case the environment variable is created if it doesn't already
exist. For separating values, the character appropriate the the
operating system is used -- see the configuration variable
$search_path_separator.



Example:



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


(In this example, the trailing // is documented by TeX systems to
mean that latex, pdflatex, etc search for files in the specified
directory and in all subdirectories.)



Technically ensure_path works by setting Perl's variable
$ENV{var}, where var is the name of the target variable.
The changed value is then passed as an environment variable to any
invoked programs.






share|improve this answer
























  • awesome. This is exactly what I was looking for. Upvoted & accepted.

    – Krishna
    Feb 14 at 18:06





















1














Newer versions of Tex Live address the need for user or project specific sets of files to override the defaults. This should only apply to give priority to the files that are there others that are on texmf paths will be used as normal. Although untested I would NOT split a TDS package between the two locations, so you may need to duplicate in some cases package related support files so as to be found relative to each other.



This was introduced in Tex Live 2017 and is invoked by calling (irrespective of platform)



 tlmgr conf auxtrees [add | remove | show] <path to desired files>


For windows use it may be something like (avoiding spaces and accents etc.)



tlmgr conf auxtrees add C:UsersmynamePersonalTexmf

tlmgr conf auxtrees show C:UsersmynamePersonalTexmf



Linux or OS/X users may need to use sudo:



sudo tlmgr conf auxtrees add "./personal_texmf"



You may need to experiment with using TDS compliant folders but the related structure should be similar to within texmf-local.

see also https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3



IT is important that the aux tree is NOT within an existing texmf structure (to avoid potential conflicts of priority) however the auxiliary may be a folder alongside texmf-local



IF texmf-local files interfere in precedence then it may become necessary to temporarily block a default texmf-local folder first via a shell script or manually commenting out via alternative copies of your current texmf.cnf



Here is a hypothetical example session from the 2017 blog



$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.
$ tlmgr conf auxtrees add /projects/book-abc
$ tlmgr conf auxtrees
List of auxiliary texmf trees:
/projects/book-abc
$ tlmgr conf auxtrees remove /projects/book-abc
$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.


That was very untypical, and we may need to address the filename database /font maps for the user prior to calling Tex Live in anger.



Note at the same time there were changes to




"The TEXMFLOCAL tree is now searched before TEXMFSYSCONFIG and
TEXMFSYSVAR (by default);"




The defaults should be




"TEXMFLOCAL (by default, /usr/local/texlive/texmf-local or
%SystemDrive%texlivetexmf-local on Windows) is intended for
system-wide local fonts and macros; and TEXMFHOME (by default,
$HOME/texmf or %USERPROFILE%texmf), is for personal fonts and macros.
These directories are intended to stick around from release to
release, and have their content seen automatically by a new TEX Live
release. Therefore, it is best to refrain from changing the definition
of TEXMFLOCAL to be too far away from the main TEX Live directory, or
you will need to manually change future releases."




It may be useful to see the results with Kpathsea & Kpsewhich
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-550007.1
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-650007.2.2



Thus after adding or removing a path to the priority order we should also call



mktexlsr   


or possibly better



texhash  





share|improve this answer





















  • 1





    Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

    – Krishna
    Feb 14 at 18:09













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474756%2fhow-to-suitably-configure-the-texinputs-variable-in-latexmkrc-for-detecting-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














Latexmk actually has a subroutine for adding items to search paths. You can write



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


This takes care of using the correct operating-system-dependent separator between items in the variable. It also gracefully handles the case where the search-path variable doesn't already exist.



This subroutine is not yet documented, but it will be in the next release.



Documentation of ensure_path



ensure_path( var, values ...)


The first parameter is the name of one of the system's environment
variables for search paths. The remaining parameters are values that
should be in the variable. For each of the value parameters, if it
isn't already in the variable, then it is prepended to the variable;
in that case the environment variable is created if it doesn't already
exist. For separating values, the character appropriate the the
operating system is used -- see the configuration variable
$search_path_separator.



Example:



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


(In this example, the trailing // is documented by TeX systems to
mean that latex, pdflatex, etc search for files in the specified
directory and in all subdirectories.)



Technically ensure_path works by setting Perl's variable
$ENV{var}, where var is the name of the target variable.
The changed value is then passed as an environment variable to any
invoked programs.






share|improve this answer
























  • awesome. This is exactly what I was looking for. Upvoted & accepted.

    – Krishna
    Feb 14 at 18:06


















4














Latexmk actually has a subroutine for adding items to search paths. You can write



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


This takes care of using the correct operating-system-dependent separator between items in the variable. It also gracefully handles the case where the search-path variable doesn't already exist.



This subroutine is not yet documented, but it will be in the next release.



Documentation of ensure_path



ensure_path( var, values ...)


The first parameter is the name of one of the system's environment
variables for search paths. The remaining parameters are values that
should be in the variable. For each of the value parameters, if it
isn't already in the variable, then it is prepended to the variable;
in that case the environment variable is created if it doesn't already
exist. For separating values, the character appropriate the the
operating system is used -- see the configuration variable
$search_path_separator.



Example:



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


(In this example, the trailing // is documented by TeX systems to
mean that latex, pdflatex, etc search for files in the specified
directory and in all subdirectories.)



Technically ensure_path works by setting Perl's variable
$ENV{var}, where var is the name of the target variable.
The changed value is then passed as an environment variable to any
invoked programs.






share|improve this answer
























  • awesome. This is exactly what I was looking for. Upvoted & accepted.

    – Krishna
    Feb 14 at 18:06
















4












4








4







Latexmk actually has a subroutine for adding items to search paths. You can write



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


This takes care of using the correct operating-system-dependent separator between items in the variable. It also gracefully handles the case where the search-path variable doesn't already exist.



This subroutine is not yet documented, but it will be in the next release.



Documentation of ensure_path



ensure_path( var, values ...)


The first parameter is the name of one of the system's environment
variables for search paths. The remaining parameters are values that
should be in the variable. For each of the value parameters, if it
isn't already in the variable, then it is prepended to the variable;
in that case the environment variable is created if it doesn't already
exist. For separating values, the character appropriate the the
operating system is used -- see the configuration variable
$search_path_separator.



Example:



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


(In this example, the trailing // is documented by TeX systems to
mean that latex, pdflatex, etc search for files in the specified
directory and in all subdirectories.)



Technically ensure_path works by setting Perl's variable
$ENV{var}, where var is the name of the target variable.
The changed value is then passed as an environment variable to any
invoked programs.






share|improve this answer













Latexmk actually has a subroutine for adding items to search paths. You can write



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


This takes care of using the correct operating-system-dependent separator between items in the variable. It also gracefully handles the case where the search-path variable doesn't already exist.



This subroutine is not yet documented, but it will be in the next release.



Documentation of ensure_path



ensure_path( var, values ...)


The first parameter is the name of one of the system's environment
variables for search paths. The remaining parameters are values that
should be in the variable. For each of the value parameters, if it
isn't already in the variable, then it is prepended to the variable;
in that case the environment variable is created if it doesn't already
exist. For separating values, the character appropriate the the
operating system is used -- see the configuration variable
$search_path_separator.



Example:



ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );


(In this example, the trailing // is documented by TeX systems to
mean that latex, pdflatex, etc search for files in the specified
directory and in all subdirectories.)



Technically ensure_path works by setting Perl's variable
$ENV{var}, where var is the name of the target variable.
The changed value is then passed as an environment variable to any
invoked programs.







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 14 at 18:05









John CollinsJohn Collins

6,9701825




6,9701825













  • awesome. This is exactly what I was looking for. Upvoted & accepted.

    – Krishna
    Feb 14 at 18:06





















  • awesome. This is exactly what I was looking for. Upvoted & accepted.

    – Krishna
    Feb 14 at 18:06



















awesome. This is exactly what I was looking for. Upvoted & accepted.

– Krishna
Feb 14 at 18:06







awesome. This is exactly what I was looking for. Upvoted & accepted.

– Krishna
Feb 14 at 18:06













1














Newer versions of Tex Live address the need for user or project specific sets of files to override the defaults. This should only apply to give priority to the files that are there others that are on texmf paths will be used as normal. Although untested I would NOT split a TDS package between the two locations, so you may need to duplicate in some cases package related support files so as to be found relative to each other.



This was introduced in Tex Live 2017 and is invoked by calling (irrespective of platform)



 tlmgr conf auxtrees [add | remove | show] <path to desired files>


For windows use it may be something like (avoiding spaces and accents etc.)



tlmgr conf auxtrees add C:UsersmynamePersonalTexmf

tlmgr conf auxtrees show C:UsersmynamePersonalTexmf



Linux or OS/X users may need to use sudo:



sudo tlmgr conf auxtrees add "./personal_texmf"



You may need to experiment with using TDS compliant folders but the related structure should be similar to within texmf-local.

see also https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3



IT is important that the aux tree is NOT within an existing texmf structure (to avoid potential conflicts of priority) however the auxiliary may be a folder alongside texmf-local



IF texmf-local files interfere in precedence then it may become necessary to temporarily block a default texmf-local folder first via a shell script or manually commenting out via alternative copies of your current texmf.cnf



Here is a hypothetical example session from the 2017 blog



$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.
$ tlmgr conf auxtrees add /projects/book-abc
$ tlmgr conf auxtrees
List of auxiliary texmf trees:
/projects/book-abc
$ tlmgr conf auxtrees remove /projects/book-abc
$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.


That was very untypical, and we may need to address the filename database /font maps for the user prior to calling Tex Live in anger.



Note at the same time there were changes to




"The TEXMFLOCAL tree is now searched before TEXMFSYSCONFIG and
TEXMFSYSVAR (by default);"




The defaults should be




"TEXMFLOCAL (by default, /usr/local/texlive/texmf-local or
%SystemDrive%texlivetexmf-local on Windows) is intended for
system-wide local fonts and macros; and TEXMFHOME (by default,
$HOME/texmf or %USERPROFILE%texmf), is for personal fonts and macros.
These directories are intended to stick around from release to
release, and have their content seen automatically by a new TEX Live
release. Therefore, it is best to refrain from changing the definition
of TEXMFLOCAL to be too far away from the main TEX Live directory, or
you will need to manually change future releases."




It may be useful to see the results with Kpathsea & Kpsewhich
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-550007.1
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-650007.2.2



Thus after adding or removing a path to the priority order we should also call



mktexlsr   


or possibly better



texhash  





share|improve this answer





















  • 1





    Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

    – Krishna
    Feb 14 at 18:09


















1














Newer versions of Tex Live address the need for user or project specific sets of files to override the defaults. This should only apply to give priority to the files that are there others that are on texmf paths will be used as normal. Although untested I would NOT split a TDS package between the two locations, so you may need to duplicate in some cases package related support files so as to be found relative to each other.



This was introduced in Tex Live 2017 and is invoked by calling (irrespective of platform)



 tlmgr conf auxtrees [add | remove | show] <path to desired files>


For windows use it may be something like (avoiding spaces and accents etc.)



tlmgr conf auxtrees add C:UsersmynamePersonalTexmf

tlmgr conf auxtrees show C:UsersmynamePersonalTexmf



Linux or OS/X users may need to use sudo:



sudo tlmgr conf auxtrees add "./personal_texmf"



You may need to experiment with using TDS compliant folders but the related structure should be similar to within texmf-local.

see also https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3



IT is important that the aux tree is NOT within an existing texmf structure (to avoid potential conflicts of priority) however the auxiliary may be a folder alongside texmf-local



IF texmf-local files interfere in precedence then it may become necessary to temporarily block a default texmf-local folder first via a shell script or manually commenting out via alternative copies of your current texmf.cnf



Here is a hypothetical example session from the 2017 blog



$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.
$ tlmgr conf auxtrees add /projects/book-abc
$ tlmgr conf auxtrees
List of auxiliary texmf trees:
/projects/book-abc
$ tlmgr conf auxtrees remove /projects/book-abc
$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.


That was very untypical, and we may need to address the filename database /font maps for the user prior to calling Tex Live in anger.



Note at the same time there were changes to




"The TEXMFLOCAL tree is now searched before TEXMFSYSCONFIG and
TEXMFSYSVAR (by default);"




The defaults should be




"TEXMFLOCAL (by default, /usr/local/texlive/texmf-local or
%SystemDrive%texlivetexmf-local on Windows) is intended for
system-wide local fonts and macros; and TEXMFHOME (by default,
$HOME/texmf or %USERPROFILE%texmf), is for personal fonts and macros.
These directories are intended to stick around from release to
release, and have their content seen automatically by a new TEX Live
release. Therefore, it is best to refrain from changing the definition
of TEXMFLOCAL to be too far away from the main TEX Live directory, or
you will need to manually change future releases."




It may be useful to see the results with Kpathsea & Kpsewhich
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-550007.1
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-650007.2.2



Thus after adding or removing a path to the priority order we should also call



mktexlsr   


or possibly better



texhash  





share|improve this answer





















  • 1





    Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

    – Krishna
    Feb 14 at 18:09
















1












1








1







Newer versions of Tex Live address the need for user or project specific sets of files to override the defaults. This should only apply to give priority to the files that are there others that are on texmf paths will be used as normal. Although untested I would NOT split a TDS package between the two locations, so you may need to duplicate in some cases package related support files so as to be found relative to each other.



This was introduced in Tex Live 2017 and is invoked by calling (irrespective of platform)



 tlmgr conf auxtrees [add | remove | show] <path to desired files>


For windows use it may be something like (avoiding spaces and accents etc.)



tlmgr conf auxtrees add C:UsersmynamePersonalTexmf

tlmgr conf auxtrees show C:UsersmynamePersonalTexmf



Linux or OS/X users may need to use sudo:



sudo tlmgr conf auxtrees add "./personal_texmf"



You may need to experiment with using TDS compliant folders but the related structure should be similar to within texmf-local.

see also https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3



IT is important that the aux tree is NOT within an existing texmf structure (to avoid potential conflicts of priority) however the auxiliary may be a folder alongside texmf-local



IF texmf-local files interfere in precedence then it may become necessary to temporarily block a default texmf-local folder first via a shell script or manually commenting out via alternative copies of your current texmf.cnf



Here is a hypothetical example session from the 2017 blog



$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.
$ tlmgr conf auxtrees add /projects/book-abc
$ tlmgr conf auxtrees
List of auxiliary texmf trees:
/projects/book-abc
$ tlmgr conf auxtrees remove /projects/book-abc
$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.


That was very untypical, and we may need to address the filename database /font maps for the user prior to calling Tex Live in anger.



Note at the same time there were changes to




"The TEXMFLOCAL tree is now searched before TEXMFSYSCONFIG and
TEXMFSYSVAR (by default);"




The defaults should be




"TEXMFLOCAL (by default, /usr/local/texlive/texmf-local or
%SystemDrive%texlivetexmf-local on Windows) is intended for
system-wide local fonts and macros; and TEXMFHOME (by default,
$HOME/texmf or %USERPROFILE%texmf), is for personal fonts and macros.
These directories are intended to stick around from release to
release, and have their content seen automatically by a new TEX Live
release. Therefore, it is best to refrain from changing the definition
of TEXMFLOCAL to be too far away from the main TEX Live directory, or
you will need to manually change future releases."




It may be useful to see the results with Kpathsea & Kpsewhich
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-550007.1
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-650007.2.2



Thus after adding or removing a path to the priority order we should also call



mktexlsr   


or possibly better



texhash  





share|improve this answer















Newer versions of Tex Live address the need for user or project specific sets of files to override the defaults. This should only apply to give priority to the files that are there others that are on texmf paths will be used as normal. Although untested I would NOT split a TDS package between the two locations, so you may need to duplicate in some cases package related support files so as to be found relative to each other.



This was introduced in Tex Live 2017 and is invoked by calling (irrespective of platform)



 tlmgr conf auxtrees [add | remove | show] <path to desired files>


For windows use it may be something like (avoiding spaces and accents etc.)



tlmgr conf auxtrees add C:UsersmynamePersonalTexmf

tlmgr conf auxtrees show C:UsersmynamePersonalTexmf



Linux or OS/X users may need to use sudo:



sudo tlmgr conf auxtrees add "./personal_texmf"



You may need to experiment with using TDS compliant folders but the related structure should be similar to within texmf-local.

see also https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-110002.3



IT is important that the aux tree is NOT within an existing texmf structure (to avoid potential conflicts of priority) however the auxiliary may be a folder alongside texmf-local



IF texmf-local files interfere in precedence then it may become necessary to temporarily block a default texmf-local folder first via a shell script or manually commenting out via alternative copies of your current texmf.cnf



Here is a hypothetical example session from the 2017 blog



$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.
$ tlmgr conf auxtrees add /projects/book-abc
$ tlmgr conf auxtrees
List of auxiliary texmf trees:
/projects/book-abc
$ tlmgr conf auxtrees remove /projects/book-abc
$ tlmgr conf auxtrees show
tlmgr: no auxiliary texmf trees defined.


That was very untypical, and we may need to address the filename database /font maps for the user prior to calling Tex Live in anger.



Note at the same time there were changes to




"The TEXMFLOCAL tree is now searched before TEXMFSYSCONFIG and
TEXMFSYSVAR (by default);"




The defaults should be




"TEXMFLOCAL (by default, /usr/local/texlive/texmf-local or
%SystemDrive%texlivetexmf-local on Windows) is intended for
system-wide local fonts and macros; and TEXMFHOME (by default,
$HOME/texmf or %USERPROFILE%texmf), is for personal fonts and macros.
These directories are intended to stick around from release to
release, and have their content seen automatically by a new TEX Live
release. Therefore, it is best to refrain from changing the definition
of TEXMFLOCAL to be too far away from the main TEX Live directory, or
you will need to manually change future releases."




It may be useful to see the results with Kpathsea & Kpsewhich
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-550007.1
https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-650007.2.2



Thus after adding or removing a path to the priority order we should also call



mktexlsr   


or possibly better



texhash  






share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 13 at 22:23

























answered Feb 13 at 21:19









KJOKJO

2,6001119




2,6001119








  • 1





    Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

    – Krishna
    Feb 14 at 18:09
















  • 1





    Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

    – Krishna
    Feb 14 at 18:09










1




1





Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

– Krishna
Feb 14 at 18:09







Your solution worked nicely for me yesterday. Thank you for the awesome detailed answer. I hadn't heard of the conf auxtrees option before. I am glad I could learning something new from your answer. John Collin's latexmk-based solution answers exactly my question, whilst yours provides a valuable workaround. Hope it is okay if I accept his answer. I have upvoted for your answer for its usefulness.

– Krishna
Feb 14 at 18:09




















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474756%2fhow-to-suitably-configure-the-texinputs-variable-in-latexmkrc-for-detecting-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?