如果 TeX 是一种编程语言,我如何开始使用 TeX 编程?
我用的是苹果电脑。但我也有一台装有 Windows 7 的 PC。那么当我想使用 TeX 开始 LaTeX 编程功能时,我的起点是什么?有SDK和文档吗?我找不到任何关于 TeX 编程的书。
I use a Mac. But I also have a PC with Windows 7. So when I want to start programming functionality for LaTeX using TeX, what's my starting point? Is there an SDK and documentation? I couldn't find any book on TeX programming.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
在 TeX 中编写非文档的内容:
所以这是可以做到的 - 这是只是深奥、混乱的编程练习。
Programming something in TeX that isn't a document:
So it can be done — it's just an exercise in esoteric, obfuscated programming.
阅读 Don Knuth 的 The TeXbook — 一切您想要的内容直接从源头了解 TeX 编程。我最喜欢的一章是附录 D:肮脏的伎俩。
(Michael Plass 是 Don 的学生,与 Don 一起开发 TeX,他曾经告诉我“Don 非常努力地不让 TeX 成为一种编程语言。不幸的是,他没有成功。”)
Read Don Knuth's The TeXbook—everything you wanted to know about programming TeX, straight from the source. My favorite chapter is Appendix D: Dirty Tricks.
(Michael Plass, who was Don's student and worked with Don on TeX, told me once that "Don tried very hard not to make TeX a programming language. Unfortunately, he didn't succeed.")
引用埃里克·雷蒙德:
他接着说,即使可以用 TeX 编程,这也是一个非常糟糕的主意。
To quote Eric Raymond:
He goes on to say that even if it's possible to program in TeX, it's a really bad idea.
TeX 和 LaTeX(其后续版本)是当今相当古老的语言,但仍然广泛且经常使用。它们的主要用途是在大学,特别是数学和自然科学领域。它不是像 C#、PHP 或 JavaScript 这样的编程语言,它更像是一种文档布局语言(可能有点像 HTML,没有任何现代事件)。
TeX 背后的想法是使用计算机来计算打印文本时文本在纸张上的最佳布局方式。这意味着在 TeX 中,您布置了一个表格,但您没有提及任何(或很少)关于其大小的信息。 TeX 编译器会处理这个问题。
说到书籍或网站,数量非常多。尝试亚马逊,例如这个 LaTeX 指南。
忘记 TeX,使用 LaTeX。都是一样的,更容易,而且更广泛。 LaTeX 就是 TeX。但 TeX 不是 LaTeX。
TeX and LaTeX (its follow-up) are quite old languages nowadays, but are still widespread and often used. Their primary use is found in universities, specifically with mathematics and natural sciences. It's not a programming language like C#, PHP or JavaScript, it's more a document-layout language (a bit like HTML perhaps, without any of the modern events).
The idea behind TeX was to use the computer to calculate how the text would be best laid out on the paper when you print it. That means that in TeX, you lay out a table, but you don't say anything (or little) about its size. The TeX compiler will take care of that.
When it comes to books or sites, there's a sheer many of them. Try amazon, for instance this Guide To LaTeX.
Forget about TeX, use LaTeX. It's the same, it's easier, and it's more widespread. LaTeX is TeX. But TeX is not LaTeX.
让我推荐 Knuth 教授的网站:
链接文本
这里有您想要的所有书籍TeX。
Let me suggest Prof. Knuth's site:
link text
There are all the books you would want to have on TeX.
您还可以尝试从
expl3
编程语言开始,它是 TeX 之上的一层,具有更一致的语法、更抽象的数据结构以及用于执行编程任务的更多内置功能比 LaTeX 的内核。免责声明:我参与了它的开发。You could also try starting out with the
expl3
programming language, which is a layer on top of TeX with more consistent syntax, more abstracted data structures, and quite a deal more in-built functionality for performing programmatic tasks than LaTeX's kernel. Disclaimer: I'm involved with its development.只是为了补充其他好的答案,因为 TeX 是一个排版系统,所以没有这个意义上的 IDE。有很多支持 TeX 的编辑器(我使用 TeXworks,但 Emacs 显然是一个流行的选择,特别是在 Linux 上,整个 TeXniccenter 在 Windows 上很常见)。
Just to add to the other good answers, as TeX is a typesetting system there are not IDEs in that sense. There are lots of TeX aware editors (I use TeXworks, but Emacs is obviously a popular choice particularly on Linux, whole TeXniccenter is very common on Windows).
如果您需要写一篇文章或论文或任何您想要看起来漂亮且可发表的东西,LaTeX 绝对是您的朋友。我推荐 More Math into LaTeX,因为这本书过去确实对我有帮助。 Wikibook 还有一个优秀的 LaTeX 指南(而且是免费的!)。
如果您已经熟悉 Eclipse IDE,那么 TeXlipse 插件非常适合初学者,因为它可以向用户显示即时反馈和文档。
if you ever need to write an essay or a paper or anything that you want to look nice and publishable, LaTeX is definitely your friend. I recommend More Math into LaTeX as that book really helped me in the past. Wikibook also has an excellent LaTeX guide (on top of being free!).
If you're familiar with Eclipse IDE already then the TeXlipse plugin is great for beginners since it can show user immediate feedback and documentation.