# Manual break line of overly long equation in table

How can I get LaTeX to apply line breaks in display math mode for a long equation?

I created a table of:

% \usepackage{booktabs}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{@{}|l|l|l|@{}}
\toprule
& Actual Positive $(y_i=1)$                                                & Actual Negative $(y_i=0)$ \\ \midrule
Predicted Positive $c_i=1$ & $C_{TP_i}=0$                                                             & $C_{FP_i}=r_i+C^m_{FP_i}$ \\ \midrule
Predicted Negative $c_i=0$ & $C_{FN_i}=C_{device_i} + C_{marketInvest_i} + C_{usage_i}-Downpayment_i$ & $C_{TN_i}=0$              \\ \bottomrule
\end{tabular}
\end{table}


where

$C_{FN_i}=C_{device_i} + C_{marketInvest_i} + C_{usage_i}-Downpayment_i$


denotes the equation which is too long.

How can I split it e.g. like

$C_{FN_i}=C_{device_i} + C_{marketInvest_i} + C_{usage_i}-Downpayment_i$


When using align in the table

\begin{align*}
C_{FN_i}=C_{device_i} &+\\
C_{marketInvest_i} &+\\
C_{usage_i} &-\\
Downpayment_i
\end{align}


the result is a compilation error in latex.

\begin{table}[]
\centering
\caption{Cost matrix proposed for telecommunication industry.}
\label{tbl:tma-costmat}
\begin{tabular}{@{}l|l|l@{}}
& Actual Positive $(y_i=1)$                                                & Actual Negative $(y_i=0)$ \\ \midrule
Predicted Positive $c_i=1$ & $C_{TP_i}=0$                                                             & $C_{FP_i}=r_i+C^m_{FP_i}$ \\ \midrule
Predicted Negative $c_i=0$ & \begin{align*}
C_{FN_i}=C_{device_i} &+\\
C_{marketInvest_i} &+\\
C_{usage_i} &-\\
Downpayment_i
\end{align} & $C_{TN_i}=0$              \\
\end{tabular}
\end{table}

• Your code is doomed in part because \begin{align*} is paired with \end{align}. – Mico Aug 13 '17 at 18:17

You can't use an align environment (or an align* environment) the way you propose to do. However, you may use an aligned environment. \documentclass{article}
\usepackage{amsmath,booktabs,array}
\usepackage[skip=0.333\baselineskip]{caption}
\newcolumntype{L}{>{$}l<{$}}   % automatic math mode
\newcommand\vn{\mathit{#1}} % "variable name"

\begin{document}
\begin{table}
\centering
\caption{Cost matrix proposed for telecommunication industry.}
\label{tbl:tma-costmat}
\begin{tabular}{@{}lLL@{}}
\toprule
& \text{Actual Pos.\ }(y_i=1)
& \text{Actual Neg.\ }(y_i=0) \\
\midrule
Predicted Positive $c_i=1$
& C_{\vn{TP}_i}=0
& C^{}_{\vn{FP}_i}=r^{}_i+C^m_{\vn{FP}_i} \\
Predicted Negative $c_i=0$