lbt 0.5 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +97 -0
- data/Tutorial.en.md +134 -0
- data/Tutorial.ja.md +128 -0
- data/images/gecko.png +0 -0
- data/images/lagoon.jpg +0 -0
- data/lib/lbt/create.rb +8 -3
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9da52e531926f42a9bb93585b0d04ff1a74f2de4db2f816793cdfa0812de12d
|
4
|
+
data.tar.gz: 67fe9f7f808e207a832dad8c6561eef93cd46110be4d92123884845cee2772e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b35e5b8d74c99d3e13d202e476a3b38a56b57bf3cd33836c3be01e8cff37380f4ddd2eabe06bf51eb31e551fd9c1efc352d847ebc037eb6213945cd69e4bb04
|
7
|
+
data.tar.gz: f07ce4110e54c2a5fb2490a35a8af103e508db5469cd616225ec53e82f7d38103682b9294726be0220346c7e336d92391426ed8450a1bbd21e7b0ba6c588a4e2
|
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
日本語の説明はこのファイルの後半にあります。
|
2
|
+
|
3
|
+
# LaTeX Build Tools
|
4
|
+
|
5
|
+
LaTeX Build Tools is a tool to maintain big LaTeX source files.
|
6
|
+
This version is different from the old versions as follows.
|
7
|
+
|
8
|
+
- Use `lbt` command to run every sub commands.
|
9
|
+
- It is provided as a gem.
|
10
|
+
|
11
|
+
The old versions, the one with rake and the other of bash scripts, are moved to the other branches, `rake_version` and `bash` respectively.
|
12
|
+
|
13
|
+
LaTeX Build Tools supports `lualatex` engine only.
|
14
|
+
If you want to use another engine, you need to modify `lib/lbt/build.rb` and `lib/lbt/part_typeset.rb`.
|
15
|
+
|
16
|
+
## Prerequisite
|
17
|
+
|
18
|
+
- Linux operating system
|
19
|
+
- Ruby. You can install it by one of the followings.
|
20
|
+
- Install the distribution package
|
21
|
+
- Install it with rbenv. Refer to [Rbenv's GitHub repository](https://github.com/rbenv/rbenv)
|
22
|
+
- LuaLaTeX. You can install it by one of the followings.
|
23
|
+
- Install the distribution package
|
24
|
+
- Install TexLive. Refer to [TexLive website](https://tug.org/texlive/)
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
You can install `lbt` from RubyGems.org with gem command.
|
29
|
+
|
30
|
+
```
|
31
|
+
$ gem install lbt
|
32
|
+
```
|
33
|
+
|
34
|
+
If you want to install it from the source code, do the following.
|
35
|
+
|
36
|
+
1. Click the `Code` button, then click `Download ZIP` in the small dialog.
|
37
|
+
2. Unzip the downloaded Zip file, then a new directory `LaTeX-BuildTools-master` will be created.
|
38
|
+
3. Type `gem build lbt` under the directory, then the gem file `lbt-X.X.X.gem` is created.
|
39
|
+
The number `X.X.X` is the version number like `0.5.2`.
|
40
|
+
1. Type `gem install lbt-X.X.X.gem`.
|
41
|
+
|
42
|
+
## Document
|
43
|
+
|
44
|
+
See [Tutorial](Tutorial.md).
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
GPL. See [License.md](License.md).
|
49
|
+
|
50
|
+
----------
|
51
|
+
|
52
|
+
# LaTeX Build Tools
|
53
|
+
|
54
|
+
LaTeX Build Toolsは大きなLaTeXソースファイルを管理するためのツールである。
|
55
|
+
現在の版は次の2点が旧版と異なっている。
|
56
|
+
|
57
|
+
- lbtというコマンドからすべてを起動
|
58
|
+
- gemとして提供される
|
59
|
+
|
60
|
+
旧版の、rakeを用いる版とbashスクリプト版は、それぞれ`rake_version`ブランチと`bash`ブランチに移動した。
|
61
|
+
|
62
|
+
LaTeX Build ToolsがサポートするLaTeXエンジンはlualatexである。
|
63
|
+
その他のエンジンを使いたい場合は`lib/lbt/build.rb`と`lib/lbt/part_typeset.rb`の修正が必要である。
|
64
|
+
|
65
|
+
## 動作条件
|
66
|
+
|
67
|
+
- Linux オペレーティング・システム
|
68
|
+
- Ruby。Rubyのインストール方法は次の2通りがある
|
69
|
+
- ディストリビューションのパッケージをインストール
|
70
|
+
- Rbenvを用いてインストール。詳しくは[RbenvのGitHubレポジトリ](https://github.com/rbenv/rbenv)を参照してほしい
|
71
|
+
- LuaLaTeX。LuaLaTeXのインストール方法は次の2通りがある
|
72
|
+
- ディストリビューションのパッケージをインストール
|
73
|
+
- TexLiveをインストール。詳しくは[TexLiveのウェブサイト](https://tug.org/texlive/)を参照してほしい
|
74
|
+
|
75
|
+
## インストール
|
76
|
+
|
77
|
+
gemコマンドでRubyGems.orgから`lbt`をインストールする。
|
78
|
+
|
79
|
+
```
|
80
|
+
$ gem install lbt
|
81
|
+
```
|
82
|
+
|
83
|
+
以上が最も簡単なインストール方法だが、ソースコードからインストールしたい場合は次のようにする。
|
84
|
+
|
85
|
+
1. GitHubのレポジトリを開き`Code`ボタンをクリック。小さいダイアログが現れるので、`Download ZIP`をクリックする
|
86
|
+
2. ZIPファイルを解凍すると`LaTeX-BuildTools-master`というディレクトリが作られる
|
87
|
+
3. 端末をそのディレクトリに移動して`gem build lbt`とタイプすると、`lbt-X.X.X.gem`というGemファイルが作られる。
|
88
|
+
この中の`X.X.X`はバージョン番号で、例えば`0.5.2`などのようなものである
|
89
|
+
4. `gem install lbt-X.X.X.gem`とタイプしてインストールする
|
90
|
+
|
91
|
+
## ドキュメント
|
92
|
+
|
93
|
+
[チュートリアル](Tutorial.ja.md)を参照してほしい。
|
94
|
+
|
95
|
+
## ライセンス
|
96
|
+
|
97
|
+
GPL。[License.md](License.md)を参照。
|
data/Tutorial.en.md
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# Installation
|
2
|
+
|
3
|
+
The followings are required for LaTex-Buildtools.
|
4
|
+
|
5
|
+
- Ruby
|
6
|
+
- LualaTeX
|
7
|
+
- Lbt (lbt is Latex-Buildtools)
|
8
|
+
|
9
|
+
The first two items can be installed from the distribution package.
|
10
|
+
For example, You can use the `apt` command in Ubuntu.
|
11
|
+
|
12
|
+
Lbt is provided as a Ruby Gem.
|
13
|
+
It can be installed with the `gem` command from RubyGems.org.
|
14
|
+
|
15
|
+
```
|
16
|
+
$ gem install lbt
|
17
|
+
```
|
18
|
+
|
19
|
+
# Creating a directory and templates for source files
|
20
|
+
|
21
|
+
The rest of this tutorial shows how to use `lbt` with an example.
|
22
|
+
Its source file is this tutorial.
|
23
|
+
|
24
|
+
First, use a `new` subcommand to create a directory and templates for source files.
|
25
|
+
The `new` subcommand takes the directory name, document class name, and working directory name as arguments.
|
26
|
+
The last two arguments can be left out.
|
27
|
+
Their default values are `book` and `_build` respectively.
|
28
|
+
In this example, we use `article` document class.
|
29
|
+
|
30
|
+
```
|
31
|
+
$ lbt new Tutorial article
|
32
|
+
$ cd Tutorial
|
33
|
+
$ ls -a
|
34
|
+
. .. .config helper.tex main.tex
|
35
|
+
```
|
36
|
+
|
37
|
+
The working directory name is written in the `.config` file.
|
38
|
+
|
39
|
+
```
|
40
|
+
$ cat .config
|
41
|
+
build_dir = _build
|
42
|
+
```
|
43
|
+
|
44
|
+
Since the working directory name was left out, it is `_build` (default value).
|
45
|
+
It is used when `build` and `part_typeset` subcommands are executed.
|
46
|
+
|
47
|
+
The file `main.tex` is the route file of LaTeX sources.
|
48
|
+
|
49
|
+
```
|
50
|
+
$ cat main.tex
|
51
|
+
\documentclass{article}
|
52
|
+
\input{helper.tex}
|
53
|
+
\title{Title}
|
54
|
+
\author{Author}
|
55
|
+
\begin{document}
|
56
|
+
\maketitle
|
57
|
+
\tableofcontents
|
58
|
+
|
59
|
+
\end{document}
|
60
|
+
```
|
61
|
+
|
62
|
+
The title and the author need to rewrite.
|
63
|
+
They are changed to "Tutorial" and "Toshio Sekiya" respectively.
|
64
|
+
|
65
|
+
The file `helper.tex` is included into the preamble part of `main.tex`.
|
66
|
+
Its contents are mainly package including and command definitions.
|
67
|
+
|
68
|
+
```
|
69
|
+
$ cat helper.tex
|
70
|
+
\usepackage{amsmath,amssymb}
|
71
|
+
\usepackage[luatex]{graphicx}
|
72
|
+
\usepackage{tikz}
|
73
|
+
\usepackage[margin=2.4cm]{geometry}
|
74
|
+
\usepackage[colorlinks=true,linkcolor=black]{hyperref}
|
75
|
+
% If your source includes Markdown, you may need the following lines.
|
76
|
+
% It is because Pandoc generates some undefined commands.
|
77
|
+
% The Pandoc template file shows how to define them.
|
78
|
+
% You can see it by 'pandoc --print-default-template=latex'.
|
79
|
+
\providecommand{\tightlist}{%
|
80
|
+
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
81
|
+
```
|
82
|
+
|
83
|
+
Since we don't need `tikz` package in this example, it can be deleted.
|
84
|
+
But you can leave it if you want.
|
85
|
+
The last two lines are required when converting Markdown files to LaTeX files with Pandoc.
|
86
|
+
The source, which is this tutorial, is Markdown, so we will leave them.
|
87
|
+
|
88
|
+
# Creating sub files
|
89
|
+
|
90
|
+
This tutorial has six sections.
|
91
|
+
We divide it into six files sec1.md, sec2.md, ... and sec6.md
|
92
|
+
They are put under the top directory.
|
93
|
+
|
94
|
+
# Typesetting
|
95
|
+
|
96
|
+
Converting LaTeX source files into a PDF file is called typesetting.
|
97
|
+
You can typeset them with `build` subcommand of Lbt.
|
98
|
+
|
99
|
+
```
|
100
|
+
$ lbt build
|
101
|
+
```
|
102
|
+
|
103
|
+
There are many converting processes.
|
104
|
+
Finally a PDF file `Tutorial.pdf` is made in the top directory.
|
105
|
+
The name of the PDF file is the same as the title in the source file.
|
106
|
+
|
107
|
+
# Partial typesetting
|
108
|
+
|
109
|
+
The bigger are the LaTeX sources, the longer time the typesetting takes.
|
110
|
+
Even if your modification is in only one, `build` subcommand converts all the source files.
|
111
|
+
It takes long time.
|
112
|
+
The subcommand `part_typeset` provides one file typesetting.
|
113
|
+
So it is faster than `build` subcommand.
|
114
|
+
|
115
|
+
```
|
116
|
+
$ lbt part_typeset 1
|
117
|
+
```
|
118
|
+
|
119
|
+
The argument `1` means `sec1.md`.
|
120
|
+
If you want to type sec5.md, use 5 instead of 1.
|
121
|
+
|
122
|
+
For large documents with parts and chapters, for example, specify "1-2-4" for part1/chap2/sec4.tex.
|
123
|
+
|
124
|
+
The result is `_build/main.pdf`.
|
125
|
+
|
126
|
+
# Renumbering
|
127
|
+
|
128
|
+
Sometimes you may want to insert a section between sec1.md and sec2.md.
|
129
|
+
At that time, name it sec1.5.md.
|
130
|
+
If you want to renamed these (sec1.md, sec1.5.md and sec2.md) into consecutive number filenames (sec1.md, sec2.md, and sec3.md), use `renum` subcommand.
|
131
|
+
|
132
|
+
```
|
133
|
+
$ lbt renum
|
134
|
+
```
|
data/Tutorial.ja.md
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# インストール
|
2
|
+
|
3
|
+
Latex-Buildtoolsを使うには次の3つが必要です。
|
4
|
+
|
5
|
+
- Rubyのインストール
|
6
|
+
- LuaLaTeXのインストール
|
7
|
+
- Lbt(lbtはLatex-Buildtoolsのことです)のインストール
|
8
|
+
|
9
|
+
最初の2つはディストリビューションのパッケージをインストールするのが最も簡単です。
|
10
|
+
例えばUbuntuであればaptコマンドを使います。
|
11
|
+
|
12
|
+
LbtはRubyのgemとして提供されるので、gemコマンドでインストールします。
|
13
|
+
|
14
|
+
```
|
15
|
+
$ gem install lbt
|
16
|
+
```
|
17
|
+
|
18
|
+
# ソースファイル用ディレクトリとテンプレートの作成
|
19
|
+
|
20
|
+
ここでは、このチュートリアルをPDFファイルに変換することを通してLbtの使い方を示します。
|
21
|
+
|
22
|
+
最初にソースファイル用ディレクトリとテンプレートを作成するために、newサブコマンドを使います。
|
23
|
+
newサブコマンドには、ディレクトリ名、ドキュメントクラス名、作業ディレクトリ名を引数に与えますが、後ろの2つは省略できます。
|
24
|
+
省略した場合のデフォルト値はそれぞれbookと\_buildです。
|
25
|
+
ここではltjsarticleドキュメントクラスを使います。
|
26
|
+
|
27
|
+
```
|
28
|
+
$ lbt new Tutorial ltjsarticle
|
29
|
+
$ cd Tutorial
|
30
|
+
$ ls -a
|
31
|
+
. .. .config helper.tex main.tex
|
32
|
+
```
|
33
|
+
|
34
|
+
.configファイルには作業ディレクトリ名の定義が書かれています。
|
35
|
+
|
36
|
+
```
|
37
|
+
$ cat .config
|
38
|
+
build_dir = _build
|
39
|
+
```
|
40
|
+
|
41
|
+
newサブコマンドで作業ディレクトリ名を省略したので、デフォルト値の\_buildになっています。
|
42
|
+
これはbuildとpart\_typesetサブコマンド実行時に参照されます。
|
43
|
+
|
44
|
+
main.texはLaTeXソースのルートファイルです。
|
45
|
+
|
46
|
+
```
|
47
|
+
$ cat main.tex
|
48
|
+
\documentclass{ltjsarticle}
|
49
|
+
\input{helper.tex}
|
50
|
+
\title{Title}
|
51
|
+
\author{Author}
|
52
|
+
\begin{document}
|
53
|
+
\maketitle
|
54
|
+
\tableofcontents
|
55
|
+
|
56
|
+
\end{document}
|
57
|
+
```
|
58
|
+
|
59
|
+
タイトルと著者は書き換えが必要です。
|
60
|
+
タイトルを「チュートリアル」に、著者を「関谷 敏雄」に変更しておきます。
|
61
|
+
|
62
|
+
helper.texはプリアンブル部に取り込まれます。
|
63
|
+
主にパッケージの取り込みとコマンドの定義をします。
|
64
|
+
|
65
|
+
```
|
66
|
+
$ cat helper.tex
|
67
|
+
\usepackage{amsmath,amssymb}
|
68
|
+
\usepackage[luatex]{graphicx}
|
69
|
+
\usepackage{tikz}
|
70
|
+
\usepackage[margin=2.4cm]{geometry}
|
71
|
+
\usepackage[colorlinks=true,linkcolor=black]{hyperref}
|
72
|
+
% If your source includes Markdown, you may need the following lines.
|
73
|
+
% It is because Pandoc generates some undefined commands.
|
74
|
+
% The Pandoc template file shows how to define them.
|
75
|
+
% You can see it by 'pandoc --print-default-template=latex'.
|
76
|
+
\providecommand{\tightlist}{%
|
77
|
+
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
78
|
+
```
|
79
|
+
|
80
|
+
今回はtikzは必要ないので削除しても構いませんが、ここではそのままにしておきます。
|
81
|
+
最後の2行は、PandocでMarkdownファイルをLaTeXファイルに変換するときに必要です。
|
82
|
+
今回のソースはMarkdownなので、このまま残しておきます。
|
83
|
+
|
84
|
+
# 本文ファイルの作成
|
85
|
+
|
86
|
+
今回はこのファイル(Readme.ja.md)をセクションごとに別ファイルにしてトップディレクトリに配置します。
|
87
|
+
最初の節(インストール)をsec1.mdとし、以下sec2.md、sec3.md・・・とします。
|
88
|
+
このファイルからコピペしてそれぞれのファイルを作ってください。
|
89
|
+
|
90
|
+
# タイプセット
|
91
|
+
|
92
|
+
LaTeXのソースファイルからPDFファイルを作ることをタイプセットといいます。
|
93
|
+
タイプセットはbuildサブコマンドで実行できます。
|
94
|
+
|
95
|
+
```
|
96
|
+
$ lbt build
|
97
|
+
```
|
98
|
+
|
99
|
+
この実行によってトップディレクトリにPDFファイルが生成されます。
|
100
|
+
ファイル名にはタイトルが使われるので、「チュートリアル.pdf」となります。
|
101
|
+
|
102
|
+
# 部分タイプセット
|
103
|
+
|
104
|
+
LaTexのソースが大きくなると全体のタイプセットに時間がかかるようになります。
|
105
|
+
1つのファイルを書いていて、そのPDFの出来栄えを確かめたいときに全体をタイプセットするのは時間がかかりすぎます。
|
106
|
+
そのときは、該当のファイルのみをタイプセットすることができます。
|
107
|
+
|
108
|
+
```
|
109
|
+
$ lbt part_typeset 1
|
110
|
+
```
|
111
|
+
|
112
|
+
引数の1はsec1.mdのことです。
|
113
|
+
もしsec5.mdをタイプセットしたければ1の代わりに5を使ってください。
|
114
|
+
|
115
|
+
PartやChapterのある大きな文書では、例えばpart1/chap2/sec4.texに対して「1-2-4」と引数を指定してください。
|
116
|
+
|
117
|
+
コンパイル結果は`_build/main.pdf`に保存されます。
|
118
|
+
|
119
|
+
# リナンバー
|
120
|
+
|
121
|
+
ときにはsec1.mdとsec2.mdの間にセクションを挿入したいことがあるかもしれません。
|
122
|
+
そのときにはsec1.5.mdとしてください。
|
123
|
+
これらをsec1.md、sec1.5.md、sec2.mdからsec1.md、sec2.md、sec3.mdのように連続する正整数に直すことをリナンバーと呼ぶことにします。
|
124
|
+
renumサブコマンドを実行することでリナンバーできます。
|
125
|
+
|
126
|
+
```
|
127
|
+
$ lbt renum
|
128
|
+
```
|
data/images/gecko.png
ADDED
Binary file
|
data/images/lagoon.jpg
ADDED
Binary file
|
data/lib/lbt/create.rb
CHANGED
@@ -113,7 +113,7 @@ Parameters are:
|
|
113
113
|
File.write("#{dir}/helper.tex", helper_tex)
|
114
114
|
elsif document_class == "beamer"
|
115
115
|
main_tex = <<~EOS
|
116
|
-
\\documentclass[utf8,aspectratio=
|
116
|
+
\\documentclass[utf8,aspectratio=169]{beamer}
|
117
117
|
\\mode<presentation>
|
118
118
|
{
|
119
119
|
\\usetheme{Warsaw}
|
@@ -171,10 +171,14 @@ Parameters are:
|
|
171
171
|
\\usepackage{amsmath,amssymb}
|
172
172
|
\\usepackage{tikz}
|
173
173
|
\\usepackage[absolute,overlay]{textpos}
|
174
|
+
% 数式フォントを設定(これなしだとsansになる)
|
175
|
+
\\usefonttheme{professionalfonts}
|
174
176
|
EOS
|
175
177
|
sec1_tex = <<~EOS
|
176
178
|
% This is a sample latex file for the beamer documentclass.
|
177
|
-
\\
|
179
|
+
\\section{Section Title}
|
180
|
+
\\begin{frame}
|
181
|
+
\\frametitle{introduction}
|
178
182
|
About something
|
179
183
|
\\begin{itemize}
|
180
184
|
\\item item 1
|
@@ -188,9 +192,10 @@ Parameters are:
|
|
188
192
|
\\alert{alert message, which is red.}
|
189
193
|
\\end{frame}
|
190
194
|
% Show a photo that extends to the whole slide view.
|
195
|
+
% The aspect ratio is 16:9.
|
191
196
|
\\begin{frame}
|
192
197
|
\\begin{textblock*}{128mm}(0pt,0pt)
|
193
|
-
\\includegraphics[width=
|
198
|
+
\\includegraphics[width=160mm,height=90mm,keepaspectratio]{lagoon.jpg}
|
194
199
|
\\end{textblock*}
|
195
200
|
\\end{frame}
|
196
201
|
EOS
|
metadata
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lbt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshio Sekiya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Lbt is a build tool for LaTeX. It is useful for big documents.
|
14
14
|
email: lxboyjp@gmail.com
|
15
15
|
executables:
|
16
16
|
- lbt
|
17
17
|
extensions: []
|
18
|
-
extra_rdoc_files:
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.md
|
20
|
+
- Tutorial.en.md
|
21
|
+
- Tutorial.ja.md
|
19
22
|
files:
|
23
|
+
- README.md
|
24
|
+
- Tutorial.en.md
|
25
|
+
- Tutorial.ja.md
|
20
26
|
- bin/lbt
|
27
|
+
- images/gecko.png
|
28
|
+
- images/lagoon.jpg
|
21
29
|
- lib/lbt.rb
|
22
30
|
- lib/lbt/build.rb
|
23
31
|
- lib/lbt/create.rb
|
@@ -43,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
51
|
- !ruby/object:Gem::Version
|
44
52
|
version: '0'
|
45
53
|
requirements: []
|
46
|
-
rubygems_version: 3.4.
|
54
|
+
rubygems_version: 3.4.10
|
47
55
|
signing_key:
|
48
56
|
specification_version: 4
|
49
57
|
summary: LaTeX Build Tools
|