如何在 EMACS 上完全证明 Latex 代码的合理性
我想在 EMACS 上完全证明乳胶代码的合理性,以便我的乳胶代码看起来更好。例如,我记得我的顾问以完全合理的方式向我发送乳胶,如下所示:
In ~\cite{Hummel2004}, authors described an approach for harvesting
software components from the Web. The basic idea is to use the Web as
the underlying repository, and to utilize standard search engines,
such as Google, as the means of discovering appropriate software
assets. Other researchers have crawled through Internet publicly
available CVS repositories to build their own source code search
engines (e.g., SPARS-J)~\cite{Matsushita2005}.
我认为他的列宽设置为 70 列。 有人可以给我提示吗?
I want to fully-justify latex code on EMACS so that my latex code will look better. For example, I remember my advisor sending me latex in fully justified way like this:
In ~\cite{Hummel2004}, authors described an approach for harvesting
software components from the Web. The basic idea is to use the Web as
the underlying repository, and to utilize standard search engines,
such as Google, as the means of discovering appropriate software
assets. Other researchers have crawled through Internet publicly
available CVS repositories to build their own source code search
engines (e.g., SPARS-J)~\cite{Matsushita2005}.
I suppose that his column-width is set to 70 columns.
Could someone give me a hint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
标准
fill.el
包包含命令justify-current-line
这是您所需要的一部分。来自功能帮助:其他海报已经给了你神奇的调用:
作为哲学旁注,固定宽度文本对齐的要点是在不灵活的输出设备上伪造真实的排版。所以将它应用到 LaTeX 源代码对我来说似乎有点奇怪。此外,我已经对 LaTeX 文档使用“一句话一行”方法已有几个月了,发现它确实提高了 LaTeX 的可编辑性和源代码控制行为,所以我建议不要这样做。
The standard
fill.el
package includes the commandjustify-current-line
which is part of what you need. From the function help:And other posters have already given you the magicall invokation:
As a philosophical side note, the point of fixed-wdith text justification is to fake real typography on a inflexible output device. So applying it to LaTeX source seems a little odd to me. Moreover, I have been using the "one sentence to a line" approach to LaTeX documents for some months now, and find that it really does improves both the editability and the source-control behavior of LaTeX, so I would recommend against doing this.
如果您选择该区域,然后按 Ctrl-u Mx fill-region,您将获得“完全对齐”。
If you select the region, and then press Ctrl-u M-x fill-region you get "full justification".
Mx set-justification-full
之后使用 Refill 模式键入后再次运行该命令。
M-x set-justification-full
Use Refill mode afterwards to not have to run the command again after typing.
在文件本身中换行(而不是像
longlines-mode
不会改变文件的结构),我使用auto-fill- mode
,自动将Mq
(fill-paragraph
) 应用于每个段落。例如,我在邮件模式
中使用auto-fill-mode
。您可以使用这样的挂钩对 LaTeX 模式执行类似的操作:假设您的 TeX 模式的挂钩是
TeX-mode-hook
。To get line wrap in the file itself (as opposed to something like
longlines-mode
that does not alter the structure of the file), I useauto-fill-mode
, which automatically appliesM-q
(fill-paragraph
) to each paragraph. For example, I useauto-fill-mode
inmail-mode
. You could do something similar with your LaTeX mode with a hook like this:Assuming your TeX mode's hook is
TeX-mode-hook
.