1

I am writing code to automatically generate TeX files for biology paper supplementary materials. Specifically, long tables which list the genes in cellular genetic regulatory networks. These tables will occasionally run to 60 pages in PDF form, so the TeX needs to work without hand tweaking, and without knowing ahead of time what the specific content will be.

Part of these tables are logical expressions which determine whether a given gene is active or not, depending on the inputs of the genes that control it. These expressions can be somewhat involved, so the breqn package is necessary to prevent them running off the page. If I typeset the expressions with binary operator symbols (eg \wedge), breqn breaks the expression fine. The problem is that the biology research community does not use these symbols, preferring actual words (eg and) as operators, as most biologists did not come up in a mathematical tradition, and as such \wedge would be meaningless. The problem is that if I use \DeclareMathOperator to make the words and, or, & not into operators, breqn will not break the expression on them.

Have I used dmath* incorrectly? Is this a bug in breqn? MWE below.

\documentclass{article}

\usepackage{amsmath}
\usepackage{flexisym}
\usepackage{breqn}

\DeclareMathOperator{\andop}{and}
\DeclareMathOperator{\orop}{or}
\DeclareMathOperator{\notop}{not}

\usepackage{longtable}
\usepackage{booktabs}
\usepackage{array}
\usepackage[margin=1.0in]{geometry}
\newcommand*{\nodeoneaspec}{0.14\textwidth{}-2\tabcolsep}
\newcommand*{\nodeonebspec}{0.86\textwidth{}-2\tabcolsep}
\newcommand*{\nodetwoaspec}{0.14\textwidth{}-2\tabcolsep}
\newcommand*{\nodetwobspec}{0.13\textwidth{}-2\tabcolsep}
\newcommand*{\nodetwocspec}{0.73\textwidth{}-2\tabcolsep}
\begin{document}
\section{Description of the modules of Model A. 
}
\begin{longtable}[c]{@{}llll@{}}
\caption{Support for the  modules of Restriction\_{}SW}\\
\toprule
\multicolumn{1}{p{\nodeoneaspec}}{Target Node}&\multicolumn{3}{m{\nodeonebspec}}{Node Gate}\\
\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{Node Type}&\multicolumn{2}{m{\nodetwocspec}}{Node Description}\\
\midrule

\endhead

\multicolumn{1}{p{\nodeoneaspec}}{CyclinD1}
& \multicolumn{3}{m{\nodeonebspec}}{\begin{dmath*} \mathbf{{CyclinD1}_{1}}=\left(\notop\mathbf{{Replication}_{1}}\right)\andop\left(\left(\left(\mathbf{{Myc}_{1}}\andop\mathbf{{E2F1}_{1}}\right)\andop\left(\left(\left(\notop\mathbf{{p21\_{}B}_{1}}\right)\orop\left(\left(\mathbf{{CyclinD1}_{1}}\orop\mathbf{{GF}_{1}}\right)\andop\left(\notop\left(\mathbf{{p21\_{}B}_{1}}\andop\mathbf{{pRB}_{1}}\right)\right)\right)\right)\orop\left(\mathbf{{CyclinD1}_{1}}\andop\mathbf{{GF}_{1}}\right)\right)\right)\orop\left(\left(\left(\mathbf{{Myc}_{1}}\orop\mathbf{{E2F1}_{1}}\right)\andop\left(\notop\mathbf{{p21\_{}B}_{1}}\right)\right)\andop\left(\mathbf{{GF}_{1}}\orop\mathbf{{CyclinD1}_{1}}\right)\right)\right)\end{dmath*}
}

\\

\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{{\footnotesize{}PRC}}&\multicolumn{2}{m{\nodetwocspec}}{Ongoing \textit{Replication} inhibits \textit{CyclinD1}. Under ideal conditions for its activation, namely when \textit{GF} are present and $p21_B$ is inactive, \textit{CyclinD1} is transcribed by either \textit{Myc} OR  \textit{E2F1}, and active. Under non-ideal conditions, we assume that both  \textit{Myc} AND  \textit{E2F1} are required for \textit{CyclinD1} transcription; in addition, \textit{CyclinD1} activity requires the absence of inhibition from $p21_B$, OR the presence of \textit{GF} as well as already active \textit{CyclinD1} or deactivated \textit{RB}.}
\\
\bottomrule
\end{longtable}

\begin{longtable}[c]{@{}llll@{}}
\caption{Support for the  modules of Restriction\_{}SW}\\
\toprule
\multicolumn{1}{p{\nodeoneaspec}}{Target Node}&\multicolumn{3}{m{\nodeonebspec}}{Node Gate}\\
\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{Node Type}&\multicolumn{2}{m{\nodetwocspec}}{Node Description}\\
\midrule

\endhead

\multicolumn{1}{p{\nodeoneaspec}}{CyclinD1}
& \multicolumn{3}{m{\nodeonebspec}}{\begin{dmath*} \mathbf{{CyclinD1}_{1}}=\left(\neg\mathbf{{Replication}_{1}}\right)\wedge\left(\left(\left(\mathbf{{Myc}_{1}}\wedge\mathbf{{E2F1}_{1}}\right)\wedge\left(\left(\left(\neg\mathbf{{p21\_{}B}_{1}}\right)\vee\left(\left(\mathbf{{CyclinD1}_{1}}\vee\mathbf{{GF}_{1}}\right)\wedge\left(\neg\left(\mathbf{{p21\_{}B}_{1}}\wedge\mathbf{{pRB}_{1}}\right)\right)\right)\right)\vee\left(\mathbf{{CyclinD1}_{1}}\wedge\mathbf{{GF}_{1}}\right)\right)\right)\vee\left(\left(\left(\mathbf{{Myc}_{1}}\vee\mathbf{{E2F1}_{1}}\right)\wedge\left(\neg\mathbf{{p21\_{}B}_{1}}\right)\right)\wedge\left(\mathbf{{GF}_{1}}\vee\mathbf{{CyclinD1}_{1}}\right)\right)\right)\end{dmath*}
}

\\

\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{{\footnotesize{}PRC}}&\multicolumn{2}{m{\nodetwocspec}}{Ongoing \textit{Replication} inhibits \textit{CyclinD1}. Under ideal conditions for its activation, namely when \textit{GF} are present and $p21_B$ is inactive, \textit{CyclinD1} is transcribed by either \textit{Myc} OR  \textit{E2F1}, and active. Under non-ideal conditions, we assume that both  \textit{Myc} AND  \textit{E2F1} are required for \textit{CyclinD1} transcription; in addition, \textit{CyclinD1} activity requires the absence of inhibition from $p21_B$, OR the presence of \textit{GF} as well as already active \textit{CyclinD1} or deactivated \textit{RB}.}
\\
\bottomrule
\end{longtable}

\end{document}
2
  • I guess you need to use \DeclareFlexCompoundSymbol, but in my experiment breaks are bad anyway.
    – egreg
    Jun 16 '20 at 22:12
  • \DeclareMathOperator declares prefix functions like log and sin so you would not expect to break as you would at \wedge which is infix (which is what you want in this context) Jun 16 '20 at 22:18
1

I'd be tempted just to use inline math rather than breqn here

enter image description here




\documentclass{article}

\usepackage{amsmath}


\newcommand{\andop}{\mathbin{\mathrm{and}}}
\newcommand{\orop}{\mathbin{\mathrm{or}}}
\newcommand{\notop}{\mathop{\mathrm{not}}}


\usepackage{longtable}
\usepackage{booktabs}
\usepackage{array}
\usepackage[margin=1.0in]{geometry}
\newcommand*{\nodeoneaspec}{\dimexpr 0.14\textwidth-2\tabcolsep}
\newcommand*{\nodeonebspec}{\dimexpr 0.86\textwidth-2\tabcolsep}
\newcommand*{\nodetwoaspec}{\dimexpr 0.14\textwidth-2\tabcolsep}
\newcommand*{\nodetwobspec}{\dimexpr 0.13\textwidth-2\tabcolsep}
\newcommand*{\nodetwocspec}{\dimexpr 0.73\textwidth-2\tabcolsep}
\begin{document}
\section{Description of the modules of Model A. 
}
\begin{longtable}[c]{@{}llll@{}}
\caption{Support for the  modules of Restriction\_{}SW}\\
\toprule
\multicolumn{1}{p{\nodeoneaspec}}{Target Node}&\multicolumn{3}{m{\nodeonebspec}}{Node Gate}\\
\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{Node Type}&\multicolumn{2}{m{\nodetwocspec}}{Node Description}\\
\midrule

\endhead

\multicolumn{1}{p{\nodeoneaspec}}{CyclinD1}
& \multicolumn{3}{m{\nodeonebspec}}{
$\displaystyle\let\left\relax\let\right\relax
 \mathbf{{CyclinD1}_{1}}=\left(\notop\mathbf{{Replication}_{1}}\right)\andop\left(\left(\left(\mathbf{{Myc}_{1}}\andop\mathbf{{E2F1}_{1}}\right)\andop\left(\left(\left(\notop\mathbf{{p21\_{}B}_{1}}\right)\orop\left(\left(\mathbf{{CyclinD1}_{1}}\orop\mathbf{{GF}_{1}}\right)\andop\left(\notop\left(\mathbf{{p21\_{}B}_{1}}\andop\mathbf{{pRB}_{1}}\right)\right)\right)\right)\orop\left(\mathbf{{CyclinD1}_{1}}\andop\mathbf{{GF}_{1}}\right)\right)\right)\orop\left(\left(\left(\mathbf{{Myc}_{1}}\orop\mathbf{{E2F1}_{1}}\right)\andop\left(\notop\mathbf{{p21\_{}B}_{1}}\right)\right)\andop\left(\mathbf{{GF}_{1}}\orop\mathbf{{CyclinD1}_{1}}\right)\right)\right)$
}

\\

\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{{\footnotesize{}PRC}}&\multicolumn{2}{m{\nodetwocspec}}{Ongoing \textit{Replication} inhibits \textit{CyclinD1}. Under ideal conditions for its activation, namely when \textit{GF} are present and $p21_B$ is inactive, \textit{CyclinD1} is transcribed by either \textit{Myc} OR  \textit{E2F1}, and active. Under non-ideal conditions, we assume that both  \textit{Myc} AND  \textit{E2F1} are required for \textit{CyclinD1} transcription; in addition, \textit{CyclinD1} activity requires the absence of inhibition from $p21_B$, OR the presence of \textit{GF} as well as already active \textit{CyclinD1} or deactivated \textit{RB}.}
\\
\bottomrule
\end{longtable}

\begin{longtable}[c]{@{}llll@{}}
\caption{Support for the  modules of Restriction\_{}SW}\\
\toprule
\multicolumn{1}{p{\nodeoneaspec}}{Target Node}&\multicolumn{3}{m{\nodeonebspec}}{Node Gate}\\
\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{Node Type}&\multicolumn{2}{m{\nodetwocspec}}{Node Description}\\
\midrule

\endhead

\multicolumn{1}{p{\nodeoneaspec}}{CyclinD1}
& \multicolumn{3}{m{\nodeonebspec}}{
$\displaystyle\let\left\relax\let\right\relax
\mathbf{{CyclinD1}_{1}}=\left(\neg\mathbf{{Replication}_{1}}\right)\wedge\left(\left(\left(\mathbf{{Myc}_{1}}\wedge\mathbf{{E2F1}_{1}}\right)\wedge\left(\left(\left(\neg\mathbf{{p21\_{}B}_{1}}\right)\vee\left(\left(\mathbf{{CyclinD1}_{1}}\vee\mathbf{{GF}_{1}}\right)\wedge\left(\neg\left(\mathbf{{p21\_{}B}_{1}}\wedge\mathbf{{pRB}_{1}}\right)\right)\right)\right)\vee\left(\mathbf{{CyclinD1}_{1}}\wedge\mathbf{{GF}_{1}}\right)\right)\right)\vee\left(\left(\left(\mathbf{{Myc}_{1}}\vee\mathbf{{E2F1}_{1}}\right)\wedge\left(\neg\mathbf{{p21\_{}B}_{1}}\right)\right)\wedge\left(\mathbf{{GF}_{1}}\vee\mathbf{{CyclinD1}_{1}}\right)\right)\right)
$
}

\\

\multicolumn{1}{m{\nodetwoaspec}}{}&\multicolumn{1}{m{\nodetwobspec}}{{\footnotesize{}PRC}}&\multicolumn{2}{m{\nodetwocspec}}{Ongoing \textit{Replication} inhibits \textit{CyclinD1}. Under ideal conditions for its activation, namely when \textit{GF} are present and $p21_B$ is inactive, \textit{CyclinD1} is transcribed by either \textit{Myc} OR  \textit{E2F1}, and active. Under non-ideal conditions, we assume that both  \textit{Myc} AND  \textit{E2F1} are required for \textit{CyclinD1} transcription; in addition, \textit{CyclinD1} activity requires the absence of inhibition from $p21_B$, OR the presence of \textit{GF} as well as already active \textit{CyclinD1} or deactivated \textit{RB}.}
\\
\bottomrule
\end{longtable}

\end{document}
0

The idea should be to use \DeclareFlexCompoundSymbol, so the breqn infrastructure can be applied.

\documentclass{article}

\usepackage{amsmath}
\usepackage{breqn}

\DeclareFlexCompoundSymbol{\andop}{Bin}{\text{\normalfont and}}
\DeclareFlexCompoundSymbol{\orop}{Bin}{\text{\normalfont or}}
\DeclareMathOperator{\notop}{not}

\begin{document}

\parbox{3cm}{
  \begin{dmath*}
    A\land B\lor \lnot C\land D\land E\land F
  \end{dmath*}
}\quad
\parbox{3cm}{
  \begin{dmath*}
    A\andop B\orop \notop C\andop D\andop E\andop F
  \end{dmath*}
}\quad
\parbox{2cm}{
  \begin{dmath*}
    A\andop B\orop \notop C\andop D\andop E\andop F
  \end{dmath*}
}

\end{document}

I'm not sure whether you'll be able to break your complex formulas, though.

The \text{\normalfont and} is needed because apparently flexisym ignores the more natural \mathrm.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.