因此,这是我的代码:
\usepackage{amsthm}
\begin{theorem}
...could be now considered as an algebraic structure $DB_E =
\left\langle \mathbb{S},\allowbreak \mathbb{E},\allowbreak
f,\allowbreak \mathbb{V},\allowbreak \mathbb{R},\allowbreak
\mathbb{C},\allowbreak Op_a,\allowbreak Op_c,\allowbreak
Op_m \right\rangle$.
\end{theorem}
结果如下(灰色区域表示页面边缘):
显然,\allowbreak
什么也不做。为什么呢?
答案1
这是另一种情况\left
,并且\right
不适用:
没有可以增加大小的分隔符;
逗号后的空格不能与同一行中的其他空格一起参与拉伸或收缩;
在任何情况下,该公式都不会跨越界限。
因此,要做的第一步是删除\left
和\right
(并禁用编辑器中的任何自动功能)。然后仔细放置\linebreak[0]
将有助于分页。
\documentclass[a4paper]{article}
\usepackage{amsfonts,amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\noindent\parbox{4cm}{
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \langle
\mathbb{S},\mathbb{E},f,
\mathbb{V},\mathbb{R},\mathbb{C},\linebreak[0]
Op_a,Op_c,Op_m \rangle$.
\end{theorem}
}
\noindent\parbox{6.5cm}{
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \langle
\mathbb{S},\mathbb{E},f,\linebreak[0]
\mathbb{V},\mathbb{R},\mathbb{C},
Op_a,Op_c,Op_m \rangle$.
\end{theorem}
}
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \langle
\mathbb{S},\mathbb{E},\linebreak[0]
f,\mathbb{V},\mathbb{R},\mathbb{C},
Op_a,Op_c,Op_m \rangle$.
\end{theorem}
\end{document}
答案2
您可以尝试以下middlebreak
宏:
[完全不使用\left
,而且\right
在您发布的案例中效果更好,正如评论中所指出的那样;但请参阅下面的第二个提案以了解更普遍的用法]
\documentclass{article}
\usepackage{amsfonts,amsthm}
\newtheorem{theorem}{Theorem}
% to be used within a \left \right pair
\def\middlebreak {\nulldelimiterspace0pt
\right.\allowbreak\mskip 0mu plus .5mu \nulldelimiterspace0pt\left.}%
\begin{document}
{%
\hsize 3cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle
\mathbb{S},\middlebreak \mathbb{E},\middlebreak f,\middlebreak
\mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},\middlebreak
Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
}%
{%
\hsize 7cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle
\mathbb{S},\middlebreak \mathbb{E},\middlebreak f,\middlebreak
\mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},\middlebreak
Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
}%
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle
\mathbb{S},\middlebreak \mathbb{E},\middlebreak f,\middlebreak
\mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},\middlebreak
Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
\end{document}
\documentclass{article}
\usepackage{amsfonts,amsthm}
\newtheorem{theorem}{Theorem}
\newlength{\IrresponsibleFantasy}
\newcommand*{\ReserveVerticalSpace}[1]
{\setlength{\IrresponsibleFantasy}{#1}\global\IrresponsibleFantasy=\IrresponsibleFantasy
\parbox{0pt}{\rule{0pt}{\IrresponsibleFantasy}}}
\newcommand*{\middlebreak}{\nulldelimiterspace0pt
\right.\allowbreak\mskip 0mu plus .5mu \nulldelimiterspace0pt
\left.\parbox{0pt}{\rule{0pt}{\IrresponsibleFantasy}}}%
\begin{document}
{%
\hsize 3cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E =
\left\langle\ReserveVerticalSpace{1cm}
\mathbb{S},\middlebreak \mathbb{E},
\middlebreak {X^X}^X, \middlebreak f,\middlebreak
\mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},
\middlebreak {q_q}_q, \middlebreak
Op_a,\middlebreak Op_c,\middlebreak Op_m
\right\rangle$.
\end{theorem}
}%
{%
\hsize 7cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E =
\left\langle\ReserveVerticalSpace{1cm}
\mathbb{S},\middlebreak \mathbb{E},
\middlebreak {X^X}^X, \middlebreak f,\middlebreak
\mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},
\middlebreak {q_q}_q, \middlebreak
Op_a,\middlebreak Op_c,\middlebreak Op_m
\right\rangle$.
\end{theorem}
}%
\begin{theorem}
...could be now considered as an algebraic structure $DB_E =
\left\langle\ReserveVerticalSpace{1cm}
\mathbb{S},\middlebreak \mathbb{E},
\middlebreak {X^X}^X, \middlebreak f,\middlebreak
\mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},
\middlebreak {q_q}_q, \middlebreak
Op_a,\middlebreak Op_c,\middlebreak Op_m
\right\rangle$.
\end{theorem}
\end{document}
答案3
您可以重写与代数结构关联的标记流,以\allowbreak
在每个逗号后自动附加并用自动调整大小的一对尖括号(不包括\left...\right
)包裹其元素:
\documentclass[preview]{standalone}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage{expl3,xparse}
\newtheorem{theorem}{Theorem}
\ExplSyntaxOn
\NewDocumentCommand{\mstruct}{m}{%
\group_begin:
\tl_set:Nn \l_tmpa_tl {#1}
\hbox_set:Nn \l_tmpa_box {\ensuremath{\l_tmpa_tl}}
\dim_set:Nn \l_tmpa_dim {\box_ht:N \l_tmpa_box}
\dim_add:Nn \l_tmpa_dim {\box_dp:N \l_tmpa_box}
\dim_add:Nn \l_tmpa_dim {0.3em}
\dim_set:Nn \l_tmpb_dim {1.2\l_tmpa_dim}
\tl_replace_all:Nnn \l_tmpa_tl {,} {,\allowbreak}
\ifmmode%
\text{\fontsize{\l_tmpa_dim}{\l_tmpb_dim}\selectfont$\langle$}
\else%
{\fontsize{\l_tmpa_dim}{\l_tmpb_dim}\selectfont$\langle$}
\fi
\ensuremath{\l_tmpa_tl}
\ifmmode%
\text{\fontsize{\l_tmpa_dim}{\l_tmpb_dim}\selectfont$\rangle$}
\else%
{\fontsize{\l_tmpa_dim}{\l_tmpb_dim}\selectfont$\rangle$}
\fi
\group_end:
}
\ExplSyntaxOff
\begin{document}
\mstruct{\text{my}^{\text{very}^{\text{very}^{\text{very}^{\text{big}^\text{object}}}}}}
\mstruct{this,is,a,very,very,very,very,very,very,very,very,very,very,very,very,very,long,sentence,because,I'm,testing,mstruct,against,very,long,text,with,\text{my}^{\text{very}^{\text{very}^{\text{very}^{\text{big}^\text{object}}}}}}
\begin{theorem}
$\mstruct{\text{my}^{\text{very}^{\text{big}^\text{object}}}}_a^b$
\end{theorem}
\begin{theorem}
...could be now considered as an algebraic structure $DB_E =
\mstruct{\mathbb{S}, \mathbb{E}, f, \mathbb{V}, \mathbb{R}, \mathbb{C}, Op_a,
Op_c, Op_m}$.
\end{theorem}
\end{document}