Skip to content

Visual Studio Code

Gabor Szarnyas edited this page Sep 27, 2020 · 36 revisions

LaTeX workshop

LaTeX Workshop is an extension to handle LaTeX documents.

Auto-formatting tables

Tables can be formatted using the latexindent Perl scripts. It's recommended to test it in the command line and fix missing dependencies. On Ubuntu 18.04, these were sufficient:

sudo cpan Unicode::GCString 
sudo cpan App::cpanminus
sudo cpan YAML::Tiny
sudo perl -MCPAN -e 'install "File::HomeDir"'
sudo cpan -fi Log::Log4perl #-fi might not be required?
sudo cpan Log::Dispatch
sudo cpan -fi File::HomeDir #-fi might not be required?
sudo cpan Log::Dispatch::File #?

On Fedora 32, this feature worked out-of-the-box with texlive-scheme-full installed.

See this issue for installation on other platforms.

Magic comment (e.g. pdflatex) overrides recipe

To use the recipe instead set the following in settings.json:

"latex-workshop.latex.build.forceRecipeUsage": true

The latexmk recipe fails to build the bibliography

  • Problem: When using the latexmk recipe, the build fails with the following message in the log (but there are no explicit errors in the Problems panel):

    bibtex: Not writing to /my/document.blg (openout_any = p).
    I couldn't open file name `/my/document.blg'

    Meanwhile, building the document from the command line with latexmk -pdf documentx.tex works.

  • Solution: Edit the TeX Live configuration file as suggested:

    sudo vim /usr/share/texlive/texmf-dist/web2c/texmf.cnf

    Change

    openout_any = p

    to

    openout_any = a

Troubleshooting

Cannot run Python files

Problem:

  • Running the file using the play button stalls
  • Using the "Run python file in terminal" command results in error "The active file is not a Python source file"

Solution: Go to Settings (Ctrl+,), and check whether the terminal is configured correctly. For me, the problem was caused by the "terminal.integrated.inheritEnv": false setting. Interestingly, this setting if offered by the Python extension.

According to Stack Overflow, the terminal.integrated.shell.* properties are also worth checking out.

Settings

Set terminal font

Go to Settings (Ctrl+,), and set the Terminal | Integrated: Font Family key to e.g. Inconsolata-dz for Powerline. Alternatively, add the following entry to the settings.json file:

"terminal.integrated.fontFamily": "Inconsolata-dz for Powerline"

The text moves left and right while typing

When word wrap (default: Alt + Z) is activated and typing, the horizontal scrolling moves a bit left and right. To fix this, the relevant Stack Overflow page has two answers:

  • one: the problem might be caused by GitLens, set the gitlens.currentLine.scrollable setting to false.
  • two: set the editor.scrollBeyondLastColumn value to 0 (the default value is 5).
Clone this wiki locally