Github Codespaces, the Template, and LaTeX Package Management

114 views
Skip to first unread message

Aaron Wong

unread,
Mar 22, 2024, 1:59:11 PM3/22/24
to PreTeXt support
Hello -

I'm playing around with moving my textbook work from my desktop to GitHub Codespaces. In my LaTeX code, I use the chess font chessfss a couple times in some diagrams.


This package is not installed using the template file linked in the I.2 of the PreTeXt guide. I tried using the texlive package manager from the command line (at least, I think this is what I'm doing), and got this:

---
$ tlmgr install chessfss
(running on Debian, switching to user mode!)
(see /usr/share/doc/texlive-base/README.tlmgr-on-Debian.md)
TLPDB: not a directory, not loading: /home/vscode/texmf
tlmgr: user mode not initialized, please read the documentation!
---

I don't have any experience setting up LaTeX environments in Linux, so I'm kind of just groping around in the dark right now.

Is there an easy way to do LaTeX package management starting from that template? 

Thanks!

Aaron

Dalton Ma

unread,
Mar 22, 2024, 10:45:24 PM3/22/24
to PreTeXt support
You may try "tlmgr init-usertree" or use sudo to install it.

Hope this works!

Steven Clontz

unread,
Mar 23, 2024, 4:24:55 PM3/23/24
to PreTeXt support
Just to be clear, this is a diagram you're authoring with <latex-image>? Unfortunately, I don't think there's a way to express in PreTeXt what LaTeX packages are required to build your document - if it's not covered by the LaTeX packages we install to cover all the standard LaTeX producted by PreTeXt, then you're on your own to manage your Codespace's LaTeX packages (as of today, anyway).

However, if you want, you can modify the .devcontainer file for your Codespace to install the right extra LaTeX stuff for you: Change https://github.com/PreTeXtBook/pretext-cli/blob/84cbe8da2a59a478aca325bbc58bbbc8573cdb44/templates/.devcontainer.json#L30 to say

  "postCreateCommand": "pip install -r requirements.txt && command_to_install_whatever",


Then you can [ctrl/cmd]+[shift]+[p] and type "rebuild codespace" to get the command to rebuild your codespace with the right dependencies.

Aaron Wong

unread,
Mar 26, 2024, 7:43:06 PM3/26/24
to PreTeXt support
Hello everyone -

Thanks for the information. Ultimately, this looks like something that is simply above my paygrade. Those fancy chess fonts are not absolutely necessary for what I was trying to do, and I've invested enough time to understand that I don't know enough to do what I need to do without a step-by-step guide specific to the way things are set up in this template. The rest of this message is just a record of what I did, just in case someone finds this later and wants to give it a try, or sees this and knows of something other thing to try.

==== Trying from within Codespace

I was able to run  "tlmgr init-usertree" successfully, and when I reran the install command, I got a different error:

---
$ tlmgr init-usertree

$ tlmgr install chessfss
(running on Debian, switching to user mode!)
(see /usr/share/doc/texlive-base/README.tlmgr-on-Debian.md)

tlmgr: Local TeX Live (2020) is older than remote repository (2024).
Cross release updates are only supported with
  update-tlmgr-latest(.sh/.exe) --update
See https://tug.org/texlive/upgrade.html for details.
---

The linked website takes me to a 13 step process of upgrading from TeX Live 2023 to 2024 and has multiple warnings about not doing these things unless you know what you're doing. I got as far as figuring out that the parent directory was /usr/share/texlive and not /usr/local/texlive, but then there are no directories that look like a date (I was hoping to see 2020). And I don't even know if completing these steps will let me install the fonts and have things compile correctly.

My best guess after reading around a bit is that there are two texlive installations (see https://tex.stackexchange.com/questions/673389/older-than-remote-repository-but-2022-had-been-installed-and-now-need-to-update). Maybe one is default in Debian and then another one that is added on in the creation of the codespace, and that this is ultimately leading to things getting mixed up. But that's just a guess.

==== Trying to create a better codespace

I understand conceptually what Steven's message was asking me to do, but I don't have enough experience with LaTeX in Linux to really know what installation is actually missing. I looked through the .devcontainer.json that was created in my repository, and there was a line in there about changing the "image" to "oscarlevin/pretext:full". I tried that, but ran into the same problem.

I worked my way over to github.com/oscarlevin/pretext, but again found myself not being entirely sure where to look for things. And it's a different destination than what Steven had indicated, so I'm not even sure if that's the thing I should be looking at.

====

So at least for now, it seems that the answer to my initial question is "No, there is no simple way to do that." But I appreciate the ideas and information that was put forward.

Aaron
Reply all
Reply to author
Forward
0 new messages