简体   繁体   English

Unix:替换所有奇数 与\\ left | 甚至 与\\ right |

[英]Unix: replace every odd | with \left| and every even | with \right|

An enormous equation. 一个巨大的方程式。 You need to add \\left| 您需要添加\\left| on the left side of corresponding | 在对应的|左侧 . The corresponding | 对应| you need to replace with \\right| 您需要替换为\\right| .

Equation 方程

\begin{equation}
| \Delta w_{0} | = \frac{|w_{0}|}{2} \left( |\frac{\Delta g}{g}|+|\frac{\Delta (\Delta r)}{\Delta r}| + |\frac{\Delta r}{r}| +|\frac{\Delta L}{L}| \right)
\end{equation}

[Premises] [处所]

  1. The amount of | 金额| is even. 甚至。
  2. No nesting. 没有嵌套。 So scenario such as M_OPEN|----X_OPEN|-----X_CLOSED|------M_CLOSED| 因此,例如M_OPEN|----X_OPEN|-----X_CLOSED|------M_CLOSED| is not possible, just M_OPEN|---M_CLOSED|---H_OPEN|----H_CLOSED| 不可能,只是M_OPEN|---M_CLOSED|---H_OPEN|----H_CLOSED| .
 sed -r -e 's/\|([^|]+)\|/\\left|\1\\right|/g'

但这仅在没有嵌套| ... |的情况下有效。

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

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