From 2d3c4339d630592b4692bc02654b501c5eb4b57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Tue, 24 Sep 2024 08:28:38 +0200 Subject: [PATCH 1/6] Autoupdate the pre-commit hook --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6b11445..726f2f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: # exclude autogenerated files exclude: /README\.rst$|\.pot?$ - repo: https://github.com/psf/black - rev: 24.4.0 + rev: 24.8.0 hooks: - id: black language_version: python3 @@ -39,7 +39,7 @@ repos: hooks: - id: isort - repo: https://github.com/nbQA-dev/nbQA - rev: 1.8.5 + rev: 1.8.7 hooks: - id: nbqa-black additional_dependencies: [black==22.8.0] From dcdcf6d15e15f78886aa85c8fcf9ad3de41f6400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Tue, 24 Sep 2024 08:28:51 +0200 Subject: [PATCH 2/6] Implement the AISTATS 2025 style --- tests/test_rc_params_cases/case_bundles.py | 5 +++++ tests/test_rc_params_cases/case_figsizes.py | 8 ++++++++ tests/test_rc_params_cases/case_fonts.py | 8 ++++++++ tests/test_rc_params_cases/case_fontsizes.py | 4 ++++ tueplots/bundles.py | 11 +++++++++++ tueplots/figsizes.py | 10 ++++++++++ tueplots/fonts.py | 7 ++++++- tueplots/fontsizes.py | 5 +++++ 8 files changed, 57 insertions(+), 1 deletion(-) diff --git a/tests/test_rc_params_cases/case_bundles.py b/tests/test_rc_params_cases/case_bundles.py index 915d165..812888d 100644 --- a/tests/test_rc_params_cases/case_bundles.py +++ b/tests/test_rc_params_cases/case_bundles.py @@ -39,6 +39,11 @@ def case_bundles_aistats2023(column): return bundles.aistats2023(column=column, nrows=2, ncols=2, family="serif") +@pytest_cases.parametrize(column=["full", "half"]) +def case_bundles_aistats2025(column): + return bundles.aistats2025(column=column, nrows=2, ncols=2, family="serif") + + @pytest_cases.parametrize(usetex=[True, False]) def case_bundles_neurips2021(usetex): return bundles.neurips2021(usetex=usetex, nrows=2, ncols=2, family="serif") diff --git a/tests/test_rc_params_cases/case_figsizes.py b/tests/test_rc_params_cases/case_figsizes.py index 905a890..0bf7a04 100644 --- a/tests/test_rc_params_cases/case_figsizes.py +++ b/tests/test_rc_params_cases/case_figsizes.py @@ -35,6 +35,14 @@ def case_figsizes_aistats2023_half(): return figsizes.aistats2023_half(nrows=2, ncols=3, height_to_width_ratio=1.0) +def case_figsizes_aistats2025_full(): + return figsizes.aistats2025_full(nrows=2, ncols=3, height_to_width_ratio=1.0) + + +def case_figsizes_aistats2025_half(): + return figsizes.aistats2025_half(nrows=2, ncols=3, height_to_width_ratio=1.0) + + def case_figsizes_cvpr2022_half(): return figsizes.cvpr2022_half(nrows=2, ncols=3, height_to_width_ratio=1.0) diff --git a/tests/test_rc_params_cases/case_fonts.py b/tests/test_rc_params_cases/case_fonts.py index d6e2c2e..ab58302 100644 --- a/tests/test_rc_params_cases/case_fonts.py +++ b/tests/test_rc_params_cases/case_fonts.py @@ -163,6 +163,10 @@ def case_fonts_aistats2023_tex_default(): return fonts.aistats2023_tex() +def case_fonts_aistats2025_tex_default(): + return fonts.aistats2025_tex() + + def case_fonts_aistats2022_tex_custom(): return fonts.aistats2022_tex(family="serif") @@ -171,6 +175,10 @@ def case_fonts_aistats2023_tex_custom(): return fonts.aistats2023_tex(family="serif") +def case_fonts_aistats2025_tex_custom(): + return fonts.aistats2025_tex(family="serif") + + def case_fonts_cvpr2024_default(): return fonts.cvpr2024() diff --git a/tests/test_rc_params_cases/case_fontsizes.py b/tests/test_rc_params_cases/case_fontsizes.py index 6d11305..6a85e69 100644 --- a/tests/test_rc_params_cases/case_fontsizes.py +++ b/tests/test_rc_params_cases/case_fontsizes.py @@ -47,6 +47,10 @@ def case_fontsizes_aistats2023(): return fontsizes.aistats2023() +def case_fontsizes_aistats2025(): + return fontsizes.aistats2025() + + def case_fontsizes_aaai2024(): return fontsizes.aaai2024() diff --git a/tueplots/bundles.py b/tueplots/bundles.py index 8d01031..83a6604 100644 --- a/tueplots/bundles.py +++ b/tueplots/bundles.py @@ -68,6 +68,17 @@ def aistats2023(*, column="half", nrows=1, ncols=1, family="serif"): return {**font_config, **size, **fontsize_config} +def aistats2025(*, column="half", nrows=1, ncols=1, family="serif"): + """AISTATS 2025 bundle.""" + if column == "half": + size = figsizes.aistats2025_half(nrows=nrows, ncols=ncols) + elif column == "full": + size = figsizes.aistats2025_full(nrows=nrows, ncols=ncols) + font_config = fonts.aistats2025_tex(family=family) + fontsize_config = fontsizes.aistats2025() + return {**font_config, **size, **fontsize_config} + + def aaai2024(*, column="half", nrows=1, ncols=1, family="serif", rel_width=1.0): """AAAI 2024 bundle. diff --git a/tueplots/figsizes.py b/tueplots/figsizes.py index 5ac6916..d96d13d 100644 --- a/tueplots/figsizes.py +++ b/tueplots/figsizes.py @@ -55,6 +55,16 @@ def aistats2023_full(**kwargs): return _icml_and_aistats_common_full(**kwargs) +def aistats2025_half(**kwargs): + """Double-column (half-width) figures for AISTATS 2025.""" + return _icml_and_aistats_common_half(**kwargs) + + +def aistats2025_full(**kwargs): + """Single-column (full-width) figures for AISTATS 2025.""" + return _icml_and_aistats_common_full(**kwargs) + + def _icml_and_aistats_common_half( *, nrows=1, diff --git a/tueplots/fonts.py b/tueplots/fonts.py index 439b961..08ce8c5 100644 --- a/tueplots/fonts.py +++ b/tueplots/fonts.py @@ -119,7 +119,12 @@ def aistats2022_tex(*, family="serif"): def aistats2023_tex(*, family="serif"): """Fonts for AISTATS 2023. LaTeX version.""" - return _times_tex_via_pkg_times(family=family) + return _computer_modern_tex(family=family) + + +def aistats2025_tex(*, family="serif"): + """Fonts for AISTATS 2025. LaTeX version.""" + return _computer_modern_tex(family=family) def uai2023_tex(*, family="serif"): diff --git a/tueplots/fontsizes.py b/tueplots/fontsizes.py index b57d9da..d47f606 100644 --- a/tueplots/fontsizes.py +++ b/tueplots/fontsizes.py @@ -68,6 +68,11 @@ def aistats2023(*, default_smaller=1): return _from_base(base=10 - default_smaller) +def aistats2025(*, default_smaller=1): + """Font size for AISTATS 2025.""" + return _from_base(base=10 - default_smaller) + + def aaai2024(*, default_smaller=1): """Font size for AAAI 2024.""" return _from_base(base=10 - default_smaller) From b7a4b91c3476c62c92efbcaf0364717fecdbb7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Tue, 24 Sep 2024 08:40:11 +0200 Subject: [PATCH 3/6] Implememt a test to catch unexpected 'column' arguments --- tests/test_bundles_error_handling.py | 24 ++++++++++++++++++++++++ tueplots/bundles.py | 12 ++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/test_bundles_error_handling.py diff --git a/tests/test_bundles_error_handling.py b/tests/test_bundles_error_handling.py new file mode 100644 index 0000000..da278eb --- /dev/null +++ b/tests/test_bundles_error_handling.py @@ -0,0 +1,24 @@ +"""Test that the functions in tueplots.bundles raise good errors when misused.""" + +import pytest +import pytest_cases + +from tueplots import bundles + + +def case_multicol_bundle_aistats2023(): + return bundles.aistats2023 + + +def case_multicol_bundle_aistats2025(): + return bundles.aistats2025 + + +@pytest_cases.parametrize_with_cases("multicol_bundle", cases=".") +def test_column_neither_half_nor_full_raises_value_error(multicol_bundle): + # Sanity checks + _ = multicol_bundle(column="half") + _ = multicol_bundle(column="full") + + with pytest.raises(ValueError, match="expected"): + _ = multicol_bundle(column="anything-but-half") diff --git a/tueplots/bundles.py b/tueplots/bundles.py index 83a6604..9d31dc6 100644 --- a/tueplots/bundles.py +++ b/tueplots/bundles.py @@ -63,6 +63,9 @@ def aistats2023(*, column="half", nrows=1, ncols=1, family="serif"): size = figsizes.aistats2023_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.aistats2023_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) font_config = fonts.aistats2023_tex(family=family) fontsize_config = fontsizes.aistats2023() return {**font_config, **size, **fontsize_config} @@ -74,11 +77,20 @@ def aistats2025(*, column="half", nrows=1, ncols=1, family="serif"): size = figsizes.aistats2025_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.aistats2025_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) font_config = fonts.aistats2025_tex(family=family) fontsize_config = fontsizes.aistats2025() return {**font_config, **size, **fontsize_config} +def _msg_error_wrong_column_arg(column): + msg = f"Argument column={column} unknown." + msg += "Either column='half' or column='full' expected." + return msg + + def aaai2024(*, column="half", nrows=1, ncols=1, family="serif", rel_width=1.0): """AAAI 2024 bundle. From fb972063f9d6fbcf7f0799e2e830a4cefa0944b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Tue, 24 Sep 2024 08:43:46 +0200 Subject: [PATCH 4/6] Apply the new column-arg-test to the remaining multicol templates --- tests/test_bundles_error_handling.py | 24 ++++++++++++++++++++++ tueplots/bundles.py | 30 ++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/tests/test_bundles_error_handling.py b/tests/test_bundles_error_handling.py index da278eb..5623a64 100644 --- a/tests/test_bundles_error_handling.py +++ b/tests/test_bundles_error_handling.py @@ -6,6 +6,22 @@ from tueplots import bundles +def case_multicol_bundle_cvpr2024(): + return bundles.cvpr2024 + + +def case_multicol_bundle_icml2022(): + return bundles.icml2022 + + +def case_multicol_bundle_icml2024(): + return bundles.icml2024 + + +def case_multicol_bundle_aistats2022(): + return bundles.aistats2022 + + def case_multicol_bundle_aistats2023(): return bundles.aistats2023 @@ -14,6 +30,14 @@ def case_multicol_bundle_aistats2025(): return bundles.aistats2025 +def case_multicol_bundle_aaai2024(): + return bundles.aaai2024 + + +def case_multicol_bundle_uai2024(): + return bundles.uai2023 + + @pytest_cases.parametrize_with_cases("multicol_bundle", cases=".") def test_column_neither_half_nor_full_raises_value_error(multicol_bundle): # Sanity checks diff --git a/tueplots/bundles.py b/tueplots/bundles.py index 9d31dc6..afc2b1c 100644 --- a/tueplots/bundles.py +++ b/tueplots/bundles.py @@ -10,6 +10,9 @@ def cvpr2024(*, column="half", nrows=1, ncols=1, usetex=True, family="serif"): size = figsizes.cvpr2024_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.cvpr2024_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) if usetex is True: font_config = fonts.cvpr2024_tex(family=family) elif usetex is False: @@ -24,6 +27,9 @@ def icml2022(*, column="half", nrows=1, ncols=1, usetex=True, family="serif"): size = figsizes.icml2022_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.icml2022_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) if usetex is True: font_config = fonts.icml2022_tex(family=family) elif usetex is False: @@ -38,6 +44,9 @@ def icml2024(*, column="half", nrows=1, ncols=1, usetex=True, family="serif"): size = figsizes.icml2024_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.icml2024_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) if usetex is True: font_config = fonts.icml2024_tex(family=family) elif usetex is False: @@ -52,6 +61,9 @@ def aistats2022(*, column="half", nrows=1, ncols=1, family="serif"): size = figsizes.aistats2022_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.aistats2022_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) font_config = fonts.aistats2022_tex(family=family) fontsize_config = fontsizes.aistats2022() return {**font_config, **size, **fontsize_config} @@ -85,12 +97,6 @@ def aistats2025(*, column="half", nrows=1, ncols=1, family="serif"): return {**font_config, **size, **fontsize_config} -def _msg_error_wrong_column_arg(column): - msg = f"Argument column={column} unknown." - msg += "Either column='half' or column='full' expected." - return msg - - def aaai2024(*, column="half", nrows=1, ncols=1, family="serif", rel_width=1.0): """AAAI 2024 bundle. @@ -100,6 +106,9 @@ def aaai2024(*, column="half", nrows=1, ncols=1, family="serif", rel_width=1.0): size = figsizes.aaai2024_half(nrows=nrows, ncols=ncols, rel_width=rel_width) elif column == "full": size = figsizes.aaai2024_full(nrows=nrows, ncols=ncols, rel_width=rel_width) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) font_config = fonts.aaai2024_tex(family=family) fontsize_config = fontsizes.aaai2024() return {**font_config, **size, **fontsize_config} @@ -111,11 +120,20 @@ def uai2023(*, column="half", nrows=1, ncols=1, family="serif"): size = figsizes.uai2023_half(nrows=nrows, ncols=ncols) elif column == "full": size = figsizes.uai2023_full(nrows=nrows, ncols=ncols) + else: + msg = _msg_error_wrong_column_arg(column) + raise ValueError(msg) font_config = fonts.uai2023_tex(family=family) fontsize_config = fontsizes.uai2023() return {**font_config, **size, **fontsize_config} +def _msg_error_wrong_column_arg(column): + msg = f"Argument column={column} unknown." + msg += "Either column='half' or column='full' expected." + return msg + + def eccv2024(*, rel_width=1.0, nrows=1, ncols=1, family="serif"): """ECCV 2024 bundle.""" size = figsizes.eccv2024(rel_width=rel_width, nrows=nrows, ncols=ncols) From cd7dc6f3bdf9b547c4303b8fb19ea3993a13ca6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Tue, 24 Sep 2024 08:46:06 +0200 Subject: [PATCH 5/6] Implement the multicol test-case via tags to enable reusing them for tex-or-not tests --- tests/test_bundles_error_handling.py | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/tests/test_bundles_error_handling.py b/tests/test_bundles_error_handling.py index 5623a64..3591cff 100644 --- a/tests/test_bundles_error_handling.py +++ b/tests/test_bundles_error_handling.py @@ -6,43 +6,51 @@ from tueplots import bundles -def case_multicol_bundle_cvpr2024(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_cvpr2024(): return bundles.cvpr2024 -def case_multicol_bundle_icml2022(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_icml2022(): return bundles.icml2022 -def case_multicol_bundle_icml2024(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_icml2024(): return bundles.icml2024 -def case_multicol_bundle_aistats2022(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_aistats2022(): return bundles.aistats2022 -def case_multicol_bundle_aistats2023(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_aistats2023(): return bundles.aistats2023 -def case_multicol_bundle_aistats2025(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_aistats2025(): return bundles.aistats2025 -def case_multicol_bundle_aaai2024(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_aaai2024(): return bundles.aaai2024 -def case_multicol_bundle_uai2024(): +@pytest_cases.case(tags=["multicol"]) +def case_bundle_uai2024(): return bundles.uai2023 -@pytest_cases.parametrize_with_cases("multicol_bundle", cases=".") -def test_column_neither_half_nor_full_raises_value_error(multicol_bundle): +@pytest_cases.parametrize_with_cases("bundle_fun", cases=".", has_tag=["multicol"]) +def test_column_neither_half_nor_full_raises_value_error(bundle_fun): # Sanity checks - _ = multicol_bundle(column="half") - _ = multicol_bundle(column="full") + _ = bundle_fun(column="half") + _ = bundle_fun(column="full") with pytest.raises(ValueError, match="expected"): - _ = multicol_bundle(column="anything-but-half") + _ = bundle_fun(column="anything-but-half") From 6808e91dcf2e178e66f30bd421b58787b7390a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Tue, 24 Sep 2024 08:56:50 +0200 Subject: [PATCH 6/6] Apply the usetex-test to all other tex-or-not bundles --- tests/test_bundles_error_handling.py | 46 ++++++++++++++++++++++-- tueplots/bundles.py | 52 ++++++++++++++++++++-------- 2 files changed, 81 insertions(+), 17 deletions(-) diff --git a/tests/test_bundles_error_handling.py b/tests/test_bundles_error_handling.py index 3591cff..cddd8ca 100644 --- a/tests/test_bundles_error_handling.py +++ b/tests/test_bundles_error_handling.py @@ -6,17 +6,17 @@ from tueplots import bundles -@pytest_cases.case(tags=["multicol"]) +@pytest_cases.case(tags=["multicol", "tex_or_not"]) def case_bundle_cvpr2024(): return bundles.cvpr2024 -@pytest_cases.case(tags=["multicol"]) +@pytest_cases.case(tags=["multicol", "tex_or_not"]) def case_bundle_icml2022(): return bundles.icml2022 -@pytest_cases.case(tags=["multicol"]) +@pytest_cases.case(tags=["multicol", "tex_or_not"]) def case_bundle_icml2024(): return bundles.icml2024 @@ -46,6 +46,36 @@ def case_bundle_uai2024(): return bundles.uai2023 +@pytest_cases.case(tags=["tex_or_not"]) +def case_bundle_neurips2021(): + return bundles.neurips2021 + + +@pytest_cases.case(tags=["tex_or_not"]) +def case_bundle_neurips2022(): + return bundles.neurips2022 + + +@pytest_cases.case(tags=["tex_or_not"]) +def case_bundle_neurips2023(): + return bundles.neurips2023 + + +@pytest_cases.case(tags=["tex_or_not"]) +def case_bundle_neurips2024(): + return bundles.neurips2024 + + +@pytest_cases.case(tags=["tex_or_not"]) +def case_bundle_iclr2023(): + return bundles.iclr2023 + + +@pytest_cases.case(tags=["tex_or_not"]) +def case_bundle_iclr2024(): + return bundles.iclr2024 + + @pytest_cases.parametrize_with_cases("bundle_fun", cases=".", has_tag=["multicol"]) def test_column_neither_half_nor_full_raises_value_error(bundle_fun): # Sanity checks @@ -54,3 +84,13 @@ def test_column_neither_half_nor_full_raises_value_error(bundle_fun): with pytest.raises(ValueError, match="expected"): _ = bundle_fun(column="anything-but-half") + + +@pytest_cases.parametrize_with_cases("bundle_fun", cases=".", has_tag=["tex_or_not"]) +def test_usetex_must_be_bool_otherwise_type_error(bundle_fun): + # Sanity checks + _ = bundle_fun(usetex=True) + _ = bundle_fun(usetex=False) + + with pytest.raises(ValueError, match="expected"): + _ = bundle_fun(usetex=2) diff --git a/tueplots/bundles.py b/tueplots/bundles.py index afc2b1c..c0613b8 100644 --- a/tueplots/bundles.py +++ b/tueplots/bundles.py @@ -11,12 +11,14 @@ def cvpr2024(*, column="half", nrows=1, ncols=1, usetex=True, family="serif"): elif column == "full": size = figsizes.cvpr2024_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) if usetex is True: font_config = fonts.cvpr2024_tex(family=family) elif usetex is False: font_config = fonts.cvpr2024(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) fontsize_config = fontsizes.cvpr2024() return {**font_config, **size, **fontsize_config} @@ -28,12 +30,14 @@ def icml2022(*, column="half", nrows=1, ncols=1, usetex=True, family="serif"): elif column == "full": size = figsizes.icml2022_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) if usetex is True: font_config = fonts.icml2022_tex(family=family) elif usetex is False: font_config = fonts.icml2022(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) fontsize_config = fontsizes.icml2022() return {**font_config, **size, **fontsize_config} @@ -45,12 +49,14 @@ def icml2024(*, column="half", nrows=1, ncols=1, usetex=True, family="serif"): elif column == "full": size = figsizes.icml2024_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) if usetex is True: font_config = fonts.icml2024_tex(family=family) elif usetex is False: font_config = fonts.icml2024(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) fontsize_config = fontsizes.icml2024() return {**font_config, **size, **fontsize_config} @@ -62,7 +68,7 @@ def aistats2022(*, column="half", nrows=1, ncols=1, family="serif"): elif column == "full": size = figsizes.aistats2022_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) font_config = fonts.aistats2022_tex(family=family) fontsize_config = fontsizes.aistats2022() @@ -76,7 +82,7 @@ def aistats2023(*, column="half", nrows=1, ncols=1, family="serif"): elif column == "full": size = figsizes.aistats2023_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) font_config = fonts.aistats2023_tex(family=family) fontsize_config = fontsizes.aistats2023() @@ -90,7 +96,7 @@ def aistats2025(*, column="half", nrows=1, ncols=1, family="serif"): elif column == "full": size = figsizes.aistats2025_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) font_config = fonts.aistats2025_tex(family=family) fontsize_config = fontsizes.aistats2025() @@ -107,7 +113,7 @@ def aaai2024(*, column="half", nrows=1, ncols=1, family="serif", rel_width=1.0): elif column == "full": size = figsizes.aaai2024_full(nrows=nrows, ncols=ncols, rel_width=rel_width) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) font_config = fonts.aaai2024_tex(family=family) fontsize_config = fontsizes.aaai2024() @@ -121,19 +127,13 @@ def uai2023(*, column="half", nrows=1, ncols=1, family="serif"): elif column == "full": size = figsizes.uai2023_full(nrows=nrows, ncols=ncols) else: - msg = _msg_error_wrong_column_arg(column) + msg = _msg_error_wrong_arg_column(column) raise ValueError(msg) font_config = fonts.uai2023_tex(family=family) fontsize_config = fontsizes.uai2023() return {**font_config, **size, **fontsize_config} -def _msg_error_wrong_column_arg(column): - msg = f"Argument column={column} unknown." - msg += "Either column='half' or column='full' expected." - return msg - - def eccv2024(*, rel_width=1.0, nrows=1, ncols=1, family="serif"): """ECCV 2024 bundle.""" size = figsizes.eccv2024(rel_width=rel_width, nrows=nrows, ncols=ncols) @@ -164,6 +164,8 @@ def neurips2021(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif") font_config = fonts.neurips2021_tex(family=family) elif usetex is False: font_config = fonts.neurips2021(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) size = figsizes.neurips2021(rel_width=rel_width, nrows=nrows, ncols=ncols) fontsize_config = fontsizes.neurips2021() return {**font_config, **size, **fontsize_config} @@ -175,6 +177,8 @@ def neurips2022(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif") font_config = fonts.neurips2022_tex(family=family) elif usetex is False: font_config = fonts.neurips2022(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) size = figsizes.neurips2022(rel_width=rel_width, nrows=nrows, ncols=ncols) fontsize_config = fontsizes.neurips2022() return {**font_config, **size, **fontsize_config} @@ -186,6 +190,8 @@ def neurips2023(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif") font_config = fonts.neurips2023_tex(family=family) elif usetex is False: font_config = fonts.neurips2023(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) size = figsizes.neurips2023(rel_width=rel_width, nrows=nrows, ncols=ncols) fontsize_config = fontsizes.neurips2023() return {**font_config, **size, **fontsize_config} @@ -197,6 +203,8 @@ def neurips2024(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif") font_config = fonts.neurips2024_tex(family=family) elif usetex is False: font_config = fonts.neurips2024(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) size = figsizes.neurips2024(rel_width=rel_width, nrows=nrows, ncols=ncols) fontsize_config = fontsizes.neurips2024() return {**font_config, **size, **fontsize_config} @@ -208,6 +216,8 @@ def iclr2023(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif"): font_config = fonts.iclr2023_tex(family=family) elif usetex is False: font_config = fonts.iclr2023(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) size = figsizes.iclr2023(rel_width=rel_width, nrows=nrows, ncols=ncols) fontsize_config = fontsizes.iclr2023() return {**font_config, **size, **fontsize_config} @@ -219,11 +229,25 @@ def iclr2024(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif"): font_config = fonts.iclr2024_tex(family=family) elif usetex is False: font_config = fonts.iclr2024(family=family) + else: + raise ValueError(_msg_error_wrong_arg_usetex(usetex)) size = figsizes.iclr2024(rel_width=rel_width, nrows=nrows, ncols=ncols) fontsize_config = fontsizes.iclr2024() return {**font_config, **size, **fontsize_config} +def _msg_error_wrong_arg_usetex(usetex): + msg = f"Argument usetex={usetex} unknown." + msg += "Either usetex=True or usetex=False expected." + return msg + + +def _msg_error_wrong_arg_column(column): + msg = f"Argument column={column} unknown." + msg += "Either column='half' or column='full' expected." + return msg + + def beamer_moml( *, rel_width=1.0,