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.
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, , minus the observed data, . You can also calculate the predicted data for the reference model .
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¶
1 2 3
version: 1 extends: - 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}'