从 Objective-C 生成 LaTeX 和 PDF
我想从 Objective-C 生成一个 LaTeX 文档并用 pdfLatex 编译它,这样我最终就有了一个 PDF。
是否有一个 SDK 可以做到这一点,或者我是否需要编写一些来自 NSString 的 LaTeX 代码并使用 NSTask 运行 pdflatex ?
I want to generate a LaTeX document from Objective-C and compile it with pdfLatex so that I have an PDF in the end.
Is there a SDK to do this, or do I need to write to file some LaTeX code from a NSString and run pdflatex with a NSTask ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在调用 TeX 方面已经做了一些工作。有 TeX 守护进程,它是 PyTeX,看起来它正在做你需要的事情。我已经看到这个系统在工作,但我自己没有使用过它,我不确定它的当前状态。
另一方面,如果您以编程方式执行此操作以获得方程位图(或类似的东西,您的问题模糊地暗示了这一点),那么您可能会对
dvipng
或 < code>dvi2bitmap 库,完全跳过 postscript/PDF。一般来说,在过去做这样的事情时,我发现安排我生成的 LaTeX 是相当高级的,并且详细的布局推迟到您自己编写的类或样式是很有用的。这意味着您可以在头脑中处于 LaTeX 模式时调整 LaTeX 布局的细节,最终不会那么混乱。
Some work has been done on calling out to TeX. There's the TeX daemon, which is part of PyTeX, and which looks like it's doing something like what you need. I've seen this system working, but haven't used it myself and I'm not sure of its current status.
If, on the other hand, you're after doing this programmatically in order to get equation bitmaps (or something like that, which your question vaguely suggests), then you might be interested in the
dvipng
ordvi2bitmap
libraries, which skip postscript/PDF entirely.As a general point, when doing things like this in the past, I've found it useful to arrange that the LaTeX I generate is pretty high-level, and the detailed layout is deferred to a class or style that you write yourself. That means that you can tune the details of the LaTeX layout while mentally in a LaTeX mode, which ends up less confusing in the end.