Insert Formula- text format testing grounds

Lately I've put a little fun (really, a lot of fun for me) and the beginnings of a large new PageStream project in the next 5.0 Pro.

In the ''Insert'' submenu of the ''Type'' menu, I have added an ''Insert Formula'' menu item. At this time it is a test bed for not only the formula processing and formatting, but also other on going projects and improvements to the general PageStream layout engine.

I've been working on bits for right-to-left and vertical language support and advanced glyph composition for eastern languages that will be tested here before integrating into the PageStream layout engine. Other features I hope to integrate in the future include html-like inline text tables, conditional text, and true footnotes. Lastly, the text codes you enter will become additions to the PageStream markup text codes used to export/import ascii text with attributes.

None of this is ready for prime time, but this is your chance to provide feedback on the kinds of advanced text functionality you would like to see in coming updates to the layout code and more specifically to the formula processing and layout. To play along, just install the latest 5.0 Pro (5.0.2.10 Pro or later) version. Choose ''Insert Formula'' from the ''Insert'' submenu in the ''Type'' menu, and try typing a few simple formulas. For example, A = B+C/D or A = (B+C)/D. Then click the ''Update'' button and see your results! Unicode values for math symbols can be entered like in any other string using the \00000 format.

Feedback is welcome, just post a comment below and we will use this as a mini-message board. References to standards and samples is welcome. I hope it is half as much fun for you as it is for me! At this point I am leaning strongly towards implementing text formatting codes much like TeX does. I'm not an expert in how it is written there, but it seems beneficial to all if a standard is used instead of creating Yet Another Format.


 

Insert Formula- text format testing grounds  Section  url:PGSguide/insertformula
  created:2006-06-16 13:25:38   last updated:2006-08-16 15:42:17
  Copyright © 1985-2024 GrasshopperLLC. All Rights Reserved.

User Contributed Comments For Insert Formula- text format testing grounds
Dan Kilroy wrote...2006-07-22 10:26:40

Ok, the start for the syntax we are going to use initially is from LaTex.

Deviations from standard LaTeX markup
The dollar sign ($) operators to start and stop an inline math equation are not used, nor are the start and stop operators \[ \] for standalone equations used.

Tutorials on the web
Here is a tutorial from UIUC that covers the basics.


Basic math
The plus (+), minus (-), division (/) symbols have the usual meaning. To denote multiplication explicitly (this is rarely necessary), use \cdot (producing a centered dot) or \times (producing an "x").

Does / give you a division symbol (horizontal bar with a middle dot above and below)? What is the syntax for a long division bar?
Why not * for either cdot or times, or as is?

The ''equal'' (=), ''less than''(<), and ''greater than'' (>) symbols on the keyboard work as expected. For ''less than or equal'', use \le. For ''greater than or equal'', use \ge.

Square roots: Use \sqrt{...}. For example, z=\sqrt{x^2+y^2}.

Subscripts: Use underscores (_). For example a_1.

Superscripts: Use carets (^). For example 2^n.

If the sub/superscript contains more than one character, it must be enclosed in curly braces. For example 2^{x+y}[snippet].

Fractions: Use [snippet]\frac{numerator}{denominator}. For example \frac{3}{4}[snippet].

Binomial coefficients: Use [snippet]\binom{x}{y}.

Sums: Use \sum_{lowerlimit}^{upperlimit}.... The upper and lower limits are optional. For example \sum_{k=1}^n k = \frac{n(n+1)}{2}

Integrals: Use \int_{lowerlimit}^{upperlimit}.... For example \int.

Limits: The "subscript" trick works also for limits; "\lim" produces the "lim" symbol, and the expression underneath this symbol (for example, "x tends to infinity") is typeset as a subscript to \lim: $\lim_{x\to\infty}f(x)=0$. Here "\to" produces the arrow, and "\infty" (note the abbreviation - \infinity does not work!) produces the "infinity" symbol. "\limsup" and "\liminf" work similarly, as do "\sup" and "\inf" (for supremum and infinimum), and "\max" and "\min" (for maximum and minimum). For example, \max_{0\le x\le 1}x(1-x)=1/4.

Operators: \sin, \cos, \log, \ln, \exp, \arctan, etc. Use these commands instead of simply typing "sin", "cos", etc., without the backslash.

More math
Greek letters and other special characters: Use \epsilon, \Delta, \delta, \nu, \phi, etc.

The most common notation for the reals, rationals, and integers involves the so-called "blackboard bold" font; to get these symbols use \mathbb{...} (in math mode): $\mathbb{R}$, $\mathbb{Q}$, $\mathbb{Z}$. Similarly \mathcal{...} produces a symbol in "script" or "caligraph" font, often used to denote sets: For example, $\mathcal{A}$ generates "script A".

Parentheses: The symbol pairs (), [], and \{ \} (note the backslash!) generate round, square, and curly parentheses in normal size. They work fine in math mode, but mathematical expressions often look better if the parentheses are enlarged to match the size of the expression. To let TeX do the sizing, precede the left brace by \left, and the right brace by \right. This also works for other parentheses-like constructs, such as the absolute value symbol "|". Here is an example:

\[
\left|\sum_{i=1}^n a_ib_i\right|
\le
\left(\sum_{i=1}^n a_i^2\right)^{1/2}
\left(\sum_{i=1}^n b_i^2\right)^{1/2}
\]

The left and right brackets don't have to be of the same type; for example, $\left\[\frac{3}{4}, \frac{4}{5}\right[$ to denote the half-open interval [3/4, 4/5[ is perfectly legal.)

Dan Kilroy wrote...2006-08-23 14:51:14

After talking with Deron about the implementation of the TeX-like math markup in PageStream, I have learned that this mearly represents a text-base import/export from PageStream's own internal format. That means that other markup languages can be supported as needed.

One suggestion that has come in already is to support MathML. Addtional information on the web can be found at http://www.mathmlcentral.com/ and http://en.wikipedia.org/wiki/MathML.

It should be possible to choose a math markup language much like pagestream text codes vs quark text codes.

User Contributed Comments For Insert Formula- text format testing grounds