在 Emacs (AucTex) 中缩进 LaTeX 文档的正确方法是什么?
例如当我有一个列表时:
\begin{itemize}
\item orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim urna, mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea dictumst.
\item orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim urna, mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea dictumst.
\end{itemize}
并希望最终得到:
\begin{itemize}
\item orem ipsum dolor sit amet, consectetur
adipiscing elit. Aliquam enim urna, mattis eu aliquet eget,
condimentum id nibh. In hac habitasse platea dictumst.
\item orem
ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim
urna, mattis eu aliquet eget, condimentum id nibh. In hac
habitasse platea dictumst.
\end{itemize}
我尝试了 indent-region
但它什么也没做,并且 LaTeX-fill-*
会产生奇怪的结果,例如:
\begin{itemize} \item orem ipsum dolor sit amet, consectetur
adipiscing elit. Aliquam enim urna, mattis eu aliquet eget,
condimentum id nibh. In hac habitasse platea dictumst. \item orem
ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim
urna, mattis eu aliquet eget, condimentum id nibh. In hac
habitasse platea dictumst. \end{itemize}
谢谢!
您确定您已正确安装 AUCTeX 吗? AUCTeX 的 LaTeX 模式称为 LaTeX-mode
,而 latex-mode
是(蹩脚的)Emacs 默认值。使用 C-h m
检查当前的主要模式。
当我将光标放在环境的开头并按 C-c C-q C-e
(LaTeX-fill-environment
) 时,我得到以下信息:
\begin{itemize}
\item orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam
enim urna, mattis eu aliquet eget, condimentum id nibh. In hac
habitasse platea dictumst.
\item orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam
enim urna, mattis eu aliquet eget, condimentum id nibh. In hac
habitasse platea dictumst.
\end{itemize}
AUCTeX 填充命令列表:
C-c C-q C-e
(LaTeX-fill-environment
)
C-c C-q C-p
(LaTeX-fill-paragraph
)
C-c C-q C-r
(LaTeX-fill-region
)
C-c C-q C-s
(LaTeX-fill-section
)
您也可以在键入时按 M-q
(fill-paragraph
)。
我是一名优秀的程序员,十分优秀!