Quick Guide: VS Code setup for LaTeX (Arch Linux)

kurtnettlekurtnettle
3 min read

I encountered issues while compiling latex file in VS Code. I installed popular extension LaTeX Workshop but things weren’t working out of the box as I expected.

After doing some research, I realized that my system was missing some dependencies.

  1. texlive-binextra

  2. texlive-xetex

  3. perl-yaml-tiny

  4. perl-file-homedir

too lazy or no time for reading? no worry, I got you covered with one line command :)

pacman -S texlive-binextra texlive-xetex perl-yaml-tiny perl-file-homedir
💡
The above command is for Arch based distros, try checking your distro package manager for relevant packages.

Now we can format / compile / preview the .tex file.

\documentclass{article}

\begin{document}
Hello, World!
\end{document}

Got time to read? 🧐

Compile Error

Installing the first two deps texlive-binextra and texlive-xetex will fix the issue of compilation

Compiler log

Rc files read:
  NONE
Latexmk: This is Latexmk, John Collins, 27 Dec. 2024. Version 4.86a.
No existing .aux file, so I'll make a simple one, and require run of *latex.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex':  Reasons for rerun
Category 'other':
  Rerun of 'pdflatex' forced or previously required:
    Reason or flag: 'Initial setup'

------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder  "/home/username/projects/cv/main.tex"'
------------
This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2026/dev/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /etc/texmf/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /home/username/.texlive/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /home/username/.texlive/texmf-var/web2c
mktexfmt [INFO]: Did not find entry for byfmt=pdflatex skipped
mktexfmt [INFO]: disabled formats: 1
mktexfmt [INFO]: not selected formats: 8
mktexfmt [INFO]: total formats: 9
mktexfmt [INFO]: exiting with status 0
I can't find the format file `pdflatex.fmt'!
Latexmk: No log file was found, neither the expected one, 'main.log', nor one in '.'.
Latexmk: fls file doesn't appear to have been made.
Latexmk: Getting log file 'main.log'
Latexmk: Couldn't read log file 'main.log':
  No such file or directory
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: Run of rule 'pdflatex' gave a non-zero error code

----------------------
This message may duplicate earlier message.
Latexmk: Failure in processing file '/home/username/projects/cv/main':
   *LaTeX didn't generate the expected log file 'main.log'
----------------------
Latexmk: Sometimes, the -f option can be used to get latexmk
  to try to force complete processing.
  But normally, you will need to correct the file(s) that caused the
  error, and then rerun latexmk.
  In some cases, it is best to clean out generated files before rerunning
  latexmk after you've corrected the files.

Formatting Error

When you will try to format using the extension in VS Code you will get the following error.

This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2026/dev/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /etc/texmf/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /home/username/.texlive/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /home/username/.texlive/texmf-var/web2c
mktexfmt [INFO]: Did not find entry for byfmt=pdflatex skipped
mktexfmt [INFO]: disabled formats: 1
mktexfmt [INFO]: not selected formats: 8
mktexfmt [INFO]: total formats: 9
mktexfmt [INFO]: exiting with status 0
I can't find the format file `pdflatex.fmt'!

But the error logs were not much helpful to me. As I was using latexindent as the formatter, I ran the command directly on the terminal (latexindent main.text) to see the output and saw errors of missing Perl modules, specifically YAML::Tiny and File::HomeDir. Fortunately both of the modules were available for arch under the package perl-yaml-tiny and perl-file-homedir

Acknowledgments

Thanks to the following users whose posts or comments helped me investigate the issue:

  1. https://www.reddit.com/r/LaTeX/comments/xdv9qm/comment/iodi4ml (the first comment which helped me starting the debugging, I didn’t know the program name pdflatex so unsure about starting it)

  2. https://bbs.archlinux.org/viewtopic.php?id=300881

  3. https://bugs.archlinux.org/task/78896

0
Subscribe to my newsletter

Read articles from kurtnettle directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

kurtnettle
kurtnettle