Copying Equations from Wikipedia into Office Applications

The post LaTeX Math in Office describes how to switch between UnicodeMath and LaTeX in Office apps. One handy use of this facility is in copying equations from Wikipedia into a Word document. The process isn’t as simple as selecting the equation, typing Ctrl+C to copy it and Ctrl+V to paste it into your document, although that would be nice! Wikipedia equations are usually images (png’s) with LaTeX alt text. So, copy the alt text into a math zone and build it up in LaTeX mode.

To get the alt text for an equation image, type F12 in your browser (I use Edge for this). This turns on a window with source browsing capabilities. At the top left side is the inspect tool, a little arrow with a rectangle. Click on the inspect tool and then on an equation. Let’s illustrate using the time-dependent Schrödinger equation, which is described nicely in Wikipedia. We see the figure

Copy the text highlighted in blue. This gives the HTML for the equation image

<img class="mwe-math-fallback-image-inline" aria-hidden="true" style="vertical-align: -2.505ex; width:41.97ex; height:6.343ex;" alt="i\hbar {\frac {\partial }{\partial t}}\Psi (\mathbf {r} ,t)=\left[{\frac {-\hbar ^{2}}{2\mu }}\nabla ^{2}+V(\mathbf {r} ,t)\right]\Psi (\mathbf {r} ,t)" src="">

The image alt text is given by the alt="…" field. The LaTeX for the equation is inside the "…". Copy the LaTeX into a Word math zone and build it up in LaTeX mode (type Ctrl+=). You then see

which looks the same as in the browser aside from a change in font.

Back in 2009 I gave a lecture featuring highlights of my PhD advisor Willis Lamb’s life work. I knew his laser theory contributions quite well having written papers and a book with him on laser theory. But I didn’t know his Nobel-prize work on the Lamb shift or his theory of the Mössbauer effect very well. So, I read up on these phenomena in Wikipedia, copied the LaTeX for some equations into an alpha version of PowerPoint 2010, and built them up using an early version of the LaTeX converter code. I gave the lecture at a memorial symposium for Lamb at the University of Arizona’s Optical Sciences Department, wondering if anyone would ask how I prepared the equations in the slides. It was more than a year before Office Math shipped in PowerPoint. Fortunately, no one asked. Perhaps people assumed I had used images from Word or LaTeX. (But how then could the background match the slide pattern so well? ☺)