Skip to content

Commit f2ff6d7

Browse files
committed
Added vscode devcontainer
1 parent 18a5cbd commit f2ff6d7

File tree

3 files changed

+56
-52
lines changed

3 files changed

+56
-52
lines changed

.devcontainer/devcontainer.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "TeX Live",
3+
"image": "soulmachine/texlive:latest",
4+
"extensions": [
5+
"James-Yu.latex-workshop"
6+
]
7+
}

.vscode/tasks.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "lettcode-C++",
6+
"type": "shell",
7+
"command": "xelatex",
8+
"args": [
9+
"-synctex=1",
10+
"-interaction=nonstopmode",
11+
"leetcode-cpp.tex"
12+
],
13+
"options": {
14+
"cwd": "${workspaceFolder}/C++/"
15+
}
16+
},
17+
{
18+
"label": "lettcode-Java",
19+
"type": "shell",
20+
"command": "xelatex",
21+
"args": [
22+
"-synctex=1",
23+
"-interaction=nonstopmode",
24+
"leetcode-java.tex"
25+
],
26+
"options": {
27+
"cwd": "${workspaceFolder}/Java/"
28+
}
29+
}
30+
]
31+
}

README.md

+18-52
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,39 @@
1-
#LeetCode题解
2-
-----------------
1+
# LeetCode题解
2+
33
## 在线阅读
4-
<https://www.gitbook.com/book/soulmachine/algorithm-essentials/>
54

6-
##PDF下载
5+
<https://algorithm-essentials.soulmachine.me/>
6+
7+
## PDF下载
8+
79
<a href="https://github.com/soulmachine/leetcode/raw/master/C%2B%2B/leetcode-cpp.pdf">LeetCode题解(C++版).pdf</a>
810

911
C++ 文件夹下是C++版,内容一模一样,代码是用C++写的。
1012

1113
Java 文件夹下是Java版,目前正在编写中,由于拖延症,不知道猴年马月能完成。
1214

13-
##LaTeX模板
14-
本书使用的是陈硕开源的[模板](https://github.com/chenshuo/typeset)。这个模板制作精良,很有taste,感谢陈硕 :)
15-
16-
##在Windows下编译
17-
1. 安装Tex Live 2015 <http://www.tug.org/texlive/>。把bin目录例如`D:\texlive\2015\bin\win32`加入PATH环境变量。
18-
1. 安装字体。这个LaTex模板总共使用了10个字体,下载地址 <https://pan.baidu.com/s/1eRFJXnW> ,有的字体Windows自带了,有的字体Ubuntu自带了,但都不全,还是一次性安装完所有字体比较方便。
19-
1. 安装TeXstudio <http://texstudio.sourceforge.net/>
20-
1. (可选)启动Tex Live Manager,更新所有已安装的软件包。
21-
1. 配置TeXstudio。
22-
23-
启动Texstudio,选择 `Options-->Configure Texstudio-->Commands`,XeLaTex 设置为 `xelatex -synctex=1 -interaction=nonstopmode %.tex`
24-
25-
选择 `Options-->Configure Texstudio-->Build`
26-
27-
Build & View 由默认的 PDF Chain 改为 Compile & View;
28-
29-
Default Compiler 由默认的PdfLaTex 修改为 XeLaTex ;
30-
31-
PDF Viewer 改为 “Internal PDF Viewer(windowed)”,这样预览时会弹出一个独立的窗口,这样比较方便。
32-
33-
1. 编译。用TeXstudio打开`typeset.tex`,点击界面上的绿色箭头就可以开始编译了。
34-
35-
在下方的窗口可以看到TeXstudio正在使用的编译命令是`xelatex -synctex=1 -interaction=nonstopmode "typeset".tex`
36-
37-
##在Ubuntu下编译
38-
1. 安装Tex Live 2015 <http://www.tug.org/texlive/>
39-
40-
1.1. 下载TexLive 2015 的ISO 光盘,地址 <http://www.tug.org/texlive/acquire-iso.html>
41-
42-
1.2 mount 光盘,`sudo ./install-tl` 开始安装
43-
44-
1.3 加入环境变量
15+
## 如何编译
4516

46-
sudo vi /etc/profile
47-
export PATH=$PATH:/usr/local/texlive/2015/bin/x86_64-linux
48-
export MANPATH=$MANPATH:/usr/local/texlive/2015/texmf-dist/doc/man
49-
export INFPATH=$INFPATH:/usr/local/texlive/2015/texmf-dist/doc/info
17+
本项目已经配置好了devcontainer, 用 vscode 打开项目根目录,选择 `"Reopen in devcontainer"`,就会在容器中打开本项目,该容器安装了 Tex Live 2022 以及所需要的10个字体。
5018

51-
1. 安装字体。这个LaTex模板总共使用了10个字体,下载地址 <https://pan.baidu.com/s/1eRFJXnW> ,有的字体Windows自带了,有的字体Ubuntu自带了,但都不全,还是一次性安装完所有字体比较方便。
52-
1. 安装TeXstudio <http://texstudio.sourceforge.net/>
53-
1. 配置TeXstudio。
19+
点击vscode左下角的齿轮图标,选择 `Command Palette`,输入`tasks`, 选择 `Run Task`, 选择 `leetcode-C++`,即可启动编译。
5420

55-
启动Texstudio,选择 `Options-->Configure Texstudio-->Commands`,XeLaTex 设置为 `xelatex -synctex=1 -interaction=nonstopmode %.tex`
21+
你也可以直接使用命令行编译:
5622

57-
选择 `Options-->Configure Texstudio-->Build`
23+
```bash
24+
xelatex -synctex=1 -interaction=nonstopmode leetcode-cpp.tex
25+
```
5826

59-
Build & View 由默认的 PDF Chain 改为 Compile & View;
27+
## LaTeX模板
6028

61-
Default Compiler 由默认的PdfLaTex 修改为 XeLaTex ;
29+
本书使用的是陈硕开源的[模板](https://github.com/chenshuo/typeset)。这个模板制作精良,感谢陈硕 :)
6230

63-
PDF Viewer 改为 “Internal PDF Viewer(windowed)”,这样预览时会弹出一个独立的窗口,这样比较方便
31+
这个LaTex模板总共使用了10个字体,下载地址 <https://pan.baidu.com/s/1eRFJXnW> 。有的字体Windows自带了,有的字体Ubuntu自带了,但都不全,还是一次性安装完所有字体比较方便
6432

65-
1. 编译。用TeXstudio打开`typeset.tex`,点击界面上的绿色箭头就可以开始编译了
33+
也可以参考 [Dockerfile](https://github.com/soulmachine/docker-images/blob/master/texlive/Dockerfile) 去学习如何安装所有字体
6634

67-
在下方的窗口可以看到TeXstudio正在使用的编译命令是`xelatex -synctex=1 -interaction=nonstopmode "typeset".tex`
68-
1. 懒人版镜像。如果不想进行上面繁琐的安装过程,我做好了一个Ubuntu VMware虚拟机镜像,已经装好了 TexLive 2015, TexStudio和字体(详细的安装日志见压缩包注释),开箱即用,下载地址 <http://pan.baidu.com/s/1cLWkgA>
35+
## 如何贡献代码
6936

70-
##如何贡献代码
7137
编译通过后,就具备了完整的LaTeX编译环境了。
7238

7339
本书模板已经写好了,基本上不需要很多LaTeX知识就可以动手了。

0 commit comments

Comments
 (0)