For my notes. I thought I wouldn't see a site that summarizes TeX in Sublime, so I thought I decided to write about the environment I set up (friend J's Maru Pakuri).
Here's a set of setup steps to make LaTeX and R (a little Python) easier to use with SublimeText3. Be sure to restart Sublime accordingly.
TeXLive 2019 Install TeX Live by referring to TeX Live --TeX Wiki. For Windows, download the installer by referring to TeX Live / Windows --TeX Wiki. The author refers to ** For network installers ** in Installing TeX Live over the Internet. I installed TeXLive 2019 using ʻinstall-tl-windows.exe`.
To confirm that the installation was successful, press Windows key + R
and enter cmd
to start the command prompt. When you type latexmk
on the command line, the installation is successful if you get the following response:
C:\Users\(User name)>latexmk
Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Latexmk: No file name specified, and I couldn't find any
Use
latexmk -help
to get usage information
C:\texlive\2019\bin\win32\runscript.tlu:907: command failed with exit code 10:
perl.exe c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl
Sublime Text 3
Download from DOWNLOAD FOR WINDOWS
on the official website [Sublime Text 3](http://www.sublimetext.com/" Sublime Text 3 "),
Install from Sublime Text Build 3211 x64 Setup.exe
.
SumatraPDF
Refer to Download SumatraPDF on the TeX Wiki.
Official HP SumatraPDF
ʻInstaller: Download the installer from SumatraPDF-3.1.2-64-install.exeand Run
Sublime Text Build 3211 x64 Setup.exe` to install.
R-3.6.2
The Comprehensive R Archive Network(DownloadRforWindows->base)
Installer from Download R 3.6.2 for Windows
in [R-3.6.2 for Windows](https://cran.r-project.org/bin/windows/base/" R-3.6.2 for Windows ") Download and
Install from R-3.6.2-win.exe
.
First of all, open Sublime Text and press Ctrl + Shift + P
to open Command Palette,
Enter and confirm ʻinstall Package installer` and Palette.
This completes the installation of ** Package Control **.
Next, install the following three packages.
LaTeXTools
Press Ctrl + Shift + P
as you did in ** Package Control ** to open the Command Palette.
Then enter Package Control: Install Package
and Palette to confirm.
Enter LaTeXTools
in the Palette that appears, and if you decide, ** LaTeX Tools ** will be installed.
(A message will be displayed on Sublime Text when the installation is complete.)
Next, set ** LaTeX Tools **. The menu in the upper column of Sublime Text,
From the second [Preferences]
from the right
[Preferences]-> [Package Settings] -> [LaTeXTools] -> [Settings-User]
And select.
If \ Sublime Text 3 \ Packages \ User \ LaTeXTools.sublime-settings
does not exist,
You do not currently have a personalized
LaTeXTools.sublime-setting file.
Create a copy of the default settings file in your
User directory?
A message like the one above will be displayed. Click [OK]
.
For LaTeXTools.sublime-settings
displayed on Sublime Text, press Ctrl + F
and press
Enter builder_settings
in the search field that appears and find" builder_settings "in (line 398).
And
From (line 398)" builder_settings "
Add the following content between (line 406) // General settings:
.
\User\LaTeXTools.sublime-settings
398 "builder_settings" : {
"command" : ["latexmk", "-cd",
"-e", "$latex = 'uplatex %O -no-guess-input-enc -kanji=utf8 -interaction=nonstopmode -synctex=1 %S'",
"-e", "$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %B'",
"-e", "$bibtex = 'upbibtex %O %B'",
"-e", "$makeindex = 'upmendex %O -o %D %S'",
"-e", "$dvipdf = 'dvipdfmx %O -o %D %S'",
"-f", "-%E", "-norc", "-gg", "-pdfdvi"],
406 // General settings:
After adding the above contents, save with Ctrl + S
.
Check if LaTeX can be compiled. Of the following contents
After creating text.tex
on Sublime Text, press Ctrl + B
.
The first time you will be asked how to Build, so select Build With LaTeX --Traditional
.
You can also select the build method from [Tool]-> [Build With ...]
.
After the operation of Building (the operation status is displayed in the bar at the bottom of the screen) is completed, SumatraPDF is automatically started, and if the contents are displayed normally, the confirmation is completed.
test.tex
\documentclass[a4j]{ujarticle}
\title{ {\LaTeX}test file}
\author{Hoge-Yama-Fuga}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
Hell
\subsection*{in conclusion}
World
\end{document}
! !! !! Caution! !! !! ** ** Not \ documentclass [a4j] { jarticle } Use \ documentclass [a4j] { u </ font> jarticle **}!
If the document class is ** jarticle **, it doesn't seem to compile normally ... If you know the reason, please give me some advice.
** Addendum (2020/04/30) ** A friend told me that the above corrections are okay.
It seems to be the most complicated part of this article.
If you double-click a sentence on ** SumatraPDF ** by passing it through an environment variable, You will be able to open the source code of the relevant part with ** Sublime Text **.
Press Windows key + R
and type control
to open the control panel.
From the list displayed by entering environment variable
in the search field on the upper right
Select [System-Edit System Variables]-> Environment Variables
.
Select [Path] from the [System Variables (S)] list, and double-click or press [Edit (I)].
Add the following Path from [Edit Environment Variable Name]-> [New (N)]
.
C:\Program Files\Sublime Text 3\
Launch ** SumatraPDF **, click the list in the upper left and select [Settings]-> [Options]
.
Set the reverse search command line settings as follows.
sublime_text %f:%l
This completes ** setting environment variables **.
To confirm, open test.tex
with ** SumatraPDf ** and open
Then double-click the [1 Introduction] part in the sentence above ** SumatraPDF **,
If you can open (line 10) \ section {Introduction}
in ** Sublime Text **, you are successful.
**! !! !! Caution! !! !! ** ** Do not put a ** space in the folder name where the
.tex
file is located! !! ** ** Example You can see it by checking the above withtest.tex
placed in thehoge fuga
folder.
R-Box
Similar to the ** LaTeXTool ** procedure
Install ** R-Box ** from Package Control: Install Package
.
There is no need to set anything for ** R-Box **.
SendCode
Similar to the ** LaTeXTool ** procedure
Install ** Send Code ** from Package Control: Install Package
.
Set ** SendCode **. This is also the same as the procedure of ** LaTeX Tool ** setting.
Select [Preferences]-> [Package Settings]-> [SendCode]-> [Settings]
.
After that, the settings will be displayed, so enter the following contents on the right side of the setting field.
\User\SendCode.sublime-settings
{
"prog": "r",
"r": {
"prog": "r"
},
}
By adding the above contents, you can send the ** R ** code written on Sublime Text to ** RGui ** with Ctrl + Enter
.
However, please note that it is necessary to start ** RGui ** in advance.
Check if it works properly.
R.r
curve(dnorm(x) , -5, 5)
If you press Ctrl + Enter
with this line entered, it will be sent to ** RGui **.
If the graph of the normal distribution appears on ** RGui **, it is successful.
Indentation is responsible for distinguishing blocks in Python code.
There are mainly half-width space 4 and Tab, half-width space 2
styles. (Although I rarely see two spaces)
In Sublime Text's Python syntax settings, if you set Tab = space for 4
,
Don't confuse the tab
with the space 4
code.
(Because it is not recommended to be confused)
First of all, open the .py
file with Sublime Text because anything is fine.
(It's okay if you make a notepad and open the one with the extension changed to .py
)
After that, set in the same way as ** LaTeXTool ** etc.
Select [Preferences]-> [Settings-Syntax Specific]
.
After that, the settings will be displayed, so enter the following contents on the right side of the setting field.
\User\Python.sublime-settings
// These settings override both User and Default settings for the Python syntax
{
"tab_size": 4,
"translate_tabs_to_spaces": true
}
Press Tab
, and if four half-width spaces
are output, the setting is complete.
LaTeX
--You can build with Ctrl + B
.
-By double-clicking a sentence on ** SumatraPDF **, you can open the source code of that part with
** Sublime Text **.
R
-After starting ** RGui **, in ** Sublime Text **, you can send and execute the code by pressing
Ctrl + Enter
.
Python
--You can output half-width space 4
by pressing Tab
.
This completes the basic environment configuration, Here are some other packages that you might find useful.
Japanize It translates Sublime Text into Japanese. I thought that it would be a problem if the detailed settings were in English, so I added it.
ConvertToUTF8 It is a (likely) Package that solves problems related to character codes. If UTF-8 is used as the standard, I think there is nothing wrong with including it.
Alignment It's a very convenient Package.
For example, for the following code.
sample.c
int x = 0;
double y = 1;
int z = 10;
By selecting the full range of this code and typing Ctrl + Alt + A
sample.c
int x = 0;
double y = 1;
int z = 10;
It adjusts the indent based on =
. ** Alignment ** settings Settings-User
Settings-User
{
"alignment_space_chars": ["=","-"],
}
By setting as above, -
will also be adjusted to the standard,
It will be convenient to use ** R **.
Also, set the ** Alignment ** setting Key Bindings-User
You can change the command by setting it.
(I'm changing to Ctrl + Shift + A
.)
-Build UTF-8 LaTeX environment with SublimeText3 (Windows) --Qiita
-Build a Python development environment with Sublime Text 3 on Windows --narito blog
-LaTeX's "bad default" trends and countermeasures --Qiita
-I tried Sublime Text 3 (for compiling Tex) --Himaneko Attorinkusu
Recommended Posts