Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Modulo/remainder operator which is in amsmath #262

Merged
merged 4 commits into from
Aug 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- [#262: Add \mod operator from amsmath][pull-262]

## [0.10.0] - 2021-07-06
### Changed
- (**Breaking change!**) Removed support for .NET Core 3.0. .NET Core 3.1 or later is supported from now (.NET Framework 4.5.2 is still supported; .NET 5.0 or later is supported, too).
Expand Down Expand Up @@ -186,6 +190,7 @@ This was the initially published version. It consisted entirely of the original
[pull-253]: https://github.com/ForNeVeR/wpf-math/pull/253
[pull-254]: https://github.com/ForNeVeR/wpf-math/pull/254
[pull-261]: https://github.com/ForNeVeR/wpf-math/pull/261
[pull-262]: https://github.com/ForNeVeR/wpf-math/pull/262
[pull-277]: https://github.com/ForNeVeR/wpf-math/pull/277
[pull-283]: https://github.com/ForNeVeR/wpf-math/pull/283

Expand Down
4 changes: 4 additions & 0 deletions src/WpfMath.Tests/ParserTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ let sin() =
let intF() =
verifyParseResult @"\int f"

[<Fact>]
let ``mod``() =
verifyParseResult @"\mod"

[<Fact>]
let emptyCurlyBraces() =
verifyParseResult @"{}"
Expand Down
80 changes: 80 additions & 0 deletions src/WpfMath.Tests/TestResults/ParserTests.mod.approved.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"RootAtom": {
"[AtomType]": "BigOperatorAtom",
"BaseAtom": {
"[AtomType]": "RowAtom",
"Elements": [
{
"[AtomType]": "CharAtom",
"Character": "m",
"IsTextSymbol": false,
"Source": {
"End": 9,
"Length": 1,
"Source": "\\mathrm{mod}",
"SourceName": "Predefined formula fragment",
"Start": 8
},
"TextStyle": "mathrm",
"Type": "Ordinary"
},
{
"[AtomType]": "CharAtom",
"Character": "o",
"IsTextSymbol": false,
"Source": {
"End": 10,
"Length": 1,
"Source": "\\mathrm{mod}",
"SourceName": "Predefined formula fragment",
"Start": 9
},
"TextStyle": "mathrm",
"Type": "Ordinary"
},
{
"[AtomType]": "CharAtom",
"Character": "d",
"IsTextSymbol": false,
"Source": {
"End": 11,
"Length": 1,
"Source": "\\mathrm{mod}",
"SourceName": "Predefined formula fragment",
"Start": 10
},
"TextStyle": "mathrm",
"Type": "Ordinary"
}
],
"PreviousAtom": null,
"Source": {
"End": 11,
"Length": 3,
"Source": "\\mathrm{mod}",
"SourceName": "Predefined formula fragment",
"Start": 8
},
"Type": "Ordinary"
},
"LowerLimitAtom": null,
"Source": {
"End": 11,
"Length": 3,
"Source": "\\mathrm{mod}",
"SourceName": "Predefined formula fragment",
"Start": 8
},
"Type": "BigOperator",
"UpperLimitAtom": null,
"UseVerticalLimits": false
},
"Source": {
"End": 4,
"Length": 4,
"Source": "\\mod",
"SourceName": "User input",
"Start": 0
},
"TextStyle": null
}
9 changes: 9 additions & 0 deletions src/WpfMath/Data/PredefinedTexFormulas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@
<Return name="f" />
</Formula>

<Formula name="mod" enabled="true">
<CreateFormula name="f" />
<MethodInvocation name="AddOperator" formula="f">
<Argument type="string" value="\mathrm{mod}" />
<Argument type="bool" value="false" />
</MethodInvocation>
<Return name="f" />
</Formula>

<Formula name="tanh" enabled="true">
<CreateFormula name="f" />
<MethodInvocation name="AddOperator" formula="f">
Expand Down