Latex Visual Studio Code

broken image


  1. Visual Studio Code Vs Visual Studio
  2. Latex Visual Studio Code Generator
  3. Visual Studio Code Latex Compile

Visual Studio Code 编辑 LaTex 入门 (一) 刚装了电脑,这几天一直在整理资料还有倒腾软件。今天打开Word突然觉得它很难用,因为它经常出现格式混乱的情况。这时候脑海里浮出Latex,于是上知乎搜索了一下,发现了VS Code这个软件,第一眼就被软件的高颜值吸引了. One quite useful option is the Snippet Panel, which when clicked will open a tab on the right with symbols, which when selected will add in the relevant LaTeX code at your cursor in the document. It's mostly maths symbols, but also Greek letters and some latin symbols. Click on the symbol you want and the code.

I posted an article about using Visual Studio Code with LaTeX earlier this year and I wanted to do a follow-up with some of the additional extensions that I have been utilizing since then, as well as some of the extra configuration items that I have been using as I have made this environment my primary LaTeX editor.

All of the extensions that I have added can be found within Visual Studio Code. I have also linked the locations at the end of this post since there is additional information located at those sites.

Search results for 'LaTeX', Visual Studio Code on marketplace.visualstudio.com. In this question, the setup of LaTeX in VS Code is explained in one of the answers. I followed the instructions, and am indeed able to compile a LaTeX document in VS Code, with the PDF output as expected in the same folder. However, the preview of the PDF is not working. (Update: it is working, but does not update if the file is compiled again.).

Latex

Extensions

There are a few extensions that I use in addition to the LaTeX Workshop extension in order to make writing complex documents easier to do within Visual Studio Code.

Bookmarks

The Bookmarks extension does exactly what is sounds like, it gives you the ability to easily add bookmarks within your documents that are easy to search through. I have used this extension long before I used it with LaTeX, and it is very handy to have in VS Code.

This extension makes it very easy to find your place (or places) within large and complex LaTeX documents by adding an additional section in the Visual Studio Code sidebar and adds a quick shortcut (CTRL+ALT+K) to add the bookmarks.

Code Spell Checker

The Code Spell Checker extension is a very basic spell checker extension which isn't the greatest around, but allows you to quickly catch obvious spelling errors in your LaTeX documents. It also supports the ability to whitelist words and make exceptions as needed.

Jira and Bitbucket (Official)

I have been using Atlassian products since late 2009 and for many reasons I favour Bitbucket over GitHub. At the end of the day it is all Git, so the hosting provider makes no real difference to me, I only like Bitbucket because it integrates with all of the other Atlassian products that I also use alongside it. Atlassian provides an official plugin for Bitbucket in the Jira and Bitbucket (Official) extension, which provides excellent integration with Visual Studio Code. It works even better when you also use the Sourcetree application from Atlassian. If you don't use Jira you can disable that functionality if you want.

The extension allows the ability to view changes and make commits to Bitbucket directly from VS Code.

latex-count

The latex-count extension is a basic extension that is able to get a more accurate word count within your LaTeX documents. It does this by ignoring all of the LaTeX markup and comments within a LaTeX document to give a mostly accurate word count. It shows the word count in the footer of the VS Code window.

Additional Configuration

There are a few additional configuration tasks that can be completed in order to further customize the LaTeX environment in Visual Studio Code.

Enjoy all the features of Visio Plan 1, plus additional integrations with Microsoft 365. Collaborate on diagrams with your choice of the web version of Visio or the always up-to-date Visio desktop app. Includes 2 GB of OneDrive for Business cloud storage. Office 365 visio install. Sign in to Office 365. In the row of app buttons across the top of the page, select Visio. If you don't see Visio on the app launcher, select All apps, and then select Visio. To start with a Visio for the web diagram, browse the Gallery to see diagrams and samples, and then select Create. Change language. Accessibility Privacy and Cookies Legal Trademarks © 2021 Microsoft Privacy and Cookies Legal Trademarks © 2021 Microsoft. Visio and Microsoft 365. Visio is an innovative solution that helps you visualize data-connected business process flows with a host of integrated features that bring the power of Microsoft 365 to Visio. Create, view, edit, and collaborate on Visio diagrams from inside Microsoft Teams. Visio Professional 2016 Visio Standard 2016 Visio Professional 2013 Office for business Office 365 Small Business Microsoft 365 admin Office.com. Visio isn't included in the Office suite, but is sold as a stand-alone application. If you don't have Visio you can buy or try it now. Buy or try Visio.

Customize the LaTeX Compiler

The recipe system that LaTeX Workshop uses for compiling your documents is very powerful and allows you a lot of control over the way documents are generated. This is the proper way to generate your documents, but if you don't want to go to the trouble of modifying the recipes there is a way to specify the compiler within the LaTeX document.

For example, if you want to use XeLaTeX for your document you can just add this line at the top of the root document:

This method is not preferred, but it is available if you need it. For more information on this you can refer to the documentation at the LaTeX Workshop site:

Git Exceptions

If you use Git for your LaTeX document management there are a few extensions that you can add to your .gitignore file to keep them our of your repository. In my opinion these extensions don't need to be committed:

Remove Extra Files from VS Code Explorer

There are a few LaTeX and other files that you can exclude from the VS Code Explorer view if you don't want to see them while you are working on your project. The files.exclude setting can be used to remove extra LaTeX documents from the file manager to make it easier to filter through entries. Jang minho. If you use Git you can also remove extra files and folders as well.

If you open your Workspace Settings and search for files.exclude, there are a few entries that you can add (add additional ones if you feel you don't need to see them):

The files and folders that I always exclude are:

Default PDF Viewer

You can customize the way that the PDF file that is generated is displayed when you compile your LaTeX documents. The setting can be found in the LaTeX Workshop Settings under the Latex-workshop > View > Pdf: Viewer option. There are a few options available:

  • none – You will be prompted to select where to display the PDF file every time you try to view it.
  • browser – Opens the PDF in the default web browser.
  • tab – Shows the PDF in a side-by-side tab in the VS Code window.
  • external – Runs a custom command to view the PDF file.

Backing Up and Synchronizing VS Code Extensions

I am certain that this is probably not the best way to do this, but it works well for me so do this at your own risk. If you are like me and use OneDrive to synchronize and backup your files between multiple computers, you may want your VS Code environment to be the same between those devices. You can synchronize VS Code settings by moving the .vscode directory in the root of your user profile to your OneDrive folder so that it is automatically backed up and synchronized. There is an extension called CodeSync that is supposed to do this for you automatically, but I haven't had much luck with it.

I have found that the easiest method to accomplish this is to just use the symbolic link feature within Windows to move the folder elsewhere. This method doesn't require any changes to the VS Code settings or anything else. There are other ways to do this, one method being the –extensions-folder option in the VS Code executable, but I find the symbolic link feature to be much easier.

To add a symbolic link, move the .vscode directory to a directory in your OneDrive folder (rename it if you want to) and run a command like this to create the link (update the paths for your computer obviously):

If the command runs correctly you should see this output:

Once this has been completed you should have the same extensions between multiple computers.

Links

  • Bookmarks: https://github.com/alefragnani/vscode-bookmarks
  • Code Spell Checker: https://github.com/streetsidesoftware/vscode-spell-checker
  • Jira and Bitbucket (Official): https://bitbucket.org/atlassianlabs/atlascode/src/main
  • Sourcetree: https://www.sourcetreeapp.com
  • LaTeX Project: https://www.latex-project.org
  • Visual Studio Code: https://code.visualstudio.com
  • LaTeX Workshop: https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop
  • LaTeX Workshop Wiki: https://github.com/James-Yu/LaTeX-Workshop/wiki
  • LaTeX Utilities: https://marketplace.visualstudio.com/items?itemName=tecosaur.latex-utilities

LaTeX Workshop is an extension for Visual Studio Code, aiming to provide core features for LaTeX typesetting with Visual Studio Code.

This project won't be successful without contributions from the community, especially from the current and past key contributors:

  • Jerome Lelong @jlelong
  • Takashi Tamura @tamuratak
  • Tecosaur @tecosaur
  • James Booth @jabooth

Thank you so much!

Note that the latest version of LaTeX-Workshop requires at least VSCode 1.50.0.

Manual

The manual of the extension is maintained as a wiki

Table of Contents

  • Installation and basic settings
    • Usage
  • Compiling
  • Viewing & SyncTeX
    • Internal PDF viewer
    • External PDF viewer
  • Formatting
  • Intellisense
  • Snippets and shortcuts
  • Hovering and previewing features
  • Playing with environments
  • Extra features

Features (Taster)

Visual Studio Code Vs Visual Studio

This is not a complete list but rather a preview of some of the coolest features.

  • Build LaTeX (including BibTeX) to PDF automatically on save.

  • View PDF on-the-fly (in VS Code or browser).

  • Direct and reverse SyncTeX. Click to jump between location in .tex source and PDF and vice versa.

  • Intellisense, including completions for bibliography keys (cite{}) and labels (ref{}).

  • LaTeX log parser, with errors and warnings in LaTeX build automatically reported in VS Code.

    • Linting
    • A lot of LaTeX commands can be typed using snippets starting in , then type part of the command to narrow the search.

    • Surround some selected text with a LaTeX command using ctrl+l, ctrl+w (⌘+l, ⌘+w on Mac). A new menu pops up to select the command. This works with multi selections. The former approach using has been deprecated.

    • We also provide a few other snippets mechanisms

      • Greek letters are obtained as @ + letter. Some letters have variants, which are available as @v + letter. See here.

      • Common environments can be obtained by BXY where XY are the first two letters of the environment name, eg. BEQ gives the equation environment. If you want the star version of the environment, use BSXX, eg. BSEQ gives the equation* environment. See here.

      • Common font commands can be obtained by FXY where XY are the last two letters of the font command name, eg. FIT gives textit{}. See here.

      • Many other maths symbols can be obtained with the @ prefix. See here.

    • In addition to snippets, there are shortcuts provided by the extension that allow you to easily format text (and one or two other things).

  • When the current line starts with item or item[], hitting Enter automatically adds a newline starting in the same way. For a better handling of the last item, hitting Enter on a line only containing item or item[] actually deletes the content of the line. The alt+Enter is bind to the standard newline command. This automatic insertion of item can be deactivated by setting latex-workshop.bind.enter.key to false.

  • Preview on hover. Hovering over the start tag of a math environment causes a mathjax preview to pop up.

GitHub

The code for this extension is available on github at: https://github.com/James-Yu/LaTeX-Workshop

Like this work?

Latex Visual Studio Code Generator

  • :smile: Star this project on GitHub and Visual Studio Marketplace
  • :blush: Leave a comment
  • :relaxed: Spare me some coffee via Paypal

Visual Studio Code Latex Compile

License





broken image