This commit is contained in:
wangjinlei
2024-07-17 09:23:45 +08:00
parent edf9deeb1a
commit 881ac3e056
1001 changed files with 41032 additions and 5452 deletions

View File

@@ -0,0 +1,61 @@
## Usage
To create a fraction, use the `PhpOffice\Math\Element\Fraction` class.
### Methods
#### getDenominator
The method has no parameter.
#### getNumerator
The method has no parameter.
#### setDenominator
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### setNumerator
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<mfrac>
<mi>a</mi>
<mn>3</mn>
</mfrac>
</math>
### XML
``` xml
<math display="block">
<mfrac>
<mi>a</mi>
<mn>3</mn>
</mfrac>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$fraction = new Element\Fraction();
$fraction->setDenominator(new Element\Identifier('a'));
$fraction->setNumerator(new Element\Numeric(3));
$math->add($fraction);
```

View File

@@ -0,0 +1,43 @@
## Usage
To create an identifier, use the `PhpOffice\Math\Element\Identifier` class.
### Methods
#### getValue
The method has no parameter.
#### setValue
The method has one parameter :
* `string` **$value**
## Example
### Math
<math display="block">
<mi>a</mi>
</math>
### XML
``` xml
<math display="block">
<mi>a</mi>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$identifier = new Element\Identifier('a');
$math->add($identifier);
```

View File

@@ -0,0 +1,43 @@
## Usage
To create a numeric, use the `PhpOffice\Math\Element\Numeric` class.
### Methods
#### getValue
The method has no parameter.
#### setValue
The method has one parameter :
* `float` **$value**
## Example
### Math
<math display="block">
<mn>3</mn>
</math>
### XML
``` xml
<math display="block">
<mn>3</mn>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$identifier = new Element\Numeric(3);
$math->add($identifier);
```

View File

@@ -0,0 +1,43 @@
## Usage
To create an operator, use the `PhpOffice\Math\Element\Operator` class.
### Methods
#### getValue
The method has no parameter.
#### setValue
The method has one parameter :
* `string` **$value**
## Example
### Math
<math display="block">
<mo>+</mo>
</math>
### XML
``` xml
<math display="block">
<mo>+</mo>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$identifier = new Element\Operator('+');
$math->add($identifier);
```

View File

@@ -0,0 +1,62 @@
## Usage
To create a row, use the `PhpOffice\Math\Element\Row` class.
### Methods
#### add
The method add an element to the row.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### getElements
The method return all elements of the row.
#### remove
The method remove an element to the row.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<mrow>
<mn>1</mn>
<mo>+</mo>
<mi>K</mi>
</mrow>
</math>
### XML
``` xml
<math display="block">
<mrow>
<mn>1</mn>
<mo>+</mo>
<mi>K</mi>
</mrow>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$row = new Element\Row();
$row->add(new Element\Numeric(1));
$row->add(new Element\Operator('+'));
$row->add(new Element\Identifier('K'));
$math->add($row);
```

View File

@@ -0,0 +1,81 @@
## Usage
To create a semantics, use the `PhpOffice\Math\Element\Semantics` class.
### Methods
#### add
The method add an element to the `semantics` element.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### addAnnotation
The method add an annotation to the `semantics` element.
The method has two parameters :
* `string` **$encoding**
* `string` **$annotation**
#### getAnnotation
The method return an annotation based on its encoding.
The method has one parameter :
* `string` **$encoding**
#### getAnnotations
The method return alls annotation of the `semantics` element.
The method has no parameter.
#### getElements
The method return all elements of the `semantics` element.
#### remove
The method remove an element to the `semantics` element.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<semantics>
<mi>y</mi>
<annotation encoding="application/x-tex"> y </annotation>
</semantics>
</math>
### XML
``` xml
<math display="block">
<semantics>
<mi>y</mi>
<annotation encoding="application/x-tex"> y </annotation>
</semantics>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$semantics = new Element\Semantics();
$semantics->add(new Element\Identifier('y'));
$semantics->addAnnotation('application/x-tex', ' y ');
$math->add($semantics);
```

View File

@@ -0,0 +1,61 @@
## Usage
To attach a superscript to an expression, use the `PhpOffice\Math\Element\Superscript` class.
### Methods
#### getBase
The method has no parameter.
#### getSuperscript
The method has no parameter.
#### setBase
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### setSuperscript
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<msup>
<mi>X</mi>
<mn>2</mn>
</msup>
</math>
### XML
``` xml
<math display="block">
<msup>
<mi>X</mi>
<mn>2</mn>
</msup>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$superscript = new Element\Superscript();
$superscript->setBase(new Element\Identifier('X'));
$superscript->setSuperscript(new Element\Numeric(2));
$math->add($superscript);
```