Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Package mathtools #160

Merged
merged 2 commits into from
Jan 25, 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
15 changes: 15 additions & 0 deletions list-of-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Please note that not everything has to be declared.
[hyperref](#package-hyperref),
[inputenc](#package-inputenc),
[listings](#package-listings),
[mathtools](#package-mathtools),
[pgfplots](#package-pgfplots),
[tikz](#package-tikz),
[xcolor](#package-xcolor),
Expand Down Expand Up @@ -311,6 +312,20 @@ We simply remove the listings, inserting a paragraph break.
lstlisting


## Package mathtools

Source: [yalafi/packages/mathtools.py](yalafi/packages/mathtools.py),
tests: [tests/test\_packages/test\_mathtools.py](tests/test_packages/test_mathtools.py)

**Loaded packages**

[amsmath](#package-amsmath)

**Macros**

\\mathtoolsset


## Package pgfplots

Source: [yalafi/packages/pgfplots.py](yalafi/packages/pgfplots.py),
Expand Down
25 changes: 25 additions & 0 deletions tests/test_packages/test_mathtools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@


import pytest
from yalafi import parameters, parser, utils

preamble = '\\usepackage{mathtools}\n'

def get_plain(latex):
parms = parameters.Parameters()
p = parser.Parser(parms)
plain, nums = utils.get_txt_pos(p.parse(preamble + latex))
assert len(plain) == len(nums)
return plain


data_test_macros_latex = [

(r'\mathtoolsset{showonlyrefs,mathic = true}', ''),

]

@pytest.mark.parametrize('latex,plain_expected', data_test_macros_latex)
def test_macros_latex(latex, plain_expected):
plain = get_plain(latex)
assert plain == plain_expected
25 changes: 25 additions & 0 deletions yalafi/packages/mathtools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#
# YaLafi module for LaTeX package mathtools
#

from yalafi.defs import InitModule

require_packages = ["amsmath"]


def init_module(parser, options):
parms = parser.parms

macros_latex = r"""

\newcommand{\mathtoolsset}[1]{}

"""

macros_python = []

environments = []

return InitModule(macros_latex=macros_latex, macros_python=macros_python,
environments=environments)