• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

rened/LaTeX.jl: Create LaTeX documents from within Julia, including image handli ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

rened/LaTeX.jl

开源软件地址(OpenSource Url):

https://github.com/rened/LaTeX.jl

开源编程语言(OpenSource Language):

Julia 100.0%

开源软件介绍(OpenSource Introduction):

LaTeX

Build Status Build Status Build Status

This package allows to construct LaTeX documents programmatically.

Installation

It is assumed that you have pdflatex installed. You can then install LaTeX.jl like this:

]add LaTeX

To be able to use code blocks with syntax highlighting, please install Pygments: easy_install -U Pygments.

Example

using LaTeX

x = range(-6,6; length=100)

using Gadfly
g = Image(7, 7, plot(x = x, y = sin.(x) ./ x, Geom.line))
w = Image(7, 7, plot(x = x, y = cos.(x)))

# needs pygments to be installed
c = Code("""
struct MyJuliaType
    a::Array{Int}
end
""")

openpdf(report(
    Section("Results", [
        Section("Plots", Figure("Plot comparison",Tabular([w,g]))),
        Section("Code", c)
])))

Available functions

content can always be either a single item or an array of items.

  • latex = report(content) assembles the LaTeX file
  • latex = document(content) gives more control over the look and feel of the document. See here for more.
  • openpdf(latex) compiles the LaTeX file and tries to open it
  • writepdf(latex, filename) compiles the LaTeX file and save it to the destination provided
  • Section(title, content) creates a new section. A section is automatically translated to a Linux chapter, section or subsection according to its nesting
  • Figure(caption, content)
  • Table(caption content)
  • Tabular(content)
  • Code(content)
  • TOC() indicates a table of contents
  • Abstract(content) defines an abstract for the document
  • Image(height, width, Array or Winston.FramePlot or Gadfly.Plot), where the array can be either of size (m,n,1) or RGB (m,n,3), with the values in the range 0..1

Advanced

To define a custom document, use the document function, in combination with the following declarations, some of which can be omitted:

  • DocumentClass("article", ["11pt", "letterpaper"]) declares the document class of the file. Settings are passed through a vector as the second parameter.
  • Title("A LaTeX Library for Julia") declares the title of the file.
  • Date(1999, 12, 31) declares the date of the file. Note that this is the same Date as in standard Julia.
  • Author("John Smith") declares the author of the file.

For example, the following is a minimal document:

document([
    DocumentClass("article", ["11pt", "letterpaper"]),
    Date(2015, 11, 23),
    Title("A LaTeX Library for Julia"),
    Author("John Smith"),
    Section("Code", [Code("""# minimal example""")])])

Todos

  • make preamble configurable
  • adapt openpdf to linux
  • add tests



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
readium/r2-testapp-kotlin发布时间:2022-07-07
下一篇:
Kotlin-Polytech/KotlinAsFirst-Coursera-v2021: Репозиторий для ку ...发布时间:2022-07-07
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap