# Wag the PhDog

## October 23, 2008

Filed under: Uncategorized — phbenito @ 10:59 pm
Tags: , , , , , ,

Pascual Benito, Oct., 2008

phbenito[at]gmail[dot]com

# Example of Text with Equations

The quadratic formula is a second order polynomial equation in one variable, its general form is
where x is the variable and a, b, and c are constants, and a0.Since a quadratic equation is a second degree polynomial equation, then the fundamental theorem of algebra states that two complex roots exist, counting multiplicity.

There are various analytical methods used for finding the roots of quadratic equations, one of the most common methods is the so-called quadratic formula and is derived by completing the square on the general expression shown above. The quadratic formula may be written thus,

# Instructions

I use one of the following online LaTex Equation Editors (open in another browser window) to compose the equation and also to turn the LaTex code into an image (see screen capture image below):

http://thornahawk.unitedti.org/equationeditor/equationeditor.php

http://www.codecogs.com/components/equationeditor/equationeditor.php

They are useful tools for composing equations and the appropriate LaTeX code, even if you are not familiar with LaTeX.

There are slightly different instruction for inserting your equation depending on the Internet Browser you are using:

## Firefox

After creating the equation in the editor, hit “Render Expression”, then place the mouse over the image of the equation, right-click and choose “Copy Image Location”. Then in Google Docs, choose “Insert Picture”, and select the “From the web (URL)” radio button. Paste the image URL and click OK. This will insert the image into the document.

## Internet Explorer (verified with IE7)

After creating the equation in the editor, hit “Render Expression”, then place the mouse over the image of the equation, right-click and choose “Copy”. Then in Google Docs, choose “Paste”, and this will insert the image into the document.

## Editing an Existing Equation?

If you need to edit the equation again later, you will need to go back to the external Equation Editor to do that. There is no easy work around for this right now. So what I do is “save” the equation by pasting it into a “Footnote” in Google Docs, then I can always paste it back into the editor and fix anything, and repeat the image insert process above.

Figure 1: Screen capture of the equation editor open, and pasting in the equation image URL into the Google Docs “InsertPicture” dialog box.

Figure 2. Here is a screen capture of this document as viewed while being edited.

Note that a similar approach for inserting equations can be used in Google Spreadsheets or Google Presentation.

# Advanced technique: composing the equation right in the document html

If you’re comfortable playing with the html of the file and with the latex codes, you can actually insert the equation LaTeX code or image link directly into the document’s html (choose “Edit→HTML”), as shown with the html snippet below (the equation itself has been highlighted in red):

<img src=”http://www.codecogs.com/gif.latex?x=frac{beta}{y}” alt=”x=frac{beta}{y}”/>

then you can actually have the equation embedded in the source, and can update the equation image just by editing the latex code there (so if you were to look at the html for this document you would see the embedded equation html and LaTeX codes) that create the following equation:



# Arrays & Matrices

Arrays, vectors, matrices, etc… can either be generated using the LaTeX equation editor methods described above, or you can also use nested table inserts to represent arrays as follows:

First shown with the cell borders in green so you can see the underlying table structure (note I set the table width to “fit to content”)

A =
 a11 a12 a13 a21 a22 a23 a31 a32 a33

and then without the table borders as it might be displayed:

A =
 a11 a12 a13 a21 a22 a23 a31 a32 a33

# Inserting Greek Letters and other Mathematical Symbols into the text

The Symbol font is not currently available in Google Docs, but you can get around this in a couple of ways.

Cut/Paste from a document with a “pre-existing” palette of symbols. Here is one based on

(SGML character entities supported by most modern browsershttp://www.zipcon.net/~swhite/docs/math/math.html)

Most of the Greek alphabet:

α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω ϑ ϒ ϖ

a fairly rich selection of math symbols:

∀ ∴ ∃ ¬ ∋ ∅ ∈ ∉ ∧ ∨ ∩ ∪ ∂ ∇ ∏ ∑ ∫ √ − ∗ × ÷ ⋅ ± ⊕ ⊗ ∝ ∞ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ∠ ⊥

arrows:

← ↑ → ↓ ↔ ↵ ⇐ ⇒ ⇓ ⇔

fancier brackets:

⌈ ⌉ ⌊ ⌋ 〈 〉

a few fancy script letters:

ℵ ℘ ℑ ℜ µ

and these:

◊ ♠ ♣ ♥ ♦

Note, that the appearance of the symbol characters changes depending on the font used (above is Verdana). But they would look slightly different, more elegant and formal perhaps, with “Serif”.

Or you can also use the Google Docs command “insertSpecial CharacterAdvanced” to enter the Unicode number for a symbol. (e.g. ∭ was inserted by:

See this link for a comprehensive list of Unicode symbols that you can paste/insert into Docs.

You can also use that same link as a “palette” and just cut/paste from there to your document.

# General Suggestions

I suggest making an equation and symbol “library” document where you keep a collection of all your most commonly used equations and symbols, then you can just copy and paste from here into your current document. You could actually make a “template” document that has the palette of symbols in it, and use this as the starting point for all your new documents.

Caveat Emptor: for all the LaTeX methods outlined above when you export the doc to another format such as Word, or Open Office, etc., the equations will be saved as images and you will not be able to edit them again (except by re-creating them in that program). This does not apply to inserted symbols.