For simple things you can define your own environments and commands. See how to use \newcommand and \newenvironment. Look at some examples here. It is easy.
Putting your commands and environments in a separate package is the next step.
Programming TeX (engine which LaTeX is based upon) is more complicated. The TeXbook [1], [2] is your friend.
An example of a re-writing of Listings is mcode which I found here. If you browse the .sty file you will have a good idea. However, if as a total beginner you are supposed to develop an entire package it can be due to the fact that you don't know how to use existing stuff. For example, with listings you have a lot of options and it can fit a lot of different languages. If you prefer to use pseudo-code, you can have a look at the "algorithm" package.
发布评论
评论(5)
请参阅latex 类和包作者指南。另请看看这个相当类似的问题,特别是,文本的实现为您提供了另一种实现事物的途径。
Look at The latex class and package authors guide. Also look at this rather similar SO question, in particular, the implementation of texments gives you another avenue for implementing things.
LaTeX 是一个用 TeX 语言开发的程序套件:)
LaTeX is a program suite developed in the language known as TeX :)
对于简单的事情,您可以定义自己的环境和命令。了解如何使用
\newcommand
和\newenvironment
。请查看此处的一些示例。这很容易。下一步是将命令和环境放在单独的包中。
TeX 编程(LaTeX 所基于的引擎)更加复杂。 TeXbook [1], [2] 是您的朋友。
For simple things you can define your own environments and commands. See how to use
\newcommand
and\newenvironment
. Look at some examples here. It is easy.Putting your commands and environments in a separate package is the next step.
Programming TeX (engine which LaTeX is based upon) is more complicated. The TeXbook [1], [2] is your friend.
您可以查看列表的源代码 package 如果你对它的工作原理感兴趣,但要小心。自己编写 LaTeX 包并不容易。
You can look into the source code of the
listings
package if you're interested in its workings but beware. Writing LaTeX packages yourself isn't easy.重写列表的一个例子是 mcode 我在这里找到的。如果您浏览 .sty 文件,您就会有一个好主意。
但是,如果作为一个完全的初学者,您应该开发整个软件包,则可能是因为您不知道如何使用现有的东西。例如,对于列表,您有很多选择,并且它可以适合很多不同的语言。
如果您喜欢使用伪代码,可以查看“算法”包。
An example of a re-writing of Listings is mcode which I found here. If you browse the .sty file you will have a good idea.
However, if as a total beginner you are supposed to develop an entire package it can be due to the fact that you don't know how to use existing stuff. For example, with listings you have a lot of options and it can fit a lot of different languages.
If you prefer to use pseudo-code, you can have a look at the "algorithm" package.