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

Improve depiction of Latex in GAMS-created docs #721

Merged
merged 3 commits into from
Jun 26, 2023

Conversation

glatterf42
Copy link
Member

@glatterf42 glatterf42 commented Jun 20, 2023

This PR puts all strings with more than two characters in \text{}, which should help the depiction of long formulae in particular. Note that some single characters have seen the same fate, especially in macro_core.gms, because it would have appeared inconsistent to have some parameters in a table be in \text{} and not others if they represent the same thing thematically.

How to review

  • Read the diff and note that the CI checks all pass.
  • Build the documentation and look at the 'Mathematical Specification' pages.

PR checklist

@glatterf42 glatterf42 added enh New features & functionality docs Documentation labels Jun 20, 2023
@glatterf42 glatterf42 self-assigned this Jun 20, 2023
@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #721 (587cc00) into main (3cd004a) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##            main    #721   +/-   ##
=====================================
  Coverage   94.4%   94.4%           
=====================================
  Files         43      43           
  Lines       3448    3448           
=====================================
  Hits        3257    3257           
  Misses       191     191           

Copy link
Member

@khaeru khaeru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for thoroughly going through this, @glatterf42.

Approved, with one minor request:

  • Update release notes.

I think it's worth advertising this, as IMHO it's a significant improvement in readability. It could be like:

- Improve readability of LaTeX equations in docs (:pull:`721`).

Some other notes for posterity:

  • We had a discussion in Slack about the merits of using \text{…} explicitly (e.g. \text{beyond_horizon_factor} versus expanding this code in the Sphinx config

    message_ix/doc/conf.py

    Lines 141 to 157 in 3cd004a

    # TODO read at least some of these from message_ix.models
    # TODO complete list
    # TODO also add these to a LaTeX preamble
    text_macros = """ACT
    STORAGE
    STORAGE_CHARGE
    duration_time_rel
    input
    map_time_commodity_storage
    storage_initial
    storage_self_discharge"""
    mathjax3_config = dict(
    tex=dict(
    macros={k.replace("_", ""): r"\text{" + k + "}" for k in text_macros.split()},
    ),
    )
    which would define a TeX commands (e.g. \beyondhorizonfactor). We decided for the former for now a variety of reasons.
  • Building PDF version of the docs from LaTeX fails locally #722 is related but (IMHO properly) kept separate and not scheduled for now.

@glatterf42 glatterf42 merged commit 3a8910b into iiasa:main Jun 26, 2023
@glatterf42 glatterf42 deleted the fix/latex-core branch June 26, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation enh New features & functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants