diff --git a/list-of-macros.md b/list-of-macros.md index 56e32b80..1bab0cc6 100644 --- a/list-of-macros.md +++ b/list-of-macros.md @@ -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), @@ -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), diff --git a/tests/test_packages/test_mathtools.py b/tests/test_packages/test_mathtools.py new file mode 100644 index 00000000..0bdb8dbe --- /dev/null +++ b/tests/test_packages/test_mathtools.py @@ -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 diff --git a/yalafi/packages/mathtools.py b/yalafi/packages/mathtools.py new file mode 100644 index 00000000..4fb479ec --- /dev/null +++ b/yalafi/packages/mathtools.py @@ -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)