Comfortable LaTeX with Windows Subsystem for Linux and VS Code

Overview

Build a comfortable LaTeX environment using Ubuntu of Windows Subsystem for Linux (WSL) and VS Code.

environment Windows 10

For those who are LaTeX

If you know, please proceed to the next. LaTeX is one of the document processing systems.

It seems to be troublesome to write while marking the text like HTML, but in reality it does ** paragraph processing and font setting ** arbitrarily, ** many in scientific papers and reports It has been adopted **, and unlike Word, it is ** text-based **, so even if you write a lot, the operation is light. After all, it's good to be able to ** easily write beautiful formulas **.

I recently learned in a college class, ** I wish I could use it sooner so I didn't have to struggle with Word to enter formulas! **I tought. If you are in science, it will be ** essential skills **.

For more information, click here [https://texwiki.texjp.org/%E3%81%AF%E3%81%98%E3%82%81%E3%81%A6%E3%81% Please take a look at AE% E6% 96% B9% E3% 81% B8).

Introduction of WSL

To use WSL, you need to enable WSL first. There are many articles in Quita, so please refer to them as appropriate. https://www.atmarkit.co.jp/ait/articles/1903/18/news031.html https://qiita.com/rubytomato@github/items/fdfc0a76e848442f374e

This time, I will assume that the contents of the above two articles have been completed. As a preparation, run the following in sequence on the Ubuntu command line:

Terminal


sudo apt install texlive-full
sudo cpan Log::Log4perl Log::Dispatch

Introducing VS Code

Please install VS Code on ** Windows side **. ** Please note that it is not on the WSL side. ** **

And as an extension With Remort-WSL Install LaTeX Workshop.

Please install LaTeX Workshop on WSL. (It's complicated) I wonder if it's okay if the install button is "Install on WSL".

From here on, I like it, I want to feel the operation of Vim, so Vim and Monokai with an easy-to-read color scheme. /items?itemName=monokai.theme-monokai-pro-vscode) is installed. This time it is not required, so please find out how to do it yourself.

LaTeX environment maintenance

From here is the production. Press Ctrl + Shift + P to launch the command palette and enter open setting, Basic settings: Open Settings (JSON) please choose. Since the json file is displayed,

settings.json


{
    //If from the beginning{}If anything is written in, from here ↓
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.latex.tools": [
        {
            "name": "platex",
            "command": "wsl.exe",
            "args": [
                "platex",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-kanji=utf8",
                "-guess-input-enc",
                "%DOCFILE%.tex"
            ]
        },
        {
            "name": "dvipdfmx",
            "command": "wsl.exe",
            "args": [
                "dvipdfmx",
                "-f",
                "yu-win10.map",
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "platex",
            "tools": [
                "platex",
                "platex",
                "dvipdfmx"
            ]
        }
    ],
    "editor.formatOnSave": true,
    //Copy up to here{}Add to
}

Then click the gear button at the bottom left, select "User Spenit" and select latex.

latex.json


{
	"report": {
		"prefix": "report",
		"body": [
			"\\documentclass[${1:a4paper,11pt}]{${2:jsarticle}}",
			"\\usepackage{amsmath,amsfonts}",
			"\\usepackage{bm}",
			"\\usepackage[dvipdfmx]{graphicx}",
			"${3}",
			"\\begin{document}",
			"",
			"\\title{${4}}",
			"\\author{${5}}",
			"\\date{${6:\\today}}",
			"\\maketitle",
			"",
			"$0",
			"",
			"\\end{document}"
		],
		"description": "set report template"
	},
	"Figure": {
		"prefix": "figure",
		"body": [
			"\\begin{figure}[${1:hbp}]",
			"\\centering",
			"\\includegraphics[${2:width=\\linewidth}]{$3 \\label{fig:$4}}",
			"\\caption{$5}",
			"\\end{figure}"
		],
		"description": "set figure"
	},
	"Table": {
		"prefix": "table",
		"body": [
			"\\begin{table}[${1:hbp}]",
			"\\centering",
			"\\caption{$2}",
			"\\label{tabl:$3}}",
			"\\begin{tabular}{$4}\\hline",
			"$5",
			"\\end{tabular}\\end{table}"
		],
		"description": "set table"
	},
}

Please change the content appropriately so that it is easy for you to use.

Now LaTeX

Now that we're ready, let's write it down.

Start Ubuntu and start with code. It's up to you to start VS Code and click> <on the far left to start it in WSL: New Window.

I will omit how to write the LaTeX source. (Because this time is the main environment maintenance ...) It's quite deep, so if you don't understand anything, please study carefully. When you save it, it will be automatically typeset and a PDF file will be created.

You don't even need a viewer like evince to see what you typeset. After all, you can start the viewer with Ctrl + Alt + V in VS Code and check it on the spot. (If you explain how to avoid using shortcut keys, you can see it by clicking the icon with a magnifying glass on the file icon in the upper right.)

Recommended Posts

Comfortable LaTeX with Windows Subsystem for Linux and VS Code
Python with VS Code (Windows 10)
pykintone on Windows Subsystem for Linux
Until Windows Subsystem for Linux (WSL) is installed in Windows and fish is installed
Windows Subsystem for Linux is not displayed
WSL2 (Windows Subsystem for Linux) installation procedure
How to install Windows Subsystem For Linux
Put MeCab binding for Python with pip on Windows, mac and Linux
Impressions and memorandums when working with VS code for the first time
Python (Windows 10) Virtual Environment / Package with VS Code
Introduce VS Code and Remote Development to an offline environment to make linux development comfortable
When Windows Subsystem for Linux (WSL) cannot be started
VS Code settings for developing in Python with completion
Enable intellisense for external libraries with Pipenv + VS Code
Debug Python with VS Code
The story that Python stopped working with VS Code (Windows 10)
Create a Python environment for professionals in VS Code on Windows
Get the strongest environment with VS Code, Remote-Containers and remote docker-daemon
About the procedure for linking Visual Studio Code for Windows and WSL
Check the memory protection of linux kerne with the code for ARM
Create a simple Python development environment with VS Code and Docker
How to build Python and Jupyter execution environment with VS Code
LaTeX and R (a little Python) environment construction with SublimeText3 (Windows)
Differences between Windows and Linux directories
(Windows10) Install Linux environment and gnuplot.
VS Code snippets for data analysts
Try running Jupyter with VS Code
Install python with mac vs code
Prepare a Python virtual environment for your project with venv with VS Code
Steps to create a Python virtual environment with VS Code on Windows
[UE4] Build DedicatedServer on Windows and Linux
Linux (for users and su / sudo commands)
Install wsl2 and master linux on windows
selenium: wait for element with AND / OR
Windows → linux Tips for bringing in data
(For myself) Put Flask in VS Code
Pass PYTHONPATH in 1 minute with VS Code
Display Japanese graphs with VS Code + matplotlib
Code for self-analysis and radar chart creation
VS Code Pylint is annoying with import! !! !! !!
Comfortable document life with Docutils and Ruby
Cross-compiling Raspberry Pi and building a remote debugging development environment with VS Code
Easy Python data analysis environment construction with Windows10 Pro x VS Code x Docker
Let's try analysis! Chapter 8: Analysis environment for Windows created with Python and Eclipse (PyDev)