### Real Vim ninjas count every keystroke - do you?

###### Pick a challenge, fire up Vim, and show us what you got.

Your VimGolf key: please sign in

$gem install vimgolf$ vimgolf setup
\$ vimgolf put 510a052c6db41b0002000028


### LaTeX to XML Math Delimiters

Vim is amazing when used to edit MediaWiki text, but typing "$. . .$" can be tiresome and frustrating if formulas are used often. LaTeX delimiters are so concise and even come in two flavors: "$$. . .$$" for inline math and "$. . .$" for centered formulas. The goal is to perform the following conversions: "$$. . .$$" becomes "$. . .$" "$. . .$" becomes "<center>$. . .$</center>"

##### Start file
Given two vectors $$\vec{x}$$ and $$\vec{y}$$ in $$\mathbb{R}^n$$,
their '''dot product''' or '''inner product''' is defined as the following:

$\sum_{i=0}^{n} x_i \, y_i$

----

Integration by parts is another way of writing the product rule of differentiation.
For two functions $$f(x)$$ and $$g(x)$$, the following are equivalent:

\begin{align} \frac{\mathrm{d}}{\mathrm{d}x} \left( f(x) \, g(x) \right) &= f'(x) \, g(x) + f(x) \, g'(x) \\ \int f(x) \, g'(x) \, \mathrm{d}x &= f(x) \, g(x) - \int f'(x) \, g(x) \, \mathrm{d}x \end{align}

----

Matrix multiplication is not commutative

\begin{align} \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \, \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} &\ne \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} \, \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \\ \begin{bmatrix} a_{11} \, b_{11} + a_{12} \, b_{21} & a_{11} \, b_{12} + a_{12} \, b_{22} \\ a_{21} \, b_{11} + a_{22} \, b_{21} & a_{21} \, b_{12} + a_{22} \, b_{22} \end{bmatrix} &\ne \begin{bmatrix} a_{11} \, b_{11} + a_{21} \, b_{12} & a_{12} \, b_{11} + a_{22} \, b_{12} \\ a_{11} \, b_{21} + a_{21} \, b_{22} & a_{12} \, b_{21} + a_{22} \, b_{22} \end{bmatrix} \begin{align}

''Quod erat demonstrandum''.

##### End file
Given two vectors $\vec{x}$ and $\vec{y}$ in $\mathbb{R}^n$,
their '''dot product''' or '''inner product''' is defined as the following:

<center>$\sum_{i=0}^{n} x_i \, y_i$</center>

----

Integration by parts is another way of writing the product rule of differentiation.
For two functions $f(x)$ and $g(x)$, the following are equivalent:

<center>\begin{align} \frac{\mathrm{d}}{\mathrm{d}x} \left( f(x) \, g(x) \right) &= f'(x) \, g(x) + f(x) \, g'(x) \\ \int f(x) \, g'(x) \, \mathrm{d}x &= f(x) \, g(x) - \int f'(x) \, g(x) \, \mathrm{d}x \end{align}</center>

----

Matrix multiplication is not commutative

\begin{align} \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \, \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} &\ne \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} \, \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \\ \begin{bmatrix} a_{11} \, b_{11} + a_{12} \, b_{21} & a_{11} \, b_{12} + a_{12} \, b_{22} \\ a_{21} \, b_{11} + a_{22} \, b_{21} & a_{21} \, b_{12} + a_{22} \, b_{22} \end{bmatrix} &\ne \begin{bmatrix} a_{11} \, b_{11} + a_{21} \, b_{12} & a_{12} \, b_{11} + a_{22} \, b_{12} \\ a_{11} \, b_{21} + a_{21} \, b_{22} & a_{12} \, b_{21} + a_{22} \, b_{22} \end{bmatrix} \begin{align}

''Quod erat demonstrandum''.


#### View Diff

1c1
< Given two vectors $$\vec{x}$$ and $$\vec{y}$$ in $$\mathbb{R}^n$$,
---
> Given two vectors $\vec{x}$ and $\vec{y}$ in $\mathbb{R}^n$,
4c4
< $\sum_{i=0}^{n} x_i \, y_i$
---
> <center>$\sum_{i=0}^{n} x_i \, y_i$</center>
9c9
< For two functions $$f(x)$$ and $$g(x)$$, the following are equivalent:
---
> For two functions $f(x)$ and $g(x)$, the following are equivalent:
11c11
< \begin{align} --- > <center>\begin{align} 14c14 < \end{align} --- > \end{align}</center>
20c20
< $$--- > $48c48 <$$ --- >$


### Solutions by @I_haveno_name:

Unlock 3 remaining solutions by signing in and submitting your own entry

## 18 active golfers, 40 entries

##### Solutions by @I_haveno_name:
91
###### #10 - hiding / @I_haveno_name

10/22/2013 at 01:12PM

104
###### #>16 - hiding / @I_haveno_name

10/22/2013 at 01:03PM

104
###### #>16 - hiding / @I_haveno_name

10/22/2013 at 01:14PM