Difference between revisions of "Documentation/FAQ/Formula"

From Apache OpenOffice Wiki
Jump to: navigation, search
(How do I change the font of a subformula?)
(How do I change the color of a subformula?)
Line 286: Line 286:
 
always transparent. This means that it inherits the background color
 
always transparent. This means that it inherits the background color
 
from the document (for example a writer document) it is contained in.
 
from the document (for example a writer document) it is contained in.
 +
 +
==I need a symbol that ''Math'' does not provide. What can I do?==
 +
If you have a font containing the symbol you can define a userdefined symbol.
 +
 +
<P STYLE="font-style: normal">Follow these steps:</P>
 +
 +
*Open the Symbols dialog ('''Tools-Catalog...''').
 +
*Click ''''Edit''''.
 +
*Type a name for the new symbol in the combobox <B>'Symbol'</B>.
 +
*Type a new name or select
 +
an existing name in the combobox <B>'Symbol set</B>. This is the
 +
symbol set you want your symbol to appear in.
 +
*Select the font in the listbox <B>'Font'</B>, for example the
 +
StarMath font.
 +
*Select the formatting (normal, bold, bold-italic or italic)
 +
in the listbox <B>'Typeface'</B>.
 +
*Click on the symbol in the table.
 +
*Click <b>'Add'</b> to add your symbol.
 +
 +
You can now use your symbol like any other symbol by selecting it
 +
in the Symbols dialog or entering<font color="brown"> %thenameofthesymbol '''</font>directly.
 +
 +
If you don't have the symbol try looking in the StarMath font
 +
first; it contains about 25 additional symbols.
 +
 +
Another source of symbols is the so-called AMS fonts of the
 +
American Mathematical society.
 +
 +
You can download these in Postscript type 1 format from
 +
[http://www.ams.org/tex/amsfonts.html www.ams.org/tex/amsfonts.html].
 +
 +
If you use Microsoft Windows you might prefer to download the unofficial BaKoMa Truetype versions from [http://www.ctan.org/tex-archive/fonts/cm/ps-type1/bakoma/ www.ctan.org/tex-archive/fonts/cm/ps-type1/bakoma/].
 +
 +
Refer to the documentation distributed with the fonts for
 +
conditions of use.

Revision as of 21:31, 16 June 2006

How can I get a left bracket without a right bracket?

Since brackets have a grouping function they must always match and be correctly nested.

To get a single bracket without a matching bracket partner you have to escape the bracket with a backslash. For example to get a "[" without a corresponding "]" you should enter "\[".

Thus to typeset the interval [3;8) you should enter \[3 ";" 8\). The quotation marks around the semicolon ensures that it is not typeset in italic. (You're right, this has nothing to do with brackets!)

For scalable brackets it is essential that left and right matches, since the content that the brackets encloses must be well defined.

In this case you can use the invisible bracket none to get a single bracket. For example to get a scalable "[" without a corresponding "]" you should enter left [ ... right none.

Thus to typeset File:001a.gifyou should enter x=left lbrace binom -5 3 right none.

I enter x^* to typeset x*, but get an error message. Why?

The problem is that * is a binary operator, that is there has to be an expression on both sides of the symbol.

You either have to enter the expression x^{{}*{}} to avoid the error message, or you could type x^"*" as well, where the quotes will interprete the asterisk not as a binary operator but as a "standalone" symbol.

If you use this construction a lot you might want to define the symbol as a userdefined symbol. See <A HREF="012.html">FAQ #012</A>. If you have defined the * as a userdefined symbol, say %ast, you can enter x^%ast.

This answer applies to a lot of other symbols as well. Some operators, such as +, are unary, that is there only has to be an expression to the right of the symbol. To typeset x+ you can enter x^{+{}}< or, of course, x^"+".


When I enter one of the symbols #, & ,|,^ or _ I get an unexpected result or an error message. How can I use these symbols?

These symbols all have a special meaning in Math:

  • The symbol # is used in stacks and matrices.
  • The symbols & and | are used for logical and and logical or.
  • The symbols ^ and _ are used for

subscripts and superscripts.


To use them in your formula you can put them in quotation marks, which means that you insert them as text.

If you want to use the symbol "|" you should consider whether the construction you need is one of the the following:

  • a divides b is used to typeset a| b.
  • abs a is used to typeset |a|.

When I enter 3xy the number 3 comes out in italics. Is this a bug?

Not really. What happens here is, that Math uses multi-letter variables, which are common in some disciplines, like economy. The rule is that a variable consists of a sequence of letters, numbers and dots (the first character can not be a dot).

So when you enter 3xy this is considered a variable - and variables are typeset in italics. The only odd thing here is, that a variable can start with a number.

The correct way to enter the expression if you mean 3 times x times y is 3 x y (with spaces between the characters).

How do I align my equations at the equality sign?

Currently Math does not have an alignment construction. Instead you can use a matrix.

For example to typeset the equation 005a.gif

you should enter the following:

matrix{
   alignr x+y # {}={} # alignl 2 ##
   alignr x   # {}={} # alignl 2-y
}

The empty braces around = are necessary because = is a binary operator and thus needs an expression on each side.

You can reduce the spacing around = if you change the inter-column spacing of the matrix:


  • Select Format-Spacing
  • Click 'Category' and chooseMatrixes in the pop-up menu.
  • Now enter 0% under 'Column spacing'.


Here is another example using a different solution:

To typeset the equation

005b.gif

the trick is to use phantom as follows:

""3(x+4)-2(x-1)=3 x+12-(2 x-2) newline
""phantom {3(x+4)-2(x-1)}=3 x+12-2 x+2 newline
""phantom {3(x+4)-2(x-1)}=x+14

The effect of the empty quotation marks is to left justify the line - a line starting with text (even an empty text) will always be left justified.

You can replace "" with alignl.

I want to use a binary operator (like union or otimes) as a large operator (like int or sum). How can I do that?

You have to define the symbol you want to use as a user-defined symbol first. See <A HREF="012.html">FAQ #012</A> for instructions; most of the symbols used by Math are part of the StarMath font.

Let's say you have defined the union symbol as the user-defined symbol %union. You can then enter for example

oper%union from i in I A_i

in order to typeset the formula

006a.gif

Note: In build 633 this doesn't work if there is a space before %union (this is a bug in the parser).

Any user-defined symbol can be used as a large operator if it is preceded with oper as in the example.

How do I typeset functions, such as max, det, that Math does not know about?

Math has a number of standard functions built-in, such as cos, log etc.

These functions are typeset in an upright shape according to typographical traditions.

To typeset other functions this way you can simply preceed the function with func. Example:

  • To typeset max(a,b) you should enter func

max(a,b).

How do I change the fonts used in my formula?

Math uses 7 different text fonts to typeset formulas - in addition to symbol fonts (mainly the StarMath font).

The basic fonts are:

  • Variables. Variables (such as x, a etc.) are usually typeset in italics; the default is Times New Roman, italics.
  • Functions. Functions (such as cos, log etc.) are usually typeset in upright shape; the default is Times New Roman.
  • Numbers. Numbers (such as 217 are usually typeset in upright shape; the default is Times New Roman.
  • Text. Text (such as "abc") is usually typeset in upright shape; the default is Times New Roman.
  • Serif is an additional, serifed font. The default is Times New Roman.
  • Sans is an additional, sans serif font. The default is Helvetica/Arial.
  • Fixed is an additional fixed with font. The default is Courier.


You can read about how to use these fonts in FAQ:Formula#How_do_I_change_the_font of a subformula?.

To change one of the fonts follow these steps:

  • Select Format-Fonts....
  • Click 'Modify' and select the font you wish to modify in the pop-up menu.
  • Select the font in the list. You can also check one or both the checkboxes 'Bold' and 'Italic'.
  • Close the dialog with 'OK'.


This will change the font for the current formula. The next time you want to use the same font it will already be in the list box; you don't have to click modify again.

To change the default fonts follow these steps:

  • Select Format-Fonts.
  • Choose the seven fonts as described above.
  • Click 'Default'.

This will save your settings as the default fonts to be used in a new formula.

To change the base size of the formula select Format-Font Size... and enter the size you want. All other font sizes are relative to the base size. The default is 12 pt.

This will change the base size for the current formula. To change the default base size you should click 'Default' before you close the dialog.

How do I change the font of a subformula?

You can use one of the following font attributes:


  • italic a typesets a in italic shape.
  • so does ital a>.
  • nitalic a typesets a in upright shape (abbreviation for not italic).
  • bold a typesets a in boldface.
  • nbold a typesets a with normal weight (abbreviation for not bold).


In addition Math uses a set of three generic font families, which are used as follows:

  • font serif a typesets a in a serifed font, usually Times.
  • font sans a typesets a in a sans serif font, usually Helvetica or Arial.
  • font fixed a typesets a in a fixed font, usually Courier.


Font attributes can be combined as in this example:

  • Enter bold font sans A to get A.

You can apply font attributes to an entire subformula if you group it with { } or other brackets. Example:


  • Enter a b bold {c d} e to typeset abcde.

When several font attributes are applied, the innermost takes precedence as shown in this example:

  • Enter bold {a b nbold c d} to get abcd.


To change the fonts used in Math see How do I change the fonts used in my formula?

How do I change the size of a subformula?

There are five variants of the size-changing command:

  • size 20 a typesets a with the font size 20 pt.
  • size +5 a typesets a with current font size plus 5pt.
  • size -5 a typesets a with current font size minus 5pt.
  • size *1.5 a typesets a with current font size times 1.5.
  • size /1.5 a typesets a with current font size divided by 1.5.

You can change the font size of an entire subformula if you group it with { } or other brackets. Example:

  • Enter a b size *2 {c d} e to typeset abcde.

When several font size changes are applied, the innermost takes precedence as shown in this example:

  • Enter size *1.5 {a size 12 b size *1.5 c d} to get abcd.


To change the base font size used in Math see How do I change the fonts used in my formula?

How do I change the color of a subformula?

You can use the color command as follows:


  • color red ABC typesets ABC.

There are eight different colors to choose from:

  • white, black, cyan, magenta, red, blue, green, yellow.


You can apply a color to an entire subformula if you group it with { } or other brackets. Example:

  • Enter A B color green {C D} E to typeset ABCDE.

When several colors are applied, the innermost takes precedence as shown in this example:

  • Enter color blue {A B color yellow C D} to get

ABCD.


You cannot select the background color; a Math formula is always transparent. This means that it inherits the background color from the document (for example a writer document) it is contained in.

I need a symbol that Math does not provide. What can I do?

If you have a font containing the symbol you can define a userdefined symbol.

Follow these steps:

  • Open the Symbols dialog (Tools-Catalog...).
  • Click 'Edit'.
  • Type a name for the new symbol in the combobox 'Symbol'.
  • Type a new name or select

an existing name in the combobox 'Symbol set. This is the symbol set you want your symbol to appear in.

  • Select the font in the listbox 'Font', for example the

StarMath font.

  • Select the formatting (normal, bold, bold-italic or italic)

in the listbox 'Typeface'.

  • Click on the symbol in the table.
  • Click 'Add' to add your symbol.

You can now use your symbol like any other symbol by selecting it in the Symbols dialog or entering %thenameofthesymbol directly.

If you don't have the symbol try looking in the StarMath font first; it contains about 25 additional symbols.

Another source of symbols is the so-called AMS fonts of the American Mathematical society.

You can download these in Postscript type 1 format from www.ams.org/tex/amsfonts.html.

If you use Microsoft Windows you might prefer to download the unofficial BaKoMa Truetype versions from www.ctan.org/tex-archive/fonts/cm/ps-type1/bakoma/.

Refer to the documentation distributed with the fonts for conditions of use.

Personal tools