Is there a way to create Tex Live or LaTeX virtual environment?










26















I am looking for a Python-style virtualenv or venv to create a virtual environment where I can install LaTeX packages such that the packages are available to my current LaTeX project only (but not available system-wide).



I am expecting something like the following:



  • Create a virtual-environment path, say, ./venv.

  • Set some environment variables or modify tlmgr install commands such that new packages are installed into ./venv with the proper directory structure.

  • Set some environment variables or modify pdflatex commands such that the new documents I compile use packages from the ./venv directory along with the packages in the system-wide paths that came with Tex Live distribution.

  • I do not however want to hardcode any ./venv paths in the LaTeX documents (the .tex files). The source code in the .tex file should be agnostic of whether it is being compiled with a virtual environment or not.









share|improve this question



















  • 1





    @HenriMenke I believe we can create multiple user-trees like this: tlmgr init-usertree --usertree ~/tex1; tlmgr init-usertree --usertree ~/tex2.

    – Lone Learner
    Aug 29 '18 at 3:56















26















I am looking for a Python-style virtualenv or venv to create a virtual environment where I can install LaTeX packages such that the packages are available to my current LaTeX project only (but not available system-wide).



I am expecting something like the following:



  • Create a virtual-environment path, say, ./venv.

  • Set some environment variables or modify tlmgr install commands such that new packages are installed into ./venv with the proper directory structure.

  • Set some environment variables or modify pdflatex commands such that the new documents I compile use packages from the ./venv directory along with the packages in the system-wide paths that came with Tex Live distribution.

  • I do not however want to hardcode any ./venv paths in the LaTeX documents (the .tex files). The source code in the .tex file should be agnostic of whether it is being compiled with a virtual environment or not.









share|improve this question



















  • 1





    @HenriMenke I believe we can create multiple user-trees like this: tlmgr init-usertree --usertree ~/tex1; tlmgr init-usertree --usertree ~/tex2.

    – Lone Learner
    Aug 29 '18 at 3:56













26












26








26


6






I am looking for a Python-style virtualenv or venv to create a virtual environment where I can install LaTeX packages such that the packages are available to my current LaTeX project only (but not available system-wide).



I am expecting something like the following:



  • Create a virtual-environment path, say, ./venv.

  • Set some environment variables or modify tlmgr install commands such that new packages are installed into ./venv with the proper directory structure.

  • Set some environment variables or modify pdflatex commands such that the new documents I compile use packages from the ./venv directory along with the packages in the system-wide paths that came with Tex Live distribution.

  • I do not however want to hardcode any ./venv paths in the LaTeX documents (the .tex files). The source code in the .tex file should be agnostic of whether it is being compiled with a virtual environment or not.









share|improve this question
















I am looking for a Python-style virtualenv or venv to create a virtual environment where I can install LaTeX packages such that the packages are available to my current LaTeX project only (but not available system-wide).



I am expecting something like the following:



  • Create a virtual-environment path, say, ./venv.

  • Set some environment variables or modify tlmgr install commands such that new packages are installed into ./venv with the proper directory structure.

  • Set some environment variables or modify pdflatex commands such that the new documents I compile use packages from the ./venv directory along with the packages in the system-wide paths that came with Tex Live distribution.

  • I do not however want to hardcode any ./venv paths in the LaTeX documents (the .tex files). The source code in the .tex file should be agnostic of whether it is being compiled with a virtual environment or not.






packages paths texlive-2018






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 29 '18 at 3:42







Lone Learner

















asked Aug 29 '18 at 3:33









Lone LearnerLone Learner

972717




972717







  • 1





    @HenriMenke I believe we can create multiple user-trees like this: tlmgr init-usertree --usertree ~/tex1; tlmgr init-usertree --usertree ~/tex2.

    – Lone Learner
    Aug 29 '18 at 3:56












  • 1





    @HenriMenke I believe we can create multiple user-trees like this: tlmgr init-usertree --usertree ~/tex1; tlmgr init-usertree --usertree ~/tex2.

    – Lone Learner
    Aug 29 '18 at 3:56







1




1





@HenriMenke I believe we can create multiple user-trees like this: tlmgr init-usertree --usertree ~/tex1; tlmgr init-usertree --usertree ~/tex2.

– Lone Learner
Aug 29 '18 at 3:56





@HenriMenke I believe we can create multiple user-trees like this: tlmgr init-usertree --usertree ~/tex1; tlmgr init-usertree --usertree ~/tex2.

– Lone Learner
Aug 29 '18 at 3:56










1 Answer
1






active

oldest

votes


















24














You can use TeX Live's user mode for that purpose. As you have already mentioned in the comments, you can create a new user tree (allowing multiple trees) using



$ tlmgr init-usertree --usertree ~/test-tree


To install a package in this tree you have to pass the user tree and the option --usermode



$ tlmgr install --usertree ~/test-tree --usermode <package>


To run LaTeX you have to give it a hint where to look for user packages, by setting the TEXMFHOME variable. You can either do this separately for each run



$ TEXMFHOME=~/test-tree pdflatex test.tex


or globally for the current shell by exporting the name (use unset to exit the “virtual environment”)



$ export TEXMFHOME=~/test-tree
$ pdflatex test.tex
$ unset TEXMFHOME





share|improve this answer




















  • 2





    A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

    – Lone Learner
    Aug 29 '18 at 4:25











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%2f448263%2fis-there-a-way-to-create-tex-live-or-latex-virtual-environment%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









24














You can use TeX Live's user mode for that purpose. As you have already mentioned in the comments, you can create a new user tree (allowing multiple trees) using



$ tlmgr init-usertree --usertree ~/test-tree


To install a package in this tree you have to pass the user tree and the option --usermode



$ tlmgr install --usertree ~/test-tree --usermode <package>


To run LaTeX you have to give it a hint where to look for user packages, by setting the TEXMFHOME variable. You can either do this separately for each run



$ TEXMFHOME=~/test-tree pdflatex test.tex


or globally for the current shell by exporting the name (use unset to exit the “virtual environment”)



$ export TEXMFHOME=~/test-tree
$ pdflatex test.tex
$ unset TEXMFHOME





share|improve this answer




















  • 2





    A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

    – Lone Learner
    Aug 29 '18 at 4:25















24














You can use TeX Live's user mode for that purpose. As you have already mentioned in the comments, you can create a new user tree (allowing multiple trees) using



$ tlmgr init-usertree --usertree ~/test-tree


To install a package in this tree you have to pass the user tree and the option --usermode



$ tlmgr install --usertree ~/test-tree --usermode <package>


To run LaTeX you have to give it a hint where to look for user packages, by setting the TEXMFHOME variable. You can either do this separately for each run



$ TEXMFHOME=~/test-tree pdflatex test.tex


or globally for the current shell by exporting the name (use unset to exit the “virtual environment”)



$ export TEXMFHOME=~/test-tree
$ pdflatex test.tex
$ unset TEXMFHOME





share|improve this answer




















  • 2





    A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

    – Lone Learner
    Aug 29 '18 at 4:25













24












24








24







You can use TeX Live's user mode for that purpose. As you have already mentioned in the comments, you can create a new user tree (allowing multiple trees) using



$ tlmgr init-usertree --usertree ~/test-tree


To install a package in this tree you have to pass the user tree and the option --usermode



$ tlmgr install --usertree ~/test-tree --usermode <package>


To run LaTeX you have to give it a hint where to look for user packages, by setting the TEXMFHOME variable. You can either do this separately for each run



$ TEXMFHOME=~/test-tree pdflatex test.tex


or globally for the current shell by exporting the name (use unset to exit the “virtual environment”)



$ export TEXMFHOME=~/test-tree
$ pdflatex test.tex
$ unset TEXMFHOME





share|improve this answer















You can use TeX Live's user mode for that purpose. As you have already mentioned in the comments, you can create a new user tree (allowing multiple trees) using



$ tlmgr init-usertree --usertree ~/test-tree


To install a package in this tree you have to pass the user tree and the option --usermode



$ tlmgr install --usertree ~/test-tree --usermode <package>


To run LaTeX you have to give it a hint where to look for user packages, by setting the TEXMFHOME variable. You can either do this separately for each run



$ TEXMFHOME=~/test-tree pdflatex test.tex


or globally for the current shell by exporting the name (use unset to exit the “virtual environment”)



$ export TEXMFHOME=~/test-tree
$ pdflatex test.tex
$ unset TEXMFHOME






share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 29 '18 at 4:16

























answered Aug 29 '18 at 4:09









Henri MenkeHenri Menke

77.3k8171285




77.3k8171285







  • 2





    A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

    – Lone Learner
    Aug 29 '18 at 4:25












  • 2





    A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

    – Lone Learner
    Aug 29 '18 at 4:25







2




2





A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

– Lone Learner
Aug 29 '18 at 4:25





A nice thing about the TEXMFHOME variable is that it works with tlmgr too. So we can do something like this too: export TEXMFHOME=~/tree; tlmgr init-usertree; tlmgr --usermode install csquotes; pdflatex foo.tex; unset TEXMFHOME

– Lone Learner
Aug 29 '18 at 4:25

















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%2f448263%2fis-there-a-way-to-create-tex-live-or-latex-virtual-environment%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

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)