Skip to content

Instantly share code, notes, and snippets.

@dginev
Last active November 21, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dginev/13e982e8e98f6ddf19d4804abbd31663 to your computer and use it in GitHub Desktop.
Save dginev/13e982e8e98f6ddf19d4804abbd31663 to your computer and use it in GitHub Desktop.
A temporary quickfix for basic breqn.sty use with latexml
# -*- CPERL -*-
# /=====================================================================\ #
# | breqn.sty | #
# | Simple temporary patch for LaTeXML | #
# |=====================================================================| #
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;
#**********************************************************************
RequirePackage('amsmath');
Let(T_CS('\begin{dmath}'), '\align');
Let(T_CS('\end{dmath}'), '\endalign');
Let(T_CS('\begin{dmath*}'), '\align*');
Let(T_CS('\end{dmath*}'), '\endalign*');
Let(T_CS('\begin{dgroup}'), '\align');
Let(T_CS('\end{dgroup}'), '\endalign');
Let(T_CS('\begin{dgroup*}'), '\align*');
Let(T_CS('\end{dgroup*}'), '\endalign*');
DefMacro('\condition[]{}', sub {
my ($gullet, $delim, $content) = @_;
$delim = defined $delim ? ToString($delim) : ", ";
return (T_CS('\text'), T_BEGIN, Explode($delim), $content, T_END);
});
#**********************************************************************
1;
\documentclass{article}
\usepackage{breqn}
\begin{document}
\begin{dmath}
f(x)=\frac{1}{x} \condition{for $x\neq 0$}
\end{dmath}
\begin{dmath*}
f(x)=\frac{1}{x} \condition{for $x\neq 0$}
\end{dmath*}
\begin{dgroup}
f(x)=\frac{1}{x} \condition{for $x\neq 0$}
\end{dgroup}
\begin{dgroup*}
f(x)=\frac{1}{x} \condition{for $x\neq 0$}
\end{dgroup*}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment