我的括号内有一个很长的数学表达式,其宽度大于我为表格指定的列宽。如何强制将表达式拆分到新行?
\begin{center}
\footnotesize
\begin{longtable}[l]{>{\raggedright}p{2.25cm}>{\raggedright}p{9cm}>{\raggedright\arraybackslash}p{3cm}}
\hline
\textbf{Text} & \textbf{Maths} & \textbf{Text} \\ \hline
\endfirsthead
\multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- Continued from previous page}} \\
\hline
\textbf{Text} & \textbf{Maths} & \textbf{Text} \\ \hline
\endhead
\multicolumn{3}{r}{{-- Continued on next page}} \\
\endfoot
\endlastfoot
TEXT 1 & $\dfrac{\kappa_{nf}}{\kappa_{f}}= 1+3\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)\phi+ \left(3\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)^{2}+\dfrac{3}{4}\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)^{2}+ \newline \dfrac{9}{16}\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)^{3}\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}+2}{\dfrac{\kappa_{p}}{2\kappa_{f}}+3}\right)....\right)\phi^{2}$ & Text 2\\
\hline
\end{longtable}
\end{center}
\normalsize
理想情况下,我希望中断发生在 \dfrac{9}{16} 之前
我尝试放置 \begin{split} 和 \end{split},但出现 latex 错误(Package amsmath 错误:\begin{split} 在这里不起作用
有人有主意吗?
干杯
答案1
由于在 内不能换行\left...\right
,因此请写\right.\newline\left.
,其中的点表示“不可见的分隔符”。
顺便说一句,在 3/4 处中断会产生更好的效果。
个人意见:我更喜欢将运算符绑定到正确的操作数,因此,我宁愿将它们放在行首,正确对齐,而不是将 + 符号放在行尾。
\documentclass[a4paper,10pt,draft]{article}
\usepackage[cm]{fullpage}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{longtable,array}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\begin{document}
\begin{longtable}{P{2.25cm}P{9cm}P{3cm}}
\hline
\textbf{Text} & \textbf{Maths} & \textbf{Text} \\
\hline
\endfirsthead
\multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- Continued from previous page}} \\
\hline
\textbf{Text} & \textbf{Maths} & \textbf{Text} \\ \hline
\endhead
\multicolumn{3}{r}{{-- Continued on next page}} \\
\endfoot
\endlastfoot
TEXT 1 & $\dfrac{\kappa_{nf}}{\kappa_{f}}
= 1 +
3\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)\phi +
\left(3\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)^{2}+\right.\newline
\left. \dfrac{3}{4}\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)^{2} +
\dfrac{9}{16}\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}-1}{\dfrac{\kappa_{p}}{\kappa_{f}}+2}\right)^{3}
\left(\dfrac{\dfrac{\kappa_{p}}{\kappa_{f}}+2}{\dfrac{\kappa_{p}}{2\kappa_{f}}+3}\right)....\right)\phi^{2}$ & Text 2\\
\hline
\end{longtable}
\end{document}
答案2
一种变体,使用nccmath
包(用于其中等分数)和ltablex
包,允许在 tabularx 环境中进行分页。我使用aligned
环境来处理较长的数学公式,并将对替换\left … \right
为\Biggl … \Biggr
。该makecell
包允许在公式周围给出一些垂直间距:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{nccmath}
\usepackage[nomarginpar, showframe]{geometry}
\usepackage{mathtools}
\usepackage{array,ltablex}
\keepXColumns
\usepackage{makecell}
\setcellgapes{4pt}
\makegapedcells
\begin{document}
\setlength\tabcolsep{4pt}
\begin{tabularx}{\linewidth}{|>{\raggedright}p{2.25cm}| >{\footnotesize}X| >{\raggedright\arraybackslash}p{3cm}|}%
\hline
\textbf{Text} & \textbf{Maths} & \textbf{Text} \\ \hline
\endfirsthead
\multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- Continued from previous page}} \\
\hline
\textbf{Text} & \textbf{Maths} & \textbf{Text} \\ \hline
\endhead
\multicolumn{3}{r}{{-- Continued on next page}} \\
\endfoot
\endlastfoot
TEXT 1 &
$ \begin{aligned}\MoveEqLeft[-1.5] \mfrac{κ_{nf}}{κ_{f}}= 1+3\Biggl(\mfrac{\mfrac{κ_{p}}{κ_{f}}-1}{\mfrac{κ_{p}}{κ_{f}}+2}\Biggr)ϕ + {}\\[-1ex]
& + \Biggl[3\Biggl(\mfrac{\mfrac{κ_{p}}{κ_{f}}-1}{\mfrac{κ_{p}}{κ_{f}}+2}\Biggr)^{\!2} + \mfrac{3}{4}\Biggl(\mfrac{\mfrac{κ_{p}}{κ_{f}}-1}{\mfrac{κ_{p}}{κ_{f}}+2}\Biggr)^{\!2}
+ \mfrac{9}{16}\Biggl(\mfrac{\mfrac{κ_{p}}{κ_{f}}-1}{\mfrac{κ_{p}}{κ_{f}}+2}\Biggr)^{\!3} \Biggl(\mfrac{\mfrac{κ_{p}}{κ_{f}}+2}{\mfrac{κ_{p}}{2κ_{f}}+3}\Biggr)....\Biggr]ϕ^{2}\end{aligned} $
& Text 2\\
\hline
\end{tabularx}
\end{document}