gpt4 book ai didi

emacs - Emacs 中的 LaTeX 缩进(格式化)

转载 作者:bug小助手 更新时间:2023-10-28 10:48:36 30 4
gpt4 key购买 nike

在 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)。

关于emacs - Emacs 中的 LaTeX 缩进(格式化),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2477195/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com