Is there a way to create Tex Live or LaTeX virtual environment?
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
add a comment |
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
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
add a comment |
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
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
packages paths texlive-2018
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
2
A nice thing about theTEXMFHOME
variable is that it works withtlmgr
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
2
A nice thing about theTEXMFHOME
variable is that it works withtlmgr
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
add a comment |
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
2
A nice thing about theTEXMFHOME
variable is that it works withtlmgr
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
add a comment |
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
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
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 theTEXMFHOME
variable is that it works withtlmgr
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
add a comment |
2
A nice thing about theTEXMFHOME
variable is that it works withtlmgr
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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