如何在 LyX 中设置自动更正以自动将

如何在 LyX 中设置自动更正以自动将

有没有办法将 LyX 2.3.4.4 配置为自动更正string1string2?具体来说,我想输入一个方程式并将其替换为或简单地<=替换为。\leq

  • 我知道它可以在其他一些文本编辑器(例如 TeXmacs 甚至 MS Word)中通过定义自动更正模式来实现。
  • 我可以定义一个快捷方式,这样 的组合SHIFT+< = 就可以激活命令insert-math \leq。它确实有效,但它会阻止输入<方程式。
  • 我注意到在“工具”->“首选项”->“编辑”->“输入完成”下有一个启用自动更正的选项。但是当我选中该框并应用新设置时,它似乎什么也没做。
    即使它确实做了,我也不清楚如何根据自己的需要设置自动更正。不过,我autocorrect在 中发现了一个有趣的文件,名为C:\Program Files (x86)\LyX 2.3\Resources。该文件的内容似乎与我要做的事情有关。

这里是:

#
# Idea of "autocorrection" and parts of this file are shamelessly stolen
# from TeXMacs (they give [email protected] as contact)
#
# We do it a bit differently and allow corrections only to combine a symbol
# and a char to a new symbol.
#
#

|                 ,    \lfloor
\lfloor           *    |,
|                 '    \lceil
\lceil            *    |'
,                 |    \rfloor
\rfloor           *    ,|
'                 |    \rceil
\rceil            *    '|
\llbracket        *    [[*
\rrbracket        *    ]]*

\cap              *    \sqcap
\cup              *    \sqcup
\vee              *    \curlyvee
\curlyvee         *    \curlyveeuparrow
\curlyveeuparrow  *    \curlyveedownarrow

<                 /    \nless
>                 /    \ngtr
<                 =    \leqslant
>                 =    \geqslant
\leqslant         /    \nleqslant
\geqslant         /    \ngeqslant
\leqslant         *    \leq
\geslant          *    \geq
\leq              /    \nleq
\geq              /    \ngeq
<                 <    \ll
\ll               <    \lll
>                 >    \gg
\gg               >    \ggg
\ll               =    \lleq
\lll              =    \llleq
\gg               =    \ggeq
\ggg              =    \gggeq
\ll               /    \nll
\lll              /    \nlll
\gg               /    \ngg
\ggg              /    \nggg
\lleq             /    \nlleq
\llleq            /    \nllleq
\ggeq             /    \nggeq
\gggeq            /    \ngggeq
<                 .    \lessdot
.                 >    \gtrdot
\leqslant         .    \lesseqdot
\gtrdot           =    \gtreqdot

<                 *    \prec
>                 *    \succ
\prec             /    \nprec
\succ             /    \nsucc
\prec             =    \preccurlyeq
\succ             =    \succcurlyeq
\preccurlyeq      /    \npreccurlyeq
\succcurlyeq      /    \nsucccurlyeq
\preccurlyeq      *    \preceq
\succcurlyeq      *    \succeq
\preceq           /    \npreceq
\succeq           /    \nsucceq
\npreceq          *    \precneqq
\nsucceq          *    \succneqq
\ll               *    \precprec
\precprec         *    \precprecprec
\gg               *    \succsucc
\succsucc         *    \succsuccsucc
\precprec         =    \precpreceq
\lll              *    \precprecprec
\precprecprec     =    \precprecpreceq
\succsucc         =    \succsucceq
\ggg              =    \succsuccsucc
\succsuccsucc     =    \succsuccsucceq
\precprec         /    \nprecprec
\precprecprec     /    \nprecprecprec
\succsucc         /    \nsuccsucc
\succsuccsucc     /    \nsuccsuccsucc
\precpreceq       /    \nprecpreceq
\precprecpreceq   /    \nprecprecpreceq
\succsucceq       /    \nsuccsucceq
\succsuccsucceq   /    \nsuccsuccsucceq

\prec             .    \precdot
\succ             .    \dotsucc
\precdot          .    \preceqdot
\dotsucc          .    \dotsucceq
\precprec         *    \llangle
\succsucc         *    \rrangle

<                 >    \lessgtr
>                 <    \gtrless
<                 ~    \lesssim
\lesssim          ~    \lessapprox
\prec             ~    \precsim
\precsim          ~    \precapprox
>                 ~    \gtrsim
\gtrsim           ~    \gtrapprox
\succ             ~    \gtrsim
\gtrsim           ~    \gtrapprox
\leq              *    \leqq
\geq              *    \geqq
\leq              >    \lesseqgtr
\geq              <    \gtrqless

-                 >    \rightarrow
<                 -    \leftarrow
\leftarrow        >    \leftrightarrow
\rightarrow       -    \longrightarrow
\leftarrow        -    \longleftarrow
\longleftarrow    >    \longleftrightarrow
=                 >    \Rightarrow


@                 *    \circ
\circ             /    \varnothing
\circ             +    \oplus
\circ             -    \ominus
@                 x    \otimes
\circ             :    \oover
\circ             .    \odot
@                 R    \circledR
@                 S    \circledS
\varnothing       *    \oslash
@                 \    \obslash
@                 @    \infty
\circ             <    \olessthan
\circ             >    \ogreaterthan
\circ             &    \owedge
\circ             |    \obar
\obar             *    \ovee
\circ             v    \ovee
\circ             @    \infty
@@                *    \varocircle
-@                @    \infty
\circ             *    \box
\box              +    \boxplus
\box              -    \boxminus
\box              x    \boxtimes
\box              .    \boxdot
\box              /    \boxslash
\box              \    \boxbslash
\box              @    \boxcircle
\boxcircle        *    \boxbox
\box              |    \boxbar
\box              *    \bullet
\bullet           *    \blacksquare

=                 *    \asymp
\asymp            *    \equiv
\equiv            *    \asympasymp
\asympasymp       *    \simsim
~                 *    \sim
\sim              ~    \approx
\approx           -    \approxeq
\sim              -    \simeq
\sim              =    \cong
=                 /    \neq
\asymp            /    \nasymp
\equiv            /    \nequiv
\asympasymp       /    \nasympasymp
\simsim           /    \nsimsim
\sim              /    \nsim
\approx           /    \napprox
\simeq            /    \nsimeq
\cong             /    \ncong

#|   \|
|                 *    \shortmid
\shortmid         *    \varshortmid
|                 |    \||
\||               |    \interleave
\||               *    \shortparallel
|                 -    \vdash
\vdash            -    \longvdash
\||               -    \Vdash
\Vdash            -    \longVdash
\interleave       -    \Vvdash
\Vvdash           -    \longVvdash
-                 |    \dashv

<                 |    \vartriangleleft
\vartriangleleft  *    \blacktriangleleft
\vartriangleleft  /    \ntriangleleft
\vartriangleleft  =    \trianglelefteqslant
\trianglelefteqslant / \ntrianglelefteqslant
\trianglelefteqslant * \trianglelefteq
\trianglelefteq   /    \ntriangleqleft
|                 >    \vartriangleright
\vartriangleright *    \blacktriangleright
\vartriangleright /    \ntriangleright
\vartriangleright =    \trianglerighteq
\trianglerighteq  /    \ntriangleqright
\trianglerighteq  *    \trianglerighteqslant
\trianglerighteqslant  /    \ntrianglerighteqslant

-                 *    \um
+                 -    \pm
\pm               *    \upm
-                 +    \mp
\mp               *    \ump
@                 =    \circeq
=                 @    \eqcirc
-                 @    \multimap
.                 =    \doteq
.                 .    \ldots
\ldots            *    \cdots
\cdots            *    \hdots
\hdots            *    \vdots
\ddots            *    \ddots
\iddots           *    \iddots
\udots            *    \udots
:                 =    \assign
+                 =    \plusassign
-                 =    \minusassign
/                 *    \div
*                 *    \ast
\ast              *    \times
\times            *    \cdot

<                 *    \subset
\subset           *    \in
\in               *    \sqsubset
\subset           =    \subseteq
\subseteq         /    \nsubseteq
\subseteq         *    \subseteqq
\sqsubset         *    \langle
\langle           *    \leftslice
\leftslice        *    \subset

\subseteq         /    \nsubseteq
\subseteqq        /    \nsubseteqq
\nsubseteqq       *    \subsetneq
\subsetneq        *    \varsubsetneq
\varsubsetneq     *    \subsetneqq
\subsetneqq       *    \varsubsetneqq
\subset           +    \subsetplus
\subsetplus       =    \subsetpluseq
\subseteq         +    \subsetpluseq
\in               /    \nin
>                 *    \supset
\supset           /    \nsupset
\supset           =    \supseteq
\supseteq         /    \nsupseteq
\supseteq         *    \supseteqq
\supseteq         /    \nsupseteq


\supseteqq        /    \nsupseteqq
\supseteq         /    \supsetneq
\supset           +    \supsetplus
\supsetplus       =    \supsetpluseq
\supseteq         +    \supsetpluseq
\supset           *    \ni
\ni               /    \nni

#
# The following is available in TeXMacs, but not (yet) in LyX
#

#--|    \longdashv
#|           =    \vDash
#\vDash      =    \longvDash
#||=    \VDash
#||==    \longVDash
#|           /    \nmid
#||/    \nparallel
#|*/    \nshortmid
#||*/    \nshortparallel
#|-/    \nvdash
#||-/    \nVdash
#-|/    \ndashv
#-||/    \ndashV
#|=/    \nvDash
#||=/    \nVDash
#=|/    \nDashv
#=||/    \nDashV
#
#<=**>    \lesseqqgtr
#>=**<    \gtreqqless
#<>/   \nlessgtr
#></   \ngtrless
#<~/   \nlesssim
#<~/*    \lnsim
#<~~/    \nlessapprox
#<~~/*    \lnapprox
#<*~/    \nprecsim
#<*~/*    \precnsim
#<*~~/    \nprecapprox
#<*~~/*    \precnapprox
#>~/   \ngtrsim
#>~/*    \gnsim
#>~~/    \ngtrapprox
#>~~/*    \gnapprox
#>*~/   \nsuccsim
#>*~/*    \succnsim
#>*~~/    \nsuccapprox
#>*~~/*    \succnapprox
#<=**/    \nleqq
#>=**/    \ngeqq
#<=*>/    \nlesseqgtr
#>=*</    \ngtreqless
#<=**>/    \nlesseqqgtr
#>=**</    \ngtreqqless
#<=*/*    \lneq
#<=**/*    \lneqq
#<=**/**    \lvertneqq
#>=*/*    \gneq
#>=**/*    \gneqq
#>=**/**    \gvertneqq
#[[                *    \llbracket
#]]                *    \rrbracket
#EE                a    \amalg
#EE                d    \partial
#EE                p    \wp
#EE                n    \cap
#EE                u    \cup
#EE                w    \wedge
#\wedge            *    \curlywedge
#\curlywedge       *    \curlywedgeuparrow
#\curlywedgeuparrow   * \curlywedgedownarrow
#\curlywedgedownarrow * \wedges
#EE                v    \vee
#EE                x    \times

# <***/    \nsqsubset
# <***=    \sqsubseteq
# <***=/    \nsqsubseteq
# >*=/**    \varsupsetneq
# >*=*/*    \supsetneqq
# >*=*/**    \varsupsetneqq
# >***    \sqsupset
# >***/    \nsqsupset
# >***=    \sqsupseteq
# >***=/    \nsqsupseteq

# >****    \rangle
# \rangle  *     \rightslice

# EE                l    \bigl
# EE                m    \bigm
# EE                r    \bigr
# EE                @    \bigop
# EE                L    \int
  • 最后,我找到了这个帖子, 自动将 `<=` 转换为 `\leq`,这表明了另一种方法,即在编译期间替换相应的字符串。但是,这与我尝试做的完全不同,因为它效率低下,而且容易出错。我想<=\leq输入时替换。

所以我希望我的问题表达得足够清楚,如果你能帮我找到解决方案,我将不胜感激。谢谢。

答案1

我实际上找到了两个解决方案。一个是变通方法,另一个使用 LyX 自动更正功能。

  1. 可以下载并安装自动文本替换工具,例如短语表达和开源牛肉文本
  2. 我上面发布的文件确实相关。您可以转到Tools -> Preferences -> Editing -> Input Completion并选中复选框Autocorrection。按确定。之后,创建一个新方程式,然后输入<=。您会注意到,在左下角有一条消息Autocorrect Off ('!' to enter)。因此,请按照说明并按SHIFT+!。现在自动更正已激活,并且像这样的短语<=将被替换为\leq

相关内容