Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close
                              FORMULADOR
                              ==========

                           By Robert Smith

Formulador is intended to be a text-based formula renderer, and maybe
editor one day.

It is still a work-in-progress; we can't reinvent an ad hoc,
informally-specified, bug-ridden, slow implementation of half of TeX
overnight.

The way it works right now is simple: build your typesetting object,
and draw it out to a canvas. Formulador will take the liberty of
making the canvas for you.

Fundamentally, as it stands, input is composed of boxes. Each box
contains an element you'd like to typeset. Right now we have the
following boxes

    * empty-box (a sort of no-op; typesets as nothing)
    * strings (typeset as themselves)
    * characters (typeset as themselves)
    * string-box (a wrapper for a string)
    * frac-box (fractions)
    * row-box (a horizontal concatenation of boxes)
    * frame-box (a box with decorative appeal)

These will be extended and given more options over time.

Here is a simple example:

> (draw (frac-box "x" "y"))
+---+
| x |
|---|
| y |
+---+

And a more complex example:

> (draw
   (frac-box (row-box (list
                       (frac-box "x" "y")
                       "+"
                       (frac-box "w"
                                 (row-box (list "u" "+" "v") :padding 1)))
                      :padding 1)
             (frac-box (row-box (list "p" "+" "q") :padding 1)
                       (row-box (list "r" "+" (frac-box "1" "s")) :padding 1))))
+---------------+
|  x       w    |
| --- + ------- |
|  y     u + v  |
|---------------|
|     p + q     |
|   ---------   |
|         1     |
|    r + ---    |
|         s     |
+---------------+

And finally:

> (defun interleave (x list)
    (rest (mapcan (lambda (y) (list x y)) list)))
INTERLEAVE
> (interleave '* '(x y z))
(X * Y * Z)
> (draw
   (frac-box
    "1"
    (row-box (interleave "+" (map 'list
                                  (lambda (c)
                                    (frac-box "1" c))
                                  "rtoyg"))
             :padding 1)))
+-----------------------------+
|              1              |
|-----------------------------|
|  1     1     1     1     1  |
| --- + --- + --- + --- + --- |
|  r     t     o     y     g  |
+-----------------------------+

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.