简体   繁体   English

Emacs:Aquamacs更新后,自动填充模式的Alt-q在LaTeX的数学分隔符处打破了行

[英]Emacs: After Aquamacs update, Auto-Fill-Mode's Alt-q breaks lines at maths delimiter in LaTeX

After I updated Aquamacs, using Alt-q (in the Auto-Fill minor mode) to fill paragraphs when editing a LaTeX document results in each line being broken at the first occurrence of the LaTeX maths closing delimiter, \\) . 更新Aquamacs后,使用Alt-q (在自动填充次要模式下)在编辑LaTeX文档时填充段落导致每行在LaTeX数学结束分隔符的第一次出现时被破坏, \\) (Well, almost! See the example below for the one exception.) (好吧,差不多!请参阅下面的示例,了解一个例外情况。)

Version information: Aquamacs 3.2 GNU Emacs 24.4.51.2 . 版本信息: Aquamacs 3.2 GNU Emacs 24.4.51.2

Question

How do I tell Aquamacs/Emacs/Auto-Fill mode not to break lines at the first \\) that it sees on a line, but to actually fill in the paragraph as it used to do before the update? 我如何告诉Aquamacs / Emacs的/自动填充模式不是在第一次断行\\)它认为在一条线上,但在实际段填写,因为它使用的更新之前做什么?

Steps to reproduce this behaviour 重现此行为的步骤

  1. Help -> Diagnose and report bug -> Start Aquamacs without customizations to get a "pristine" Aquamacs window. Help -> Diagnose and report bug -> Start Aquamacs without customizations以获得“原始”Aquamacs窗口。
  2. Open a file named testemacs.tex and paste the Lorem Ipsum text, twice to make two paragraphs. 打开一个名为testemacs.tex的文件并粘贴Lorem Ipsum文本两次以生成两个段落。
  3. Add small maths expressions delimited by the LaTeX delimiters \\( and \\) , at random places in the second paragraph. 加入由乳胶分隔符分隔的小数学表达式\\(\\)第二段随机的地方。 Leave the first paragraph as it is. 保留第一段原样。
  4. Type Alt-x auto-fill-mode to enable Auto-Fill mode. 键入Alt-x auto-fill-mode以启用自动填充模式。
  5. Go to each paragraph and type Alt-q to invoke the fill-paragraph function. 转到每个段落并键入Alt-q以调用fill-paragraph函数。
  6. Observe the difference! 观察差异! See the screenshot below: 请参见下面的截图:

图像显示数学分隔符的换行符

As you can see, everywhere except on the very last line, fill-paragraph breaks the line at the first closing delimiter \\) that it sees. 正如你所看到的,除了随处可见的最后一行, fill-paragraph打破在第一关闭定界符线\\)它认为。 This makes the paragraph look really ugly, and defeats the whole purpose of filling-in paragraphs. 这使得该段看起来非常难看,并且打败了填写段落的整个目的。 How can I get rid of this behaviour? 我怎样才能摆脱这种行为?

Modes 模式

Please see the screenshot below for the modes in operation: 有关运行模式,请参阅下面的屏幕截图:

模式信息

This is a recent change in AUCTeX. 这是AUCTeX最近的一次变化。 You can customize the variable LaTeX-fill-break-at-separators . 您可以自定义变量LaTeX-fill-break-at-separators By default it is 默认情况下是

 (\\\( \\\) \\\[ \\\])

which according to the documentation means that lines will be broken before or after these separators if the whole expression does not fit on the line when filling. 根据文档意味着如果在填充时整个表达式不适合该行,则在这些分隔符之前或之后将断开行。 However, the behaviour is not quite that and as you see it will unconditionally break the line after the closing delimiters \\) and \\] . 但是,行为并不是那么明显,正如您所看到的那样,它会在结束分隔符\\)\\]之后无条件地破坏该行。 Removing the inline math switches \\( and \\) from this list restores the older behaviour. 从此列表中删除内联数学开关\\(\\)可恢复较旧的行为。 I also find just removing \\) from this list to give acceptable results, see example 2 below. 我还发现从这个列表中删除\\)以得到可接受的结果,请参见下面的示例2。 In the customization interface just uncheck "Closing Inline Math Switches" 在自定义界面中,只需取消选中“关闭内联数学开关”

Here is a concrete demonstration of different settings. 以下是不同设置的具体演示。

  1. default value of LaTeX-fill-break-at-separators , equivalent to LaTeX-fill-break-at-separators默认值,相当于

     (custom-set-variables '(LaTeX-fill-break-at-separators (quote (\\\\\\( \\\\\\) \\\\\\[ \\\\\\])))) 

gives the following with a line break after each \\) : 在每个\\)之后给出以下换行符:

Let \( \gamma\colon \BbbR \times [0,T) \to \BbbR^2 \)
be a family of regular curves solving~\eqref{eq:c-flow}, with each
curve \( \gamma^t \)
of period~\( \Psi \)
and with \( \gamma^0 \)
strictly convex. Let \( \kappa_0(t) \)
be the minimum value of \( \kappa \)
on \( \gamma^t \).
Note that \( \kappa_0(t) \)
is achieved at some point \( (\psi,t) \),
so in particular \( \kappa_0(0) > 0 \).
  1. Without inline math closing 没有内联数学结束

     (custom-set-variables '(LaTeX-fill-break-at-separators (quote (\\\\\\( \\\\\\[ \\\\\\])))) 

keeps math groups on a line but allows text after them: 将数学组保持在一条线上,但允许后面的文本:

Let \( \gamma\colon \BbbR \times [0,T) \to \BbbR^2 \) be a family of
regular curves solving~\eqref{eq:c-flow}, with each curve
\( \gamma^t \) of period~\( \Psi \) and with \( \gamma^0 \) strictly
convex. Let \( \kappa_0(t) \) be the minimum value of \( \kappa \) on
\( \gamma^t \).  Note that \( \kappa_0(t) \) is achieved at some point
\( (\psi,t) \), so in particular \( \kappa_0(0) > 0 \).
  1. Without any inline math delimiter 没有任何内联数学分隔符

     (custom-set-variables '(LaTeX-fill-break-at-separators (quote (\\\\\\[ \\\\\\])))) 

math groups may be split over lines: 数学组可能会分为几行:

Let \( \gamma\colon \BbbR \times [0,T) \to \BbbR^2 \) be a family of
regular curves solving~\eqref{eq:c-flow}, with each curve \( \gamma^t
\) of period~\( \Psi \) and with \( \gamma^0 \) strictly convex. Let
\( \kappa_0(t) \) be the minimum value of \( \kappa \) on \( \gamma^t
\).  Note that \( \kappa_0(t) \) is achieved at some point \( (\psi,t)
\), so in particular \( \kappa_0(0) > 0 \).

I will also note that Aquamacs is broken: it overwrites the default fill-paragraph (which takes no arguments in GNU Emacs) with a function from fill-adapt , which takes one argument. 我还会注意到Aquamacs已经坏了:它用fill-adapt的函数覆盖了默认的fill-paragraph (在GNU Emacs中没有参数),它接受一个参数。

This breaks all packages that use fill-paragraph , essentially. 这基本上打破了所有使用fill-paragraph包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM