Two questions about using the TeXLive Sdk Extension

System information:
Distro: Linux Mint 20
Flatpak Version: 1.6.3

The TeXLive extension to the freedesktop Sdk, runtime/org.freedesktop.Sdk.Extension.texlive, is very large: the 19.08 branch has an installed size of 3.9 GB. I assume, based on its large size, that it contains a fully-working copy of texlive. My questions concern how I can actually make use of this copy of texlive.

There are some apps on flathub, such as TeXStudio, that already include the extension as a dependency. But there are at least two use cases where I would want to use the extension outside of apps like TeXStudio.

1)In a text editor flatpak app that doesn’t already call the extension as a dependency:

Suppose I am using a text editor to write a LaTeX file. As an example, I’ll use Kate (org.kde.kate on Flathub). Kate has a “build” plugin which can automate the process of building a project. However, the Kate flatpak doesn’t call the TeXLive extension as a dependency, and the KDE Sdk doesn’t include a LaTeX implementation. Thus, if I am editing a tex file in the Kate flatpak, I can’t use the build plugin.

One workaround is to give Kate access to host libraries, install texlive as a Deb package, and then use flatpak-spawn --host. The problems with this approach is that it means I am still reliant on my distro to ship an up-to-date version of texlive, and I have to break the sandbox around Kate to use it. This seems contrary to the spirit of Flatpak. If I were to switch to a distro that doesn’t ship a reasonably updated LaTeX implementation, then this workaround wouldn’t work.

Is there another way? Is there some option to give an already-compiled flatpak app (like Kate) access to the TexLive extension without having to rebuild the app myself?

2)Directly from the terminal outside of a flatpak app:

When I have the texlive deb package installed, I can use it directly from the terminal. Running “pdflatex foo.tex” compiles foo.tex into foo.pdf, and running “biber foobar” produces bibliography files from foobar.bib.

But suppose I were to use a distro that doesn’t ship texlive in its native package manager, or which ships a severely outdated version compared to what is hosted on Flathub. Is there a way to use the texlive SDK extension to call pdflatex and or other commands directly from the host terminal? Using
$ flatpak run org.freedesktop.Sdk.Extension.texlive/x86_64/19.08 pdflatex foo.tex
produces the error “bwrap: execvp /bin/sh: No such file or directory,” and similar commands I’ve tried have the same result.

Texlive is an SDK extension, so ideally application should build its own extension which will be available in the runtime. You can technically make it available by forcing the app to use SDK as the runtime with flatpak run --devel which will make it accessible somewhere at /usr/lib/sdk.

Similarly, to use it from CLI you need to install org.freedesktop.Sdk//19.08 first. Then you can poke around with flatpak run --command=bash org.freedesktop.Sdk//19.08 to find the path to binaries at /usr/lib/sdk.

1 Like