我正在编写代码来自动生成生物学论文补充材料的 TeX 文件。具体来说,就是列出细胞基因调控网络中基因的长表。这些表格在 PDF 格式中有时会长达 60 页,因此 TeX 需要在无需手动调整的情况下工作,并且事先不知道具体内容是什么。
这些表的一部分是逻辑表达式,它们根据控制该基因的基因的输入来确定给定基因是否处于活性状态。这些表达式可能有些复杂,因此breqn
需要该包来防止它们超出页面范围。如果我用二元运算符号(例如\wedge
)排版表达式,breqn
则会破坏表达式。问题是生物学研究界不使用这些符号,而是更喜欢使用实际的单词(例如and
)作为运算符,因为大多数生物学家并不是数学传统出身,因此这样\wedge
毫无意义。问题是,如果我使用\DeclareMathOperator
将单词 and、or 和 & not 变成运算符,breqn
则不会破坏它们的表达式。
我是否使用dmath*
错误?这是下面的 MWE 中的错误吗breqn
?
\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}
答案1
我很想在这里使用内联数学,而不是 breqn
\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}
答案2
想法应该是使用\DeclareFlexCompoundSymbol
,这样breqn
基础设施就可以应用。
\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}
但我不确定你是否能够破解复杂的公式。
是\text{\normalfont and}
需要的,因为显然flexisym
忽略了更自然的\mathrm
。