Horizontal alignment of document elements

Principles of grid structures

The HTML page can feature a grid structure of cells, defined by the following syntax in case of a 1x3 grid:

# begin-grid-area

!bslidecell 00
...
!eslidecell

!bslidecell 01
...
!eslidecell

!bslidecell 02
...
!eslidecell

# end-grid-area

Important rule

  • The # begin/end-grid-area directives mark the beginning and end of a region where we can have horizontal elements stacked in a grid.
  • Only text inside the slidecell environments is typeset in the output HTML document.

For example, the mathematics in the following 2x2 grid structure will be lost because it appears outside the slidecell environments:

# begin-grid-area

!bslidecell 00
...
!eslidecell

!bslidecell 01
...
!eslidecell

We consider

!bt
\[ f(x, y) = \sin (x + y) \]
!et

!bslidecell 10
...
!eslidecell

!bslidecell 11
...
!eslidecell

# end-grid-area

It is easy to shuffle cells around in the grid structure.

A nice feature is that the coordinates of the cells, here 00, 01, and 02 can be given in any desired order. For example, if we want to reverse the sequence of the three elements in the three columns of this grid, we simply change 00 by 02 and 02 by 00.

Example on a 1x3 grid structure

Mathematics. Given a function $$ f(x) = e^{-ax}\sin wx\thinspace .$$ Write a program for evaluating \( f(x) \), and test the program for the value of \( f(0) \).

Implementation. The Python implementation reads

from math import exp, sin

def f(x):
    return exp(-a*x)*sin(w*x)

where a and w must be global variables, initialized in the main program.

Computational experiment. With a main program

a = 1
from math import pi
w = pi
print f(0)

we can run the program:

Terminal> python prog.py
0

Variation of the previous grid structure using admons

Mathematics

Given a function $$ f(x) = e^{-ax}\sin wx\thinspace .$$ Write a program for evaluating \( f(x) \), and test the program for the value of \( f(0) \).

Implementation

The Python implementation reads

from math import exp, sin

def f(x):
    return exp(-a*x)*sin(w*x)

where a and w must be global variables, initialized in the main program.

Computational experiment

With a main program

a = 1
from math import pi
w = pi
print f(0)

we can run the program:

Terminal> python prog.py
0