Skip to content

Rewrite core.  #123

@korsbo

Description

@korsbo

Internally, latexify operates mainly on strings that are being passed around. This works but it is starting to become limiting.

problems with the current approach:

  • Low customisability. Customization of the results rely on kwargs being passed to some conditional within the internal functions. If explicit support has not been added for something, it can't be done.
  • Sensitive testing. The only thing that can currently be tested is whether the output string matches some literal string. Tests are, therefore, sensitive to minor updates that affect the output string even if it does not really affect the resulting rendered equations. It becomes problematic to determine what should be part of the API. We could say that minor changes to the output could change with patch version releases and that they are not part of the API. But, then, external packages can't test their recipes in a stable way. However, the alternative is that most things in latexify can't be updated without a major release.

Proposed solution:

  • delay the processing of strings to the very last part of the process.
  • build the envs and equations using types instead.
  • have methods for converting these nested types to latex. Do this modularly and allow for over-loading. That way, one can customise the output by overloading something like generate_string(op::Fraction) = "$(op.args[1])/$(op.args[2])" rather than the usual \frac.
  • make it possible to output these types rather than a string. That way, one can do testing that is insensitive to formatting updates.

These ideas are still tentative and open for input.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions