longtable 環境下數學模式的換行符

longtable 環境下數學模式的換行符

我在括號內有一個很長的數學表達式,它大於我為表格指定的列寬。如何強迫它將表達式換成新行?

       \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} 但出現乳膠錯誤(Package amsmath Error: \begin{split} won't work here

有人有主意嗎?

乾杯

答案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}

在此輸入影像描述

相關內容