Reusing Math Symbols

Using the extends functionality of MyST configuration to reuse macros and other information

Abstract

We present an example to demonstrates inheritance of math macros and other project information from a separate file. This functionality is presented through MyST (https://mystmd.org) and provides the ability to share configuration between projects. This can be used for authors, affiliations site config, etc. In this example, we are interested in reuse of math macros, which in many domains define the way that you can refer to equations and concepts in the literature.

Keywords:MyST MarkdownStructured DataReuseLaTeXMath MacrosFAIR data principles

Example

In the example below we are writing content that references math macros that are from a shared configuration, which could be part of a shared or curated repository.

The residual is the predicted data for the model, dpred(m)\dpred{m}, minus the observed data, dobs\dobs. You can also calculate the predicted data for the reference model dpred(mref)\dpred{\mref}.

The macros are quite commonly used in geophysics, and could be shared between one or more teams. The configuration takes a URL in addition to a local file.

How it works

myst.yml
1
2
3
version: 1
extends:
  - math-macros.yml
math-macros.yml
version: 1
project:
  math:
    '\dobs':
      title: Observed Data
      macro: '\mathbf{d}_\text{obs}'
    '\dpred':
      title: Predicted Data
      macro: '\mathbf{d}_\text{pred}\left( #1 \right)'
    '\mref':
      title: Reference Model
      macro: '\mathbf{m}_\text{ref}'

Acknowledgments

The work was completed by Franklin and Rowan in MyST in June 2024, created in #1215. Funding was provided by John’s Hopkins Open Source Program Office Grant awarded to Alan Lujan. Chris Carroll provided many LaTeX macros and examples for inspiration.

Curvenote ResearchCurvenote Research
Tools to improve science communication