end-of-semester-report/node_modules/@unified-latex/unified-latex-util-align
2025-05-14 16:14:35 +07:00
..
index.cjs initial commit 2025-05-14 16:14:35 +07:00
index.cjs.map initial commit 2025-05-14 16:14:35 +07:00
index.d.ts initial commit 2025-05-14 16:14:35 +07:00
index.js initial commit 2025-05-14 16:14:35 +07:00
index.js.map initial commit 2025-05-14 16:14:35 +07:00
package.json initial commit 2025-05-14 16:14:35 +07:00
README.md initial commit 2025-05-14 16:14:35 +07:00

unified-latex-util-align

What is this?

Functions to parse an analyze "align" environments like \begin{align}...\end{align} or \begin{bmatrix}...\end{bmatrix}.

When should I use this?

If you need to process the contents of an align environment for, e.g., pretty-printing.

Install

npm install @unified-latex/unified-latex-util-align

This package contains both esm and commonjs exports. To explicitly access the esm export, import the .js file. To explicitly access the commonjs export, import the .cjs file.

Functions

createMatchers(rowSepMacros, colSep)

function createMatchers(
  rowSepMacros: string[],
  colSep: string[]
): {
  isRowSep: Ast.TypeGuard<Ast.Macro & { content: string }>;
  isColSep: (node: Ast.Node) => boolean;
  isWhitespace: (node: Ast.Node) => node is Ast.Whitespace;
  isSameLineComment: (node: Ast.Node) => boolean;
  isOwnLineComment: (node: Ast.Node) => boolean;
};

Parameters

Param Type
rowSepMacros string[]
colSep string[]

parseAlignEnvironment(ast, colSep, rowSepMacros)

Parse the content of an align environment into an array of row objects. Each row object looks like

 {
   cells: [...],
   colSeps: [...],
   rowSep: ...,
   trailingComment: ...
 }

... may be an ast node or null.

function parseAlignEnvironment(
  ast: Ast.Node[],
  colSep: string[],
  rowSepMacros: string[]
): Row[];

Parameters

Param Type
ast Ast.Node[]
colSep string[]
rowSepMacros string[]