# word06.rb.txt: ruby script (encoding: Windows-31J) # 数式とグラフ(画像)をワード文書に盛り込む。 # 画像ファイル(data06_graph.png)を取り込んで z_word06.docx を生成。 require "wrdap" ## markdown→docx変換 filename = "z_word06.docx" mkd_str = DATA.read docx_str = Wrd::pandoc_docx(mkd_str) File.open(filename, "wb") {|ff| ff.write docx_str} __END__ # 数式とグラフの表示 ◇ 分数の計算: $$ \frac{1}{2} + \frac{1}{3} = \frac{3 + 2}{6} = \frac{5}{6} $$ ◇ 相加平均の計算: $$ μ = \frac{1}{n}\sum_{i=1}^{n} x_i = \frac{x_1 + x_2 + \cdots + x_n}{n} $$ ◇ 放物線のグラフ: ![放物線のグラフ](data06_graph.png)