Gridgen User Guide

Gridgen is a visual calculator for guitar chords. It's capable of manipulating chords, inferring chord symbols, rendering chord grids to SVGs, and embedding SVGs in HTML documents. Here's an example output.

C 1 chord 6 8 1 + 5 10 5 + 3 9 3 + 2 12 7 x C 4 chord 5 8 1 + 4 10 5 + 3 9 7 x 2 10 3 + over d- over d- over d- over d- over d- over d- am

Gridgen content appears within HTML elements with the “gridgen” class. Each element's textContent is interpreted as a chord calculation expression, the result of which replaces that element in the document, to be styled with CSS. This User Guide is an example. Consult the source to see how it's constructed.

These chord manipulations and diagrams are based on the works of Ted Green.

Examples

Tunes

References

Representation

Each Chord has a specified key and degree within that key. For example a G chord might have degree 1 in the key of G, degree 4 in the key of D, or degree 5 in the key of C. This is to ensure that manipulations on that chord are performed diatonically within its key.

Similarly, each Stop has a specified interval within its chord. For example, an E stop in a C chord would have interval 3. This is to ensure that chord symbols can be correctly inferred, even after chord manipulation. A C chord that marks an E♭ with an interval of 3 would be noted Cmi.

Operations

Introduction

Here's a minimal example to get started. The expression F 4 chord 4 8 1 + 3 7 3 + 2 6 5 + produces F 4 chord 4 8 1 + 3 7 3 + 2 6 5 +

This is a postfix expression. Its evaluation uses a stack. It proceeds as follows:

At the end of all of this, the chord remains on the stack. It is converted to an HTML element and inserted into the document.

Chord Constructor

‹key› ‹degree› chord
Create a new chord and push it onto the stack. ‹Key› is a symbol like C or B♭ and ‹degree› is the chord degree in the range 1 to 7. This is the fundamental constructor of Gridgen chords and all other operators operate on these.

Gridgen only accepts keys with up to 7 flats, or 7 sharps. No key with double flats or double sharps in the signature is recognized. Even with this restriction, there are a few enharmonic keys.

1 2 3 4 5 6 7
C♯ · · ·C♯D♯E♯F♯G♯A♯B♯=D♭
F♯ · · ·F♯G♯A♯B C♯D♯E♯=G♭
B · · ·B C♯D♯E F♯G♯A♯=C♭
E · · ·E F♯G♯A B C♯D♯
A · · ·A B C♯D E F♯G♯
D · · ·D E F♯G A B C♯
G · · ·G A B C D E F♯
C · · ·C D E F G A B
F · · ·F G A B♭C D E
B♭ · · ·B♭C D E♭F G A
E♭ · · ·E♭F G A♭B♭C D
A♭ · · ·A♭B♭C D♭E♭F G
D♭ · · ·D♭E♭F G♭A♭B♭C =C♯
G♭ · · ·G♭A♭B♭C♭D♭E♭F =F♯
C♭ · · ·C♭D♭E♭F♭G♭A♭B♭=B

Chord Attribute Operators

These operators add attributes to chords. The most important of these attributes are the stops that define the notes of the chord. Greene notation uses five distinct symbols, the dot, X, square and diamond, to be played in that order. An open circle is an optional stop. (CC p.?)

The stop appears at the given ‹string› and ‹fret›. The stop's voice within the chord has ‹interval› in the range 1 to 7. These values are popped from the stack, and the ‹chord› operand is pushed back onto the stack after the attribute is set.

‹chord› ‹string› ‹fret› ‹interval› +
Add a dot stop to a chord.
‹chord› ‹string› ‹fret› ‹interval› x
Add an X stop to a chord.
‹chord› ‹string› ‹fret› ‹interval› =
Add a square stop to a chord.
‹chord› ‹string› ‹fret› ‹interval› ^
Add a diamond stop to a chord.
‹chord› ‹string› ‹fret› ‹interval› o
Add a circle stop to a chord.
‹chord› ‹string› ‹fret› ‹interval› _
Add a blank stop to a chord. A blank stop does not appear on the grid, but it can be used to influence alignment operations and symbol inference. For example, if a chord voicing omits the root, then the symbol inference will likely fail for lack of information. Adding a root using a blank stop informs the inference without altering the appearance.
‹chord› ‹string› ‹fret› ‹interval› (+) or (x) or (=) or (^) or (o) or (_)
Add a “decoration” stop to a chord. Decoration stops appear exactly like their counterparts above, but they do not contribute to the chord symbol. They may be used to notate a melody or bass line without altering the tune's basic changes.
‹chord› ‹string› ‹fret› ‹interval› ‹label› .
Add a stop with an arbitrary label to a chord. See Arbitrary stop labels for examples.

Chord Option Operators

Chord options determine how chords are displayed.

‹chord› $
Omit the chord symbol.
‹chord› *
Mark the chord as optional. The chord's symbol will be shown in parentheses.
‹chord› ‹text› !
Add a small text appearing beneath a chord. This can be used to annotate a chord with a description or performance notes. See Noting time for examples.
‹chord› ‹string› ‹finger› #
Add a finger number at the bottom of a chord. There is at most one number shown per ‹string›. ‹Finger› is usually a number between 1 and 4.
‹chord› ‹first› ‹last› -
Set ‹first› and ‹last› frets for a chord display grid. These values will be overwritten by any subsequent use of af or am.

Chord Manipulation Operators

The following operations replace the chord at the top of a stack with the result of a calculation based on that chord.

‹chord› s+
Replace ‹chord› with the chord on the next higher set of strings (higher in number, not in pitch). The chord is moved up 5 frets. (MCP p.18)
‹chord› s-
Replace ‹chord› with the chord on the next lower set of strings. The chord is moved down 5 frets. (MCP p.19)
‹chord› d+
Replace ‹chord› with the next higher chord in the diatonic chord scale, e.g. Cma7 becomes Dmi7. (MCP p.17)
‹chord› d-
Replace ‹chord› with the next lower chord in the diatonic chord scale, e.g. Cma7 becomes Bmi7♭5. (MCP p.17)
‹chord› f+
Replace ‹chord› with the chord transposed to the key one fret higher, e.g. Cma7 becomes C♯ma7. Enharmonic keys: C → C♯, F → F♯.
‹chord› f-
Replace ‹chord› with the chord transposed to the key one fret lower, e.g. Cma7 becomes Bma7. Enharmonic keys: E → D♭, G → G♭.
‹chord› i+
Replace ‹chord› with the next higher chord in the systematic inversion. (CC p.9)
‹chord› i-
Replace ‹chord› with the next lower chord in the systematic inversion. (CC p.9)
‹chord› o+
Replace ‹chord› with the chord on the same strings, one octave higher.
‹chord› o-
Replace ‹chord› with the chord on the same strings, one octave lower.
‹chord› 4+
Replace ‹chord› with the chord a fourth higher, on the next lower set of strings. Cma7 rooted on 5 becomes Fma7 rooted on 4. This is an abbreviation for d+ d+ d+ s-.
‹chord› 5-
Replace ‹chord› with the chord a fifth lower, on the next higher set of strings. Cma7 rooted on 5 becomes G7 rooted on 6. This is an abbreviation for d- d- d- d- s+.

It's possible for these operations to produce an “invalid” chord—a chord that uses negative fret numbers or non-existent strings. Such invalid chords are well-defined, and useful as temporary values. However, if they are displayed, they might appear impossible.

‹A› ‹B› ?
If chord ‹A› is valid, leave only ‹A› at the top of the stack. Otherwise, leave only ‹B› at the top of the stack. See below for examples.

Chord Alignment Operators

Chord alignment operators take a sequence of chords, equalize their size, and align them visually.

‹· · ·› af
Align all of the chords on the stack by fret. Specifically, set the bounds of each grid to the same value across all chords. Stretch the grid to accommodate a wide range.
‹· · ·› am
Align all of the chords on the stack by mark. Specifically, set the bounds of each grid such that the marked fret (usually the root) lies in the same position in all chords.

This is almost always desirable, as each unaligned grid is displayed with minimal size. As a group, they will appear visually inconsistent.

HTML Structure Operators

These operators enable the construction of arbitrary HTML entities and parent-child relationships. Most any HTML structure may be produced, but table structures are particularly useful. See the examples below.

( ‹· · ·› ‹tag› )
Pop the operands between the ( and ) and push a new HTML ‹tag› element containing them all. Given N operands, this operator leaves one Element with N children on the stack.
[ ‹· · ·› ‹tag› ]
Pop the operands between the [ and ] and push a new HTML ‹tag› element containing each. Given N operands, this operator leaves N Elements with 1 child on the stack.
‹element› ‹class› class
Add the ‹class› to the ‹element›, leaving the ‹element› on the stack.

HTML Shortcuts

|:
Push a span element containing a left repeat sign. This is an abbreviation for ( 𝄆 span ) bar class.
|
Push a span element containing a bar marker. This is an abbreviation for ( 𝄀 span ) bar class.
:|
Push a span element containing a right repeat sign. This is an abbreviation for ( 𝄇 span ) bar class.

General Stack Operators

These operators are similar to those of the Forth programming language.

‹A› drop
Pop the top element from the stack.
‹A› dupe
Duplicate the top element on the stack. The stack will contain ‹A› ‹A›.
‹A› ‹B› swap
Swap the top two elements on the stack. The stack will contain ‹B› ‹A›.
‹A› ‹B› over
Duplicate the second element to the top of the stack. The stack will contain ‹A› ‹B› ‹A›.

Samples

The following is a list of gridgen examples. To see how each is defined, examine the HTML source of this document.

Arbitrary Stop Labels

The . operator adds a stop with an arbitrary character label. This has countless uses. For example, it may be used to indicate the fingering of a scale. This being the web, all of Unicode is at your disposal here.

D 1 chord $ 6 2 3 1 . 6 3 4 2 . 6 5 5 4 . 5 2 6 1 . 5 4 7 3 . 5 5 1 4 . 4 2 2 1 . 4 4 3 3 . 4 5 4 4 . 3 2 5 1 . 3 4 6 3 . 2 2 7 1 . 2 3 1 2 . 2 5 2 4 . 1 2 3 1 . 1 3 4 2 . 1 5 5 4 . D 1 chord $ 6 2 3 🍏 . 6 3 4 🍎 . 6 5 5 🍊 . 5 2 6 🍋 . 5 4 7 🍋‍🟩 . 5 5 1 🍌 . 4 2 2 🍉 . 4 4 3 🍇 . 4 5 4 🍓 . 3 2 5 🫐 . 3 4 6 🍈 . 2 2 7 🍒 . 2 3 1 🍑 . 2 5 2 🥭 . 1 2 3 🍍 . 1 3 4 🥥 . 1 5 5 🥝 .

Noting Time

Greene frequently used slashes beneath the chord grid to indicate the number of beats that a chord is played (CC p.58). This can be accomplished using the ! operator.

F 4 chord 6 7 1 + 4 7 7 + 3 7 3 + 1 5 7 + 2 6 5 x 6 2 # 4 3 # 3 4 # 2 1 # 1 1 # // ! F 4 chord 6 6 1 + 4 6 7 + 3 6 3 + 2 5 5 + 6 2 # 4 3 # 3 4 # 2 1 # / ! F 3 chord 6 5 1 + 4 5 7 + 3 5 3 + 2 8 7 + 2 5 5 x 6 1 # 4 1 # 3 1 # 2 4 # // ! F 3 chord 6 4 1 + 4 4 7 + 3 4 3 + 2 4 5 + 6 1 # 4 1 # 3 1 # 2 1 # / ! F 2 chord 6 3 1 + 4 3 7 + 3 3 3 + 2 6 7 + 2 3 5 x 6 1 # 4 1 # 3 1 # 2 4 # // ! F 4 chord 6 8 2 (+) 4 8 1 + 3 7 3 + 2 6 5 + 6 3 # 4 4 # 3 2 # 2 1 # / ! F 1 chord 5 8 1 + 4 7 3 + 3 9 7 + 2 8 2 + 5 2 # 4 1 # 3 4 # 2 3 # /// ! af

Alternatively, bar markers can indicate full measures, and can imply beat count, They also provide the opportunity to add repeat markers. For example, here's the melody and accompaniment to the lyric “You say to-ma-to, I say to-mah-to.”

|: G 1 chord 6 3 1 + 4 5 1 + 3 4 3 + 2 5 6 + 1 3 1 + 2 5 6 x 6 1 # 4 3 # 3 2 # 2 4 # 1 1 # G 6 chord 5 7 1 + 4 5 3 + 3 7 7 + 2 7 2 + 2 7 2 x 2 5 1 = 5 2 # 4 1 # 3 3 # 2 4 # | G 2 chord 6 5 1 + 4 5 7 + 3 5 3 + 2 8 7 + 1 5 1 x 6 1 # 4 1 # 3 1 # 2 4 # 1 1 # G 5 chord 5 5 1 + 4 7 5 + 3 5 7 + 2 5 2 _ 2 7 3 + 1 7 6 + 1 7 6 x 5 1 # 4 2 # 3 1 # 2 3 # 1 4 # :| af

Overlaying Stops

Overlaid stops appear when an elaboration or a melody reuses a chord tone. The “to-ma-to, to-mah-to” sequence just above is an example.

Order sometimes matters. Stops are displayed in the order they are added to a chord. Later stops are displayed topmost. Here's a grid showing each of the standard markers—dot, circle, X, square, and diamond—overlaid with each other standard marker. It should be clear that dot and X should appear on top, while square, diamond, and circle must appear on the bottom.

C 1 chord $ 5 3 1 + 4 3 1 o 3 3 1 x 2 3 1 = 1 3 1 ^ 5 4 1 + 4 4 1 o 3 4 1 x 2 4 1 = 1 4 1 ^ 6 4 1 + 5 4 1 + 4 4 1 + 3 4 1 + 2 4 1 + 1 4 1 + 5 5 1 + 4 5 1 o 3 5 1 x 2 5 1 = 1 5 1 ^ 6 5 1 o 5 5 1 o 4 5 1 o 3 5 1 o 2 5 1 o 1 5 1 o 5 6 1 + 4 6 1 o 3 6 1 x 2 6 1 = 1 6 1 ^ 6 6 1 x 5 6 1 x 4 6 1 x 3 6 1 x 2 6 1 x 1 6 1 x 5 7 1 + 4 7 1 o 3 7 1 x 2 7 1 = 1 7 1 ^ 6 7 1 = 5 7 1 = 4 7 1 = 3 7 1 = 2 7 1 = 1 7 1 = 5 8 1 + 4 8 1 o 3 8 1 x 2 8 1 = 1 8 1 ^ 6 8 1 ^ 5 8 1 ^ 4 8 1 ^ 3 8 1 ^ 2 8 1 ^ 1 8 1 ^

Size

To produce larger or smaller grids, set the zoom CSS property on the container of the element with gridgen class.

C 1 chord 5 3 1 + 4 2 3 + 3 4 7 + 2 3 2 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am

Stop Styling

Stops are defined as SVG elements with classes that indicate their musical meaning:

To use these, define a CSS class to apply to the Gridgen element or its container. Then use descendant combinators to select pitches, degrees, and intervals among that container's children. Note that the !important property is needed if local changes are to override the SVG's existing CSS. See the source of this document for examples.

Here's a chord scale with stops colored by interval.

C 1 chord 5 3 1 + 4 5 5 + 3 4 7 + 2 5 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am

Here's the same chord scale with stops colored by scale degree.

C 1 chord 5 3 1 + 4 5 5 + 3 4 7 + 2 5 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am

Forms for Diatonic Chord Scales

(MCP, p. 21) introduces several forms for diatonic chord scales based on first-inversion triads, and suggests the reader build diatonic chords from each of them. We can easily generate solutions to these exercises by specifying the initial form and extending the sequence with several dupe d+ operations.

Clearly, the blind extension of these forms takes us quickly into the high frets. That's part of the exercise. When displaying chord grids, we could use string transference (s+ and s-) or shift the octave (o+ and o-) to accommodate. There are many ways to use operators to make these comfortably playable.

( E 1 chord 6 4 3 + 4 2 1 + 3 4 5 + 2 5 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 5 11 3 + 3 9 1 + 2 12 5 + 1 12 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 6 4 3 + 3 4 5 + 2 5 1 + 1 4 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 6 4 3 + 3 4 5 + 2 5 1 + 1 7 5 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 6 4 3 + 4 2 1 + 3 4 5 + 1 4 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 6 4 3 + 5 2 5 + 4 2 1 + 3 4 5 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 5 11 3 + 4 9 5 + 3 9 1 + 2 12 5 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 4 6 3 + 3 4 5 + 2 5 1 + 1 7 5 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 6 4 3 + 4 6 3 + 3 4 5 + 2 5 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 5 11 3 + 3 13 3 + 2 12 5 + 1 12 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class

The moving lines example (MCP, p. 21) works nicely as well, since decoration stops are preserved through chord operators.

E 1 chord 6 4 3 + 3 4 5 + 2 5 1 + 1 7 5 + 1 5 4 (x) 1 4 3 (=) dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am

(MCP, p. 23) Continues the chord scale exercise with diatonic 7th chords. Here are just a few.

( E 1 chord 6 0 1 + 5 2 5 + 4 1 7 + 3 1 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 5 7 1 + 4 9 5 + 3 8 7 + 2 9 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class ( E 1 chord 4 2 1 + 3 4 5 + 2 4 7 + 1 4 3 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am span ) block class

The Commonality of Chords and Scales

While designed for use on chords, Gridgen is equally capable of handling scales. Here, the dupe d+ operator is used to generate the modes of the key of D. The am operator aligns them into positions.

D 1 chord 5 5 1 + 5 7 2 + 4 4 3 + 4 5 4 + 4 7 5 + 3 4 6 + 3 6 7 + 3 7 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am

And the af operator lays them out across the fretboard.

D 1 chord 5 5 1 + 5 7 2 + 4 4 3 + 4 5 4 + 4 7 5 + 3 4 6 + 3 6 7 + 3 7 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ af

It's interesting to see the modes overlaid by the arpeggios.

D 1 chord 5 5 1 o 4 4 3 o 4 7 5 o 3 6 7 o 3 7 1 o 5 5 1 + 5 7 2 + 4 4 3 + 4 5 4 + 4 7 5 + 3 4 6 + 3 6 7 + 3 7 1 + dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ dupe d+ am

The Diatonic Cycle of 4ths

(MCP, p. 49) discusses “The Diatonic Cycle of 4ths in Major Keys.” The first example there is straightforwardly reproduced by defining only the first two chords, Cma7 and Fma7. Subsequent chords are each generated by an over d- operation. Specifically, the initial two chords on the stack are separated by a fourth. Then, over duplicates the second element from the top of the stack, and d- moves that duplicate down one degree.

C 1 chord 6 8 1 + 5 10 5 + 3 9 3 + 2 12 7 x C 4 chord 5 8 1 + 4 10 5 + 3 9 7 x 2 10 3 + over d- over d- over d- over d- over d- over d- over d- over d- am

Note how the elaboration established by the initial two chords is maintained in generated chords.

Structured Inversion

(CC, p. 9) presents the concept of structured inversion as a formal way of enumerating chord voicings. The examples (CC, p. 10) are straightforwardly reproduced using the i+ operator.

C 3 chord 6 3 3 + 4 2 1 + 3 4 5 + dupe i+ dupe i+ af A 5 chord 6 7 5 + 4 6 3 + 3 7 7 + 2 5 1 + dupe i+ dupe i+ dupe i+ af

Dealing with Invalid Chords

As noted, Chord Manipulation Operators can produce invalid chords that won't display properly. Validity can almost always be achieved using another chord manipulation operator, but determining when this is necessary can be a manual process. The ? operator can automate some of these fixes.

If a d- or i- operation shifts a chord off the end of the fretboard, then dupe o+ ? moves it up an octave. Specifically, this duplicates the chord, moves the duplicate up an octave, and selects either the original or the duplicate as needed. This way, the chord is only moved up an octave if necessary.

If a d+ or i+ shifts a chord up into the high frets, making it uncomfortable to play, then dupe o- swap ? moves it down an octave. Note that this is the reverse of the previous example. This operation prefers the duplicate (due to the swap), but only selects it if it's valid.

If both options are invalid, | will return the second one. A chain of | operators can be used to handle complex fixes.

Chord Symbol Inference

Gridgen maintains a small dictionary of chord formulas that it uses to infer the chord symbol shown at the top of each grid.

Consider, F 5 chord 6 3 5 + 5 3 1 + 4 2 3 + 3 3 7 + 2 3 2 +. This chord is defined in the key of F with 5th degree. From this alone, Gridgen knows the root is C. So, it compares the stops added to the chord, (G C E B♭ D), with the notes of the C major scale. This gives the intervals (5 1 3 ♭7 2). Sorted, (1 2 3 5 ♭7) appears in the dictionary as a dominant 9 chord. But the bass note is G, not the root C, so Gridgen indicates this with slash notation.

Now consider, F 5 chord 5 3 1 + 4 2 3 + 3 3 7 + 2 3 2 +. This is the same chord, but it's missing the 5, and the formula (1 2 3 ♭7) is not in the dictionary. Gridgen knows that 5 is often omitted, and will insert a perfect 5th, or a major 3rd, in its effort to find a matching dictionary entry.

A chord symbol's title attribute contains its formula. This is displayed when the pointer hovers over the symbol.

Chord Symbol Inference Failure

Consider C 1 chord 6 8 1 + 5 4 2 +. That's a (1 ♭2) chord, and Gridgen doesn't know what to call it. The question mark indicates that inference has failed. This can happen in two ways:

Console Debug Logging

If an expression is not displaying correctly, the process of evaluation can be dumped to the console log by adding the “debug” class to the “gridgen” element. Check the console now to see how F 4 chord 4 8 1 + 3 7 3 + 2 6 5 + gets turned into F 4 chord 4 8 1 + 3 7 3 + 2 6 5 +

HTML Structure

This example demonstrates the ( ) and [ ] element operators with a non-trivial HTML structure.

( ( [ A 1 chord 6 5 1 + 5 4 3 + 4 2 5 +
   dupe d+ dupe d+ dupe d+ am td ] tr )
( [ A 1 chord 4 7 1 + 3 6 3 + 2 5 5 +
   dupe d+ dupe d+ dupe d+ am td ] tr ) table ) display class

( ( [ A 1 chord 6 5 1 + 5 4 3 + 4 2 5 + dupe d+ dupe d+ dupe d+ am td ] tr ) ( [ A 1 chord 4 7 1 + 3 6 3 + 2 5 5 + dupe d+ dupe d+ dupe d+ am td ] tr ) table ) display class

The chord constructor and dupe d+ operator generate four chords. [ ... td ] wraps each chord in a table cell. ( ... tr ) wraps these four table cells in a table row. This is done twice, and ( ... table ) wraps these two table rows in a table. Finally, the display class is given to the table, which centers it on this page.

HTML Content

If necessary, text may be embedded directly within a Gridgen expression. The ( ) and [ ] element operators work here too. This example shows two separate four-chord sequences with text between them. But because it's a single expression, the af aligns all eight chords.

A 1 chord 6 5 1 + 5 4 3 + 4 2 5 + dupe d+ dupe d+ dupe d+
is one ( octave em ) lower than
A 1 chord 4 7 1 + 3 6 3 + 2 5 5 + dupe d+ dupe d+ dupe d+ af

A 1 chord 6 5 1 + 5 4 3 + 4 2 5 + dupe d+ dupe d+ dupe d+ is one ( octave em ) lower than A 1 chord 4 7 1 + 3 6 3 + 2 5 5 + dupe d+ dupe d+ dupe d+ af

If these two sequences were given as separate expressions, the alignment would apply to each separately.

More HTML Structure

Here's a demonstration of HTML structure using dupe. It highlights the difference between the ( ) and [ ] element operators.

( G 1 chord 4 5 1 + 3 4 3 + 2 3 5 + dupe d+ am span ) dupe produces

( G 1 chord 4 5 1 + 3 4 3 + 2 3 5 + dupe d+ am span ) dupe

[ G 1 chord 4 5 1 + 3 4 3 + 2 3 5 + dupe d+ am span ] dupe produces

[ G 1 chord 4 5 1 + 3 4 3 + 2 3 5 + dupe d+ am span ] dupe

In the first example, the ( ) operator receives two chords and wraps them both in a single span element. Then, dupe duplicates the span at the top of the stack, resulting in two sets of two chords.

In the second example, the [ ] operator receives two chords and wraps them each in its own span element. Then, dupe duplicates the span at the top of the stack, resulting in two of only the last chord.