有没有办法创建一个将缩进解释为逐项级别的 LaTeX 环境?
尽管我很喜欢 LaTeX,但我发现逐项列出和枚举环境总是需要 (1) 开始/结束环境声明语句,以及 (2) 每个项目之前的“\item”命令,这相当烦人(而且视觉上很吵)。
我希望拥有(或能够创建)某种“自动项目化”环境,其中类似的东西
\begin{autoitemize}
first item
second item
nested item
another nested item
third item
\end{autoitemize}
会自动翻译为:
\begin{itemize}
\item first item
\item second item
\begin{itemize}
\item nested item
\item another nested item
\end{itemize}
\item third item
\end{itemize}
所以问题:有没有办法使用 LaTeX 包来做到这一点,而不是使用外部预处理器?
如果能够在项目行上有某种可选的行前缀,指示项目及其后继者所处的列表环境类型,这也可能会很好——这将允许一种类型嵌套在另一种类型中。
诚然,这可能不如普通的 LaTeX 方式那么强大,但在很多情况下它就足够了并且非常方便。
As much as I like LaTeX, I find it rather annoying (and visually noisy) that itemize and enumerate environments always require (1) the begin/end environment declaration statements, and (2) "\item" commands prior to each item.
What I'd love to have (or be able to create) is some kind of "autoitemize" environment, where something like
\begin{autoitemize}
first item
second item
nested item
another nested item
third item
\end{autoitemize}
would be automatically translated to:
\begin{itemize}
\item first item
\item second item
\begin{itemize}
\item nested item
\item another nested item
\end{itemize}
\item third item
\end{itemize}
So the question: is there a way to do this using a LaTeX package, rather than with an external preprocessor?
It might also be nice to be able to have some sort of optional line prefix on the item-lines which indicates what kind of list environment the item and its successors is in -- this would allow for nesting of one type within another.
Granted, this may not be as powerful as just doing it the normal LaTeX way, but there are enough cases where it would be sufficient and quite handy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是 Markdown 和重组文本 (RST) 的用途。当你问这个问题时,你实际上已经不再谈论 LaTeX 了。您询问的是一种不同的标记语言。
从 RST 您可以轻松生成用于出版目的的 LaTeX。
http://docutils.sourceforge.net/rst.html
That's what Markdown and Restructured Text (RST) are for. You're not really talking about LaTeX any more, when you ask this. You're asking about a different markup language.
From RST you can easily generate LaTeX for publication purposes.
http://docutils.sourceforge.net/rst.html
Emacs Org 模式 可能允许您执行类似的操作。它有一定的能力可以转化为 LaTeX。
Emacs Org mode might allow you to do something like this. It has some capacity to translate into LaTeX.