Emacs:在LaTeX模式下填充段落时关闭缩进 [英] Emacs: Turn off indentation when doing a paragraph fill in LaTeX mode
问题描述
当我使用emacs编辑乳胶文档时,段落填充(Esc-q)不会做我想要的。例如,
组件\vn {%vec}与
$不相似c $ c>
当我使用填充我得到:
组件\vn {%vec}不是
%类似于
也就是说,emacs将%作为注释字符,并相应填写该段落。然而,\vn是我的一个宏,它以texttt模式设置文本,这里%只是一个常规的可打印字符,所以段落填充已经错误地完成了。
所以我想要的是段落填充与文本模式是一样的。也就是说,没有缩进,没有添加额外的字符。但是我不想在每次我想要段落填充时在文本模式和乳胶模式之间切换。有没有办法这样做?
感谢您的帮助。 - 大卫,
PS:是的,我知道如果在行尾有真正的意见,那么测试模式的填充就不会正确地执行。但是我从来没有在行尾做出评论,所以这绝对不会打扰我。
我找到了解决方案。我把它放在我的init.el文件中:
(add-hook'latex-mode-hook'(lambda setq comment-start nil))
(add-hook'tex-mode-hook'(lambda()(setq comment-start nil))
(add-hook' -mode-hook'(lambda()(setq fill-indent-as-to-mode nil))
(add-hook'tex-mode-hook'(lambda()(setq fill-indent- -to-mode nil)))
我喜欢emacs,但文档(或缺少)有时可以驱使我疯狂...:)。
When I am using emacs to edit a latex document the paragraph fill (Esc-q) does not do what I want. For example, something like:
The component \vn{%vec} is not similar to
When I use fill I get:
The component \vn{%vec} is not
% similar to
That is, emacs is taking "%" to be a comment character and filling the paragraph accordingly. However, "\vn" is a macro of mine that sets text in texttt mode and here "%" is simply a regular printable character so the paragraph fill has done things incorrectly.
So what I want is for paragraph fill to be the same it is as in text-mode. That is, no indentation and no adding extra characters. But I don't want to have to toggle between text-mode and latex-mode every time I want to paragraph fill. Is there any way to do this?
Thanks for the help. -- David
PS: Yes, I do know that if there are real comments at the end of lines then the test-mode fill will not do things correctly. But I never put comments at the end of lines so this will never bother me.
I found the solution. I put this in my init.el file:
(add-hook 'latex-mode-hook '(lambda() (setq comment-start nil)))
(add-hook 'tex-mode-hook '(lambda() (setq comment-start nil)))
(add-hook 'latex-mode-hook '(lambda() (setq fill-indent-according-to-mode nil)))
(add-hook 'tex-mode-hook '(lambda() (setq fill-indent-according-to-mode nil)))
I love emacs but the documentation (or lack thereof) can sometimes drive me crazy... :).
这篇关于Emacs:在LaTeX模式下填充段落时关闭缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!