hiki2latex 0.9.12 → 0.9.12.1
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/.yardopts +1 -3
- data/{README.en.md → README.md} +6 -4
- data/Rakefile +56 -28
- data/exe/#hiki2latex# +5 -0
- data/hiki2latex.gemspec +3 -0
- data/hiki2latex.wiki/AbstSample.pdf +0 -0
- data/hiki2latex.wiki/Math.png +0 -0
- data/hiki2latex.wiki/Report_head.png +0 -0
- data/hiki2latex.wiki/handout_sample.md +73 -0
- data/{docs/README.ja.md → hiki2latex.wiki/hiki2latex.md} +14 -16
- data/hiki2latex.wiki/hiki2latex_gemizing.md +221 -0
- data/hiki2latex.wiki/hiki2latex_init.md +97 -0
- data/hiki2latex.wiki/hiki2latex_listings.md +113 -0
- data/hiki2latex.wiki/hiki2latex_manual.md +31 -0
- data/hiki2latex.wiki/hiki2latex_math.md +147 -0
- data/hiki2latex.wiki/hiki2latex_table.md +103 -0
- data/hiki2latex.wiki/lpso_abst.pdf +0 -0
- data/hiki2latex.wiki/readme_en.md +60 -0
- data/{README.ja.md → hiki2latex.wiki/readme_ja.md} +46 -26
- data/hiki2latex.wiki/table.png +0 -0
- data/hikis/AbstSample.pdf +0 -0
- data/hikis/Math.png +0 -0
- data/hikis/Report_head.png +0 -0
- data/{docs/readme.ja.hiki → hikis/hiki2latex.hiki} +4 -6
- data/hikis/hiki2latex_gemizing.hiki +222 -0
- data/hikis/hiki2latex_init.hiki +95 -0
- data/hikis/hiki2latex_listings.hiki +113 -0
- data/hikis/hiki2latex_manual.hiki +32 -0
- data/hikis/hiki2latex_math.hiki +145 -0
- data/hikis/hiki2latex_table.hiki +102 -0
- data/hikis/lpso_abst.pdf +0 -0
- data/{docs/readme.hiki → hikis/readme_en.hiki} +2 -0
- data/hikis/readme_ja.hiki +133 -0
- data/hikis/table.png +0 -0
- data/latexes/AbstSample.pdf +0 -0
- data/latexes/Math.png +0 -0
- data/latexes/Report_head.png +0 -0
- data/latexes/head.tex +4 -0
- data/latexes/hiki2latex.aux +60 -0
- data/latexes/hiki2latex.log +307 -0
- data/latexes/hiki2latex.pdf +0 -0
- data/latexes/hiki2latex.synctex.gz +0 -0
- data/latexes/hiki2latex.tex +213 -0
- data/latexes/hiki2latex.toc +47 -0
- data/latexes/hiki2latex_gemizing.tex +212 -0
- data/latexes/hiki2latex_init.tex +103 -0
- data/latexes/hiki2latex_listings.tex +106 -0
- data/latexes/hiki2latex_manual.tex +38 -0
- data/latexes/hiki2latex_math.tex +151 -0
- data/latexes/hiki2latex_table.tex +108 -0
- data/latexes/lpso_abst.pdf +0 -0
- data/latexes/post.tex +17 -0
- data/latexes/table.png +0 -0
- data/lib/#hiki2latex.rb# +145 -0
- data/lib/hiki2latex/hiki2latex.rb +2 -1
- data/lib/hiki2latex/version.rb +1 -1
- data/lib/hiki2latex.rb +2 -2
- metadata +84 -13
- data/#Rakefile# +0 -42
- data/#hiki2latex.gemspec# +0 -42
- data/{docs/README.en.md → hiki2latex.wiki/readme.md} +4 -4
@@ -0,0 +1,113 @@
|
|
1
|
+
# 【概要】
|
2
|
+
latexのlistingsスタイルを使って,source codeの色付き表示が可能に.
|
3
|
+
|
4
|
+
# 【hiki2latexの変更】
|
5
|
+
hikidoc2texで使われているのを参照して,
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
def block_preformatted(str, info)
|
9
|
+
if (@listings==true and info!=nil) then
|
10
|
+
style='customRuby' if info=='ruby'
|
11
|
+
style='customCsh' if (info=='tcsh' or info=='csh')
|
12
|
+
style='customTeX' if info=='tex'
|
13
|
+
style='customJava' if info=='java'
|
14
|
+
preformatted_with_style(str,style)
|
15
|
+
else
|
16
|
+
preformatted(text(str))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def preformatted(str)
|
21
|
+
@f.slice!(-1)
|
22
|
+
@f << "\\begin{quote}\\begin{verbatim}\n"
|
23
|
+
@f << str+"\n"
|
24
|
+
@f << "\\end{verbatim}\\end{quote}\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
def preformatted_with_style(str,style)
|
28
|
+
@f.slice!(-1)
|
29
|
+
@f << "\\begin{lstlisting}[style=#{style}]\n"
|
30
|
+
@f << str+"\n"
|
31
|
+
@f << "\\end{lstlisting}\n"
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
opt周りは,
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
opt.on('--listings', 'use listings.sty for preformat with style.') {@listings=true }
|
39
|
+
```
|
40
|
+
としている.これをHikiDocへ渡す時は,
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
def plain_doc(file)
|
44
|
+
if @listings==true then
|
45
|
+
puts listings_preamble
|
46
|
+
elsif @pre==nil then
|
47
|
+
puts "\\documentclass[12pt,a4paper]{jsarticle}"
|
48
|
+
puts "\\usepackage[dvipdfmx]{graphicx}"
|
49
|
+
else
|
50
|
+
puts File.read(@pre)
|
51
|
+
end
|
52
|
+
puts "\\begin{document}"
|
53
|
+
puts File.read(@head) if @head!=nil
|
54
|
+
puts HikiDoc.to_latex(File.read(file),{:listings=>@listings})
|
55
|
+
puts File.read(@post) if @post!=nil
|
56
|
+
puts "\\end{document}"
|
57
|
+
end
|
58
|
+
```
|
59
|
+
後ろのoptions={}の中にhashで登録している.texのstyleはlisting_preambleで打ち出すようにしている.
|
60
|
+
|
61
|
+
listingsの設定は以下の通り.
|
62
|
+
|
63
|
+
```tex
|
64
|
+
\documentclass[10pt,a4paper]{jsarticle}
|
65
|
+
\usepackage[dvipdfmx]{graphicx}
|
66
|
+
\usepackage[dvipdfmx]{color}
|
67
|
+
\usepackage{listings}
|
68
|
+
% to use japanese correctly, install jlistings.
|
69
|
+
\lstset{
|
70
|
+
basicstyle={\small\ttfamily},
|
71
|
+
identifierstyle={\small},
|
72
|
+
commentstyle={\small\itshape\color{red}},
|
73
|
+
keywordstyle={\small\bfseries\color{cyan}},
|
74
|
+
ndkeywordstyle={\small},
|
75
|
+
stringstyle={\small\color{blue}},
|
76
|
+
frame={tb},
|
77
|
+
breaklines=true,
|
78
|
+
numbers=left,
|
79
|
+
numberstyle={\scriptsize},
|
80
|
+
stepnumber=1,
|
81
|
+
numbersep=1zw,
|
82
|
+
xrightmargin=0zw,
|
83
|
+
xleftmargin=3zw,
|
84
|
+
lineskip=-0.5ex
|
85
|
+
}
|
86
|
+
\lstdefinestyle{customCsh}{
|
87
|
+
language={csh},
|
88
|
+
numbers=none,
|
89
|
+
}
|
90
|
+
\lstdefinestyle{customRuby}{
|
91
|
+
language={ruby},
|
92
|
+
numbers=left,
|
93
|
+
}
|
94
|
+
\lstdefinestyle{customTex}{
|
95
|
+
language={tex},
|
96
|
+
numbers=none,
|
97
|
+
}
|
98
|
+
\lstdefinestyle{customJava}{
|
99
|
+
language={java},
|
100
|
+
numbers=left,
|
101
|
+
}
|
102
|
+
```
|
103
|
+
|
104
|
+
```
|
105
|
+
\begin{lstlisting}[style=customRuby]
|
106
|
+
def block_preformatted(str, info)
|
107
|
+
if (@listings==true and info!=nil) then
|
108
|
+
style='customRuby' if info=='ruby'
|
109
|
+
style='customCsh' if (info=='tcsh' or info=='csh')
|
110
|
+
style='customTeX' if info=='tex'
|
111
|
+
...
|
112
|
+
\end{lstlisting}
|
113
|
+
```
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# 【概要】
|
2
|
+
hikiで書いたのを中間発表の予稿集用に変換するマニュアル.
|
3
|
+
# 【下準備】
|
4
|
+
1. yahataProjectをinstall
|
5
|
+
1. rake initを実行.passwordを聞かれたときはdonkeyかnishitaniに知らせる
|
6
|
+
1. setenvでpathを設定
|
7
|
+
# 【手順】
|
8
|
+
1. hikiにGraduate_handout原稿を作成
|
9
|
+
1. 作業用のdirectoryを作成
|
10
|
+
1. そこで,hiki2abst.rb ~/Sites/hiki-1.0/data/text/Graduate_handout > Graduate_handout.tex
|
11
|
+
1. open Graduate_handout.tex
|
12
|
+
1. command-Tでpdfへ変換.
|
13
|
+
|
14
|
+
# 【graph作成手順】
|
15
|
+
## hiki
|
16
|
+
1. 適当なサイズに調整したファイルを添付ファイルとしてUpLoad
|
17
|
+
- ImageMagickがinstallされているとして,convert A.png -scale 50% B.png
|
18
|
+
## latex directory
|
19
|
+
1. hikiでファイルを選択してDownLoad
|
20
|
+
1. 作業用のlatex directoryへ移す.
|
21
|
+
1. ebb B.pngでB.bbを作成.
|
22
|
+
1. TeXShopでcompileすればいけるはず.
|
23
|
+
|
24
|
+
# 【TeXShopの設定】
|
25
|
+
## ファイルが文字化け
|
26
|
+
- 「設定」->書類->エンコーディング Unicode(UTF-8)
|
27
|
+
- 同じタグの「設定プロファイル」-> pTeX(ptex2pdf)を選択
|
28
|
+
- TeXShopを再起動
|
29
|
+
- compileすればいけるはず.
|
30
|
+
## compileうまくいかないとき.
|
31
|
+
- *.auxファイルを消去して,再compile.
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# 【概要】
|
2
|
+
dmath,math環境をequationに変換
|
3
|
+
# 【入力:hiki】
|
4
|
+
|
5
|
+
```
|
6
|
+
mathがうまくいくかどうかの検討用サンプルです.
|
7
|
+
さらにinlineで{{math 'x_i'}}なんかもできるといいのですが.
|
8
|
+
```
|
9
|
+
|
10
|
+
mathがうまくいくかどうかの検討用サンプルです.
|
11
|
+
さらにinlineで{{math 'x_i'}}なんかもできるといいのですが.
|
12
|
+
|
13
|
+
# 【出力:latex】
|
14
|
+
|
15
|
+
```
|
16
|
+
\begin{document}
|
17
|
+
mathがうまくいくかどうかの検討用サンプルです.
|
18
|
+
\begin{equation}
|
19
|
+
f_x
|
20
|
+
\end{equation}
|
21
|
+
さらにinlineで$x_i$なんかもできるといいのですが.
|
22
|
+
```
|
23
|
+
<dl>
|
24
|
+
<dt>注2016/02/20</dt><dd>このあたりでhiki, rubyを指定するとlistingsがうまく処理できない.preformatted\_without\_styleで対応.</dd>
|
25
|
+
</dl>
|
26
|
+
# 【コード解説】
|
27
|
+
## evaluate_plugin_block
|
28
|
+
すこしトリッキーだったので,メモです.
|
29
|
+
```ruby
|
30
|
+
def evaluate_plugin_block(str, buf = nil)
|
31
|
+
buf ||= @output.container
|
32
|
+
str.split(/(\0\d+\0)/).each do |s|
|
33
|
+
if s[0, 1] == "\0" and s[-1, 1] == "\0"
|
34
|
+
buf << @output.inline_plugin(plugin_block(s[1..-2].to_i))
|
35
|
+
else
|
36
|
+
buf << @output.text(s)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
buf
|
40
|
+
end
|
41
|
+
```
|
42
|
+
としてinline_pluginはblock_pluginと違った扱いになっています.bufに一度溜め込んでそれを@fに吐いているようです.
|
43
|
+
そこで,@output.inline_pluginで行き着く先が,LatexOutputの
|
44
|
+
```ruby
|
45
|
+
def inline_plugin(src)
|
46
|
+
tmp=[]
|
47
|
+
if ( /(\w+)\((.+)\)/ =~ src ) or ( /(\w+).\'(.+)\'/ =~src ) or (/(\w+)/ =~ src)
|
48
|
+
tmp = [$1,$2]
|
49
|
+
end
|
50
|
+
|
51
|
+
case tmp[0]
|
52
|
+
when 'dmath'
|
53
|
+
"\\begin{equation}\n#{tmp[1]}\n\\end{equation}"
|
54
|
+
when 'math'
|
55
|
+
"\$#{tmp[1]}\$"
|
56
|
+
else
|
57
|
+
%Q(<span class="plugin">{{#{src}}}</span>)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
```
|
61
|
+
としてmath,dmathを処理しています.必要ならそれ以外のinlineもここに付け足すことで対応できます.
|
62
|
+
|
63
|
+
## snake_nameがlatexで引っかかる
|
64
|
+
math環境の移し替えはうまくいったが,underscore_namesがすべて引っかかるequationとして引っかかる.
|
65
|
+
```
|
66
|
+
\usepackage{underscore}
|
67
|
+
```
|
68
|
+
だけでもできるようだが,できればto_latexで対応したい.ということで,paragraphにescape_snake_namesを入れた.
|
69
|
+
|
70
|
+
paragraphはpreformattedからは呼ばれない.しかし,\verb|$$|や\verb|\begin{equation}...\end{equation}|が含まれる.そこで
|
71
|
+
一旦全置換してそこだけ戻すようにした.gsubのなかでなんどもできるか自信がなくて.二重のgsubにしているが...
|
72
|
+
```ruby
|
73
|
+
def escape_snake_names(str)
|
74
|
+
str.gsub!(/_/,"\\_")
|
75
|
+
str.gsub!(/\$.+?\$/){ |text| text.gsub!(/\\_/,"_") }
|
76
|
+
str.gsub!(/equation.+?equation/m){ |text| text.gsub!(/\\_/,"_") }
|
77
|
+
end
|
78
|
+
|
79
|
+
def paragraph(lines)
|
80
|
+
lines.each{|line| line = escape_snake_names(line) }
|
81
|
+
@f << "#{lines.join("\n")}\n\n"
|
82
|
+
end
|
83
|
+
```
|
84
|
+
gsub!で置換できなかったときには,nilが返るので対応.なんかえらく冗長.
|
85
|
+
```ruby
|
86
|
+
def escape_snake_names(str)
|
87
|
+
str.gsub!(/_/,"\\_")
|
88
|
+
str.gsub!(/\$.+?\$/){ |text|
|
89
|
+
if text =~ /\\_/ then
|
90
|
+
text.gsub!(/\\_/,"_")
|
91
|
+
else
|
92
|
+
text
|
93
|
+
end
|
94
|
+
}
|
95
|
+
str.gsub!(/equation.+?equation/m){ |text|
|
96
|
+
if text =~ /\\_/ then
|
97
|
+
text.gsub!(/\\_/,"_")
|
98
|
+
else
|
99
|
+
text
|
100
|
+
end
|
101
|
+
}
|
102
|
+
str
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
## escape_snake_namesを改良(2016/02/14)
|
107
|
+
gemへの公開にあたって冗長部を簡略化.verbだけはここを切り出した検証とは違う.testにuriを埋め込んでverb変換とsnakeを検証.
|
108
|
+
```ruby
|
109
|
+
def escape_snake_names(str)
|
110
|
+
str.gsub!(/_/,"\\_")
|
111
|
+
patterns = [/\$(.+?)\$/ , /\\verb\|(.+?)\|/, /equation(.+?)equation/m ]
|
112
|
+
patterns.each{|pattern|
|
113
|
+
str.gsub!(/\\_/,"_") if str.match(pattern)
|
114
|
+
}
|
115
|
+
str
|
116
|
+
end
|
117
|
+
```
|
118
|
+
## escape_snake_namesを再改良(2016/02/16)
|
119
|
+
underscoreではincludeなどでsnake_named_fileも変換してしまい,だめ.hiki2latexで対応.
|
120
|
+
|
121
|
+
上のやり方では,うまくいかない場合が存在.元へ戻す.
|
122
|
+
```ruby
|
123
|
+
def escape_snake_names(str)
|
124
|
+
str.gsub!(/_/,"\\_")
|
125
|
+
patterns = [/\$(.+?)\$/ , /\\verb\|(.+?)\|/, /equation(.+?)equation/m ]
|
126
|
+
patterns.each{|pattern|
|
127
|
+
# str.gsub!(/\\_/,"_") if str.match(pattern)
|
128
|
+
str.gsub!(pattern){|text|
|
129
|
+
if text =~ /\\_/ then
|
130
|
+
text.gsub!(/\\_/,'_')
|
131
|
+
else
|
132
|
+
text
|
133
|
+
end
|
134
|
+
}
|
135
|
+
}
|
136
|
+
str
|
137
|
+
end
|
138
|
+
```
|
139
|
+
さらに
|
140
|
+
tableでescape_snake_namesを通ってなかった.
|
141
|
+
```
|
142
|
+
# buf << "#{ele} &"
|
143
|
+
buf << escape_snake_names(ele)+" &"
|
144
|
+
```
|
145
|
+
|
146
|
+
# 【copyright】
|
147
|
+
cc by Shigeto R. Nishitani, 2015
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# 【概要】
|
2
|
+
hiki2latexのtable処理部
|
3
|
+
|
4
|
+
# 【仕様】
|
5
|
+
- hiki記法の表をtabularへ変換
|
6
|
+
- 連結作用素に対応
|
7
|
+
- 行連結では中心に表示を移動
|
8
|
+
- 縦罫は基本使わない
|
9
|
+
- 横罫はheader内枠と上下外枠のみ
|
10
|
+
|
11
|
+
# 【hiki】
|
12
|
+
|
13
|
+
```
|
14
|
+
||>A11||>A12||
|
15
|
+
||^^A21||A22||>A23||
|
16
|
+
||A11||^A22||A12||
|
17
|
+
||A21||A23||
|
18
|
+
```
|
19
|
+
|
20
|
+
|
21
|
+
|A11||
|
22
|
+
|:----|:----|:----|:----|
|
23
|
+
|A21|A22|A23||
|
24
|
+
| |A11|A22|A12|
|
25
|
+
|A21|A23| |
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
# 【latex】
|
30
|
+
|
31
|
+
```latex
|
32
|
+
¥begin{center}¥begin{table}[htbp]¥begin{tabular}{ccccc}
|
33
|
+
¥hline
|
34
|
+
¥multicolumn{2}{c}{A11 } &¥multicolumn{2}{c}{A12 } & ¥¥ ¥hline
|
35
|
+
&A22 &¥multicolumn{2}{c}{A23 } & ¥¥
|
36
|
+
A21 &A11 &A22 &A12 & ¥¥
|
37
|
+
&A21 & &A23 & ¥¥
|
38
|
+
¥hline
|
39
|
+
¥end{tabular}¥end{table}¥end{center}
|
40
|
+
%横罫を入れる場合は, ¥hline, ¥cline{2-3}などで.
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
# 【コード解説】
|
45
|
+
元のHTMLOutputではそれぞれの要素で対応していたが,LatexOutputではtable_closeにて
|
46
|
+
```ruby
|
47
|
+
def table_close
|
48
|
+
@f << make_table
|
49
|
+
end
|
50
|
+
```
|
51
|
+
としている.make_tableは下請けにmake_matrixを読んでおり,ここでほぼ全ての作業をしている.作業内容は
|
52
|
+
- matrixを作る
|
53
|
+
- 縦連結を処理
|
54
|
+
- 縦連結の数(rs)だけ下行に追加
|
55
|
+
- 連結の中心(c_rs)に内容を表記
|
56
|
+
- 横連結をmulticolumnで処理
|
57
|
+
- ついでに最大列数(max_col)を記録
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
bob% cat table.rb
|
61
|
+
cont = File.readlines("table")
|
62
|
+
|
63
|
+
cont.each{|line|
|
64
|
+
p tmp=line.split('||')
|
65
|
+
}
|
66
|
+
|
67
|
+
t_matrix=[]
|
68
|
+
cont.each{|line|
|
69
|
+
tmp=line.split('||')
|
70
|
+
tmp.slice!(0)
|
71
|
+
tmp.slice!(-1) if tmp.slice(-1)=="\n"
|
72
|
+
tmp.each_with_index{|ele,i| tmp[i] = ele.match(/\s*(.+)/)[1]}
|
73
|
+
t_matrix << tmp
|
74
|
+
}
|
75
|
+
|
76
|
+
t_matrix.each_with_index{|line,i|
|
77
|
+
line.each_with_index{|ele,j|
|
78
|
+
if ele=~/\^+/ then
|
79
|
+
t_matrix[i][j]=""
|
80
|
+
rs=$&.size
|
81
|
+
c_rs=rs/2
|
82
|
+
rs.times{|k| t_matrix[i+k+1].insert(j,"")}
|
83
|
+
t_matrix[i+c_rs][j]=$'
|
84
|
+
end
|
85
|
+
}
|
86
|
+
}
|
87
|
+
p t_matrix
|
88
|
+
|
89
|
+
max_col=0
|
90
|
+
t_matrix.each_with_index{|line,i|
|
91
|
+
n_col=line.size
|
92
|
+
line.each_with_index{|ele,j|
|
93
|
+
if ele=~/>+/ then
|
94
|
+
cs=$&.size
|
95
|
+
t_matrix[i][j]= "\\multicolumn{#{cs+1}}{c}{#{$'}} "
|
96
|
+
n_col+=cs
|
97
|
+
end
|
98
|
+
}
|
99
|
+
max_col = n_col if n_col>max_col
|
100
|
+
}
|
101
|
+
p t_matrix
|
102
|
+
p max_col
|
103
|
+
```
|
Binary file
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Hiki2latex
|
2
|
+
convert hikidoc text to latex format.
|
3
|
+
|
4
|
+
\
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
```ruby
|
9
|
+
gem 'hiki2latex'
|
10
|
+
```
|
11
|
+
And then execute:
|
12
|
+
```
|
13
|
+
$ bundle
|
14
|
+
```
|
15
|
+
Or install it yourself as:
|
16
|
+
```
|
17
|
+
$ gem install hiki2latex
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
Use as a gem library:
|
22
|
+
```ruby
|
23
|
+
require 'hiki2latex'
|
24
|
+
|
25
|
+
puts HikiDoc.to_latex(File.read(ARGV[0]),{:level=>@level,:listings=>@listings})
|
26
|
+
```
|
27
|
+
|
28
|
+
or as a command line tool:
|
29
|
+
|
30
|
+
<dl>
|
31
|
+
<dt>Usage</dt><dd> hiki2latex [options] FILE</dd>
|
32
|
+
</dl>
|
33
|
+
|
34
|
+
```
|
35
|
+
> hiki2latex --pre PRICM_preamble.tex --post biblio.tex -p test.hiki > test.tex
|
36
|
+
> hiki2latex --listings --post post.tex -p ./test.hiki > test.tex
|
37
|
+
```
|
38
|
+
|
39
|
+
| option | operation|
|
40
|
+
|:----|:----|
|
41
|
+
| -v, --version | show program Version.|
|
42
|
+
| -l, --level VALUE | set Level for output section.|
|
43
|
+
| -p, --plain FILE | make Plain document.|
|
44
|
+
| -b, --bare FILE | make Bare document.|
|
45
|
+
| --head FILE | put headers of maketitle file.|
|
46
|
+
| --pre FILE | put preamble file.|
|
47
|
+
| --post FILE | put post file.|
|
48
|
+
| --listings | use listings.sty for preformat with style.|
|
49
|
+
|
50
|
+
|
51
|
+
## Development
|
52
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec hiki2latex` to use the gem in this directory, ignoring other installed copies of this gem.
|
53
|
+
|
54
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/daddygongon/hiki2latex. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
58
|
+
|
59
|
+
## License
|
60
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -1,22 +1,42 @@
|
|
1
1
|
# 【概要】
|
2
2
|
hiki formatで書かれた文章を,latex formatに変換する
|
3
|
-
#
|
4
|
-
-
|
3
|
+
# 【置き場所】
|
4
|
+
- [rubygems](http://rubygems.org/gems/hiki2latex)
|
5
|
+
- [Github](https://github.com/daddygongon/hiki2latex)
|
5
6
|
|
6
7
|
# 【使用法】
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
Use as a gem library:
|
9
|
+
```ruby
|
10
|
+
require 'hiki2latex'
|
11
|
+
|
12
|
+
puts HikiDoc.to_latex(File.read(ARGV[0]),{:level=>@level,:listings=>@listings})
|
13
|
+
```
|
14
|
+
|
15
|
+
or as a command line tool:
|
16
|
+
|
17
|
+
<dl>
|
18
|
+
<dt>Usage</dt><dd> hiki2latex [options] FILE</dd>
|
19
|
+
</dl>
|
20
|
+
|
17
21
|
```
|
18
|
-
-
|
19
|
-
-
|
22
|
+
> hiki2latex --pre PRICM_preamble.tex --post biblio.tex -p test.hiki > test.tex
|
23
|
+
> hiki2latex --listings --post post.tex -p ./test.hiki > test.tex
|
24
|
+
```
|
25
|
+
|
26
|
+
| option | operation|
|
27
|
+
|:----|:----|
|
28
|
+
| -v, --version | show program Version.|
|
29
|
+
| -l, --level VALUE | set Level for output section.|
|
30
|
+
| -p, --plain FILE | make Plain document.|
|
31
|
+
| -b, --bare FILE | make Bare document.|
|
32
|
+
| --head FILE | put headers of maketitle file.|
|
33
|
+
| --pre FILE | put preamble file.|
|
34
|
+
| --post FILE | put post file.|
|
35
|
+
| --listings | use listings.sty for preformat with style.|
|
36
|
+
|
37
|
+
|
38
|
+
- より詳細な使用法は,nishitani0のhiki2latex_gemizingにある.
|
39
|
+
- 西谷研の内部で利用するときに特化したマニュアルはnishitani0のhiki2latex_manual.
|
20
40
|
|
21
41
|
## sample
|
22
42
|
幾つかのサンプルを以下に示す.
|
@@ -24,10 +44,10 @@ Usage: hiki2latex [options] FILE
|
|
24
44
|
|
25
45
|
|ソース(hiki表示)|pdf(latex変換後)|
|
26
46
|
|:----|:----|
|
27
|
-
|[
|
28
|
-
|[
|
29
|
-
|[
|
30
|
-
|[
|
47
|
+
|[Shunkuntype](Shunkuntype)のレポート|
|
48
|
+
|[LPSO15研究会の例](LPSO15_fall_meeting_abst)|{{attach_anchor(LPSO_abst.pdf)}}|
|
49
|
+
|[中間発表hand out例](AbstSample)|{{attach_anchor(AbstSample.pdf)}}|
|
50
|
+
|[使っているformat集](DocumentFormatter_format_examples)|
|
31
51
|
|
32
52
|
|
33
53
|
# 【仕様】
|
@@ -42,7 +62,7 @@ Usage: hiki2latex [options] FILE
|
|
42
62
|
1. graph, tableは[h]で提供.
|
43
63
|
|
44
64
|
# 【具体的な使用例rakefile】
|
45
|
-
|
65
|
+
具体的な使用例として[Shunkuntype_report](Shunkuntype_reportd)を作成した時のRakefile.rbを示す.何度も書き直す時は,このようにして自動化すべき.
|
46
66
|
```ruby
|
47
67
|
task :shunkuntype do
|
48
68
|
dir = '~/Sites/nishitani0/Internal/data/text/'
|
@@ -74,15 +94,15 @@ end
|
|
74
94
|
|
75
95
|
|memo |date|hiki|
|
76
96
|
|:----|:----|:----|
|
77
|
-
|hikidoc.rbからhiki2latex.rb|15/8/4
|
97
|
+
|hikidoc.rbからhiki2latex.rb|15/8/4||
|
78
98
|
|hiki2latex.rbひな形作成|15/8/5|
|
79
99
|
|@fをStringIOからStringへ|15/8/5|
|
80
|
-
|graph+caption|15/8/6
|
81
|
-
|math|15/8/7| [
|
82
|
-
|table| 15/8/8| [
|
83
|
-
|under_score| 15/8/11 | [
|
84
|
-
|gem化| 16/2/13 | [
|
85
|
-
|listings| 16/2/16 | [
|
100
|
+
|graph+caption|15/8/6||
|
101
|
+
|math|15/8/7| |
|
102
|
+
|table| 15/8/8| |
|
103
|
+
|under_score| 15/8/11 | |
|
104
|
+
|gem化| 16/2/13 | |
|
105
|
+
|listings| 16/2/16 | |
|
86
106
|
|
87
107
|
|
88
108
|
# 【開発メモ】
|
Binary file
|
Binary file
|
data/hikis/Math.png
ADDED
Binary file
|
Binary file
|
@@ -3,9 +3,9 @@
|
|
3
3
|
hiki formatで書かれた文章を,latex formatに変換する
|
4
4
|
!【documents】
|
5
5
|
* [[http://rubygems.org/gems/hiki2latex]]
|
6
|
-
|
7
6
|
!【使用法】
|
8
|
-
|
7
|
+
|
8
|
+
<<< tcsh
|
9
9
|
Usage: hiki2latex [options] FILE
|
10
10
|
-v, --version show program Version.
|
11
11
|
-l, --level VALUE set Level for output section.
|
@@ -23,7 +23,7 @@ Usage: hiki2latex [options] FILE
|
|
23
23
|
幾つかのサンプルを以下に示す.
|
24
24
|
!!!caption:hiki2latexにより作成されたpdfファイトとその元ネタ.
|
25
25
|
||ソース(hiki表示)||pdf(latex変換後)
|
26
|
-
||[[Shunkuntype]]||[[Shunkuntype]]
|
26
|
+
||[[Shunkuntype|https://github.com/daddygongon/shunkuntype/wiki/Shunkuntype_report]]||[[Shunkuntypeのレポート|https://github.com/daddygongon/shunkuntype/wiki/shunkun_report.pdf]]
|
27
27
|
||[[LPSO15研究会の例|LPSO15_fall_meeting_abst]]||{{attach_anchor(LPSO_abst.pdf)}}
|
28
28
|
||[[中間発表hand out例|AbstSample]]||{{attach_anchor(AbstSample.pdf)}}
|
29
29
|
||[[使っているformat集|DocumentFormatter_format_examples]]||
|
@@ -64,8 +64,6 @@ end
|
|
64
64
|
>>>
|
65
65
|
本文(Shunkuntype_report.tex)と付録(targets.texs)がある.付録は'-l 2 -b'によってsubsectionからのtitle levelにしてbare modeで作っている.post.texにpostで付け加えるtex部を指定して,appendixをつけている.
|
66
66
|
|
67
|
-
!【code documents】
|
68
|
-
[[rdoc|http://nishitani0.kwansei.ac.jp/~bob/nishitani0/rdocs/hiki2latex/index.html]]に置いといたけど,ruby gemsやgithubに置けば不要となる.
|
69
67
|
!【変更履歴,内容】
|
70
68
|
変更履歴,内容を表に示す.15/8月期で基本開発.16/2月期にgem化.
|
71
69
|
!!caption:変更履歴,内容
|
@@ -87,7 +85,7 @@ end
|
|
87
85
|
!!【 保留項目】
|
88
86
|
# includegraphicsの自動提供
|
89
87
|
## hikiに置かれているgraphは劣化版なんでそれをいじるのはあまり筋がよろしくない.
|
90
|
-
## epsならできるかも.
|
88
|
+
## epsならできるかも.hikiのattach_viewでサイズをどういじっているか...
|
91
89
|
# underbar(_)がlatexでは全て引っかかる.escapeする?-> 対応済み [[hiki2latex_math]]
|
92
90
|
## snake表記はrubyではfile名や変数名に頻繁に使われるので対処が必要かも.
|
93
91
|
|