TeX Files not building with VS Code

I wanted to create LaTeX Documents with VS Code and stumbled upon ‘LaTeX Workshop’ in the extensions marketplace. After following the installation guide in the wiki, I did the following:

  • Installing the Extension in VS Code
  • Installing Live Tex
  • appending /usr/local/texlive/2024/bin/x86_64-linux to PATH in .zshrc
  • creating a tex file in VS Code (LaTeX Language Mode)
  • filling it with a template
  • hitting the ‘build LaTeX project’ button or pressing CTRL + ALT + B

I was expecting to see a preview of the template but instead nothing happens. Literally nothing happens, no pop-up, no warning, no error.
The wiki of the extensions provides a FAQ section which states that Flatpak (or snap) versions of VS Code are not recommended and Code OSS on Arch Distributions are not supported.
I tried to build the template in both applications and they have the same issue.

At this point, I threw in the towel and resigned to using Overleaf. However, I still would like to not rely on it. Did I miss something in my installation or are there any alternatives to this solution?

Well, there you go :person_shrugging:

There is another person here in the forum with a similar problem. Look for “latexindent” in the forum’s search function.


I think @mithrial means this thread.

I don’t know how to handle the PATH in zsh.
The install instructions for texlive say that one should prepend texlive to the PATH (rather than append).
I don’t know whether that makes a difference.

There is vscodium-bin and vscodium-bin-marketplace in AUR
I have no idea how to properly integrate and use flatpak and snap versions of literally any software
and I do not know how to use vscode/vscodium.
But they both install flawlessly and the LaTeX Workshop extension also from within vscodium.

1 Like

Please see Environment variables - ArchWiki

The default shell one is using is unrelated.

1 Like

ok - thanks
So what I described there will work for zsh as well - I just could not test because I don’t have it/use it

You can use any LaTeX editor like TeXstudio, Texmaker or Kile.

You can even edit your .tex files using a simple text editor and easily compile it.

Can you post the error you get, or a screenshot at least.

1 Like

After some fiddling around I resolved the Issue but disappointingly I don’t really know how.

tl;dr: I could get it to work with Code OSS.

A bit after posting this thread I installed TeXstudio and built a sample PDF file.
I am a bit new to VS Code and LaTeX so I was not aware that there are a bunch of other files that go along with a built .tex file.
So I thought why not try again to generate a PDF file with LaTeX Workshop with the precompiled .tex file? I fired up VS Code from Flatpak and unexpectedly (I expected nothing to happen) got an error pop-up Recipe terminated with fatal error: spawn latexmk ENOENT., and the log spits out:

[***:***:38.988][Build] LaTeX build process spawned with PID undefined.
[***:***:38.988][Build] LaTeX fatal error on PID undefined. Error: spawn latexmk ENOENT
[***:***:38.989]Error: spawn latexmk ENOENT
    at Process.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[***:***:38.989][Build] Does the executable exist? $PATH: /app/bin:/app/bin:/app/bin:/usr/bin:/home/***/.var/app/com.visualstudio.code/data/node_modules/bin, $Path: undefined, $SHELL: /bin/sh

Which makes sense, a Flatpak Program can’t access PATH variables of the user since it is caged in its sandbox.
So I tried the same thing with Code OSS and all of a sudden I could build .tex files.

In between building in TeXstudio and VS Code I put my Computer to sleep and at some point I also rebooted my system. I have looked at other threads with similar problems and rebooting plays a big part in solving them. However the Issue has persisted several reboots before I created the TeXstudio project.
Apart from all of that, nothing really notable happened, at least to my knowledge.

The FAQ is maybe outdated or not concise enough, since I could get it to work. But it could be unstable, I’ll see in the future

You’re right. My bad, I meant to write prepend.

I also took that into consideration but the FAQ stated that vscodium was not supported and with the trend of how my previous efforts were going I assumed I would get nothing out of it.

As I was describing previously, I am a bit new to VS Code and was not aware, that you have to explicitly switch to the LaTeX Workshop Output to see the log messages. So I am sorry to say that the logs where nothing happened when I tried to build (no vs code pop-ups) are lost.

From personal experience, I tested many LaTeX editors and the best one is simply TeXstudio, it has many features and tools that make writing, compiling and previewing the result much more fast and easier.

That VSCode extension for LaTeX is too minimal and lacks many tools, I don’t understand why you need to use it instead of a full LaTeX editor?

1 Like

TexStudio is workable, and so is TexWorks that is packaged with TexLive.

Plus, Kile is now a worthwhile contender for those using KDE.

1 Like

Thanks for the suggestions! I will give them a try.

I use VS Code somewhat regularly as an IDE. I wanted to write and compile TeX files offline and saw users on forums recommend VS Code with the Workshop Extension among TeXStudio, Kile, etc… I thought: Neat! I don’t need another software, VS Code can handle it.

1 Like

I haven’t used VsCode for Latex; although I knew it was possible. My assumption was that it would just be a handy way to work with raw tex while being ‘away from the desk’; and finalize projects back at the IDE.

Experience has shown that it’s often difficult to find one software package that does everything you need it to. Sometimes I use several applications (or even several Operating Systems) to achieve the result I want, which gives me wide exposure to different applications.

I prefer to bend software to my wishes, rather than be forced to conform to a limited set of capabilities. If one app won’t do what I want, another will. :wink:

I might have a closer look at this VsCode plugin in the next few days.


1 Like