制作多行表的问题

制作多行表的问题

我想写一个表格,这是我的代码:

\documentclass{article}
\usepackage{bbm}
\usepackage{amsmath}
\usepackage{multirow}
\begin{document}
\begin{table}
    \caption{Tipe opsi barrier.}
\begin{center}
    \begin{tabular}{|c|c|c|c|c|}
        \hline
        Tipe Opsi&CBBC&\textit{Behavior}&\textit{Payoff}& \\
        \hline
        \multirow{8}{*}{Barrier \textit{Call}}& \multirow{2}{*}{\textit{Bull}}&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{down-and-out} \\ (\textit{knock-out})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\biggl\{\min\limits_{0\leq t\leq T}S_t>B\biggr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \cline{2-5}
        &\multirow{6}{*}{}&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{down-and-in}\\(\textit{knock-in})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\biggl\{\min\limits_{0\leq t\leq T}S_t<B\biggr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \cline{3-5}
        &&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{up-and-out}\\(\textit{knock-out})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\biggl\{\max\limits_{0\leq t\leq T}S_t<B\biggr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \cline{3-5}
        &&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{up-and-in}\\(\textit{knock-in})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\biggl\{\max\limits_{0\leq t\leq T}S_t>B\biggr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \hline
\end{tabular}
\end{center}
\end{table}
\end{document}

该代码的输出:

在此处输入图片描述

但是输出好像有错误,很多脚本都超出了单元格范围,我的代码哪里出了问题?

答案1

错误是\FloatBarrier所需的placeins包。

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{bbm}
\usepackage{placeins}
\usepackage{multirow}
    \begin{document}
\FloatBarrier
\begin{table}
    \caption{Tipe opsi barrier.}
\begin{center}
    \begin{tabular}{|c|c|c|c|c|}
        \hline
        Tipe Opsi&CBBC&\textit{Behavior}&\textit{Payoff}& \\
        \hline
        \multirow{8}{*}{Barrier \textit{Call}}& \multirow{2}{*}{\textit{Bull}}&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{down-and-out} \\ (\textit{knock-out})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\bigl\{\min\limits_{0\leq t\leq T}S_t>B\bigr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \cline{2-5}
        &\multirow{6}{*}{}&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{down-and-in}\\(\textit{knock-in})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\bigl\{\min\limits_{0\leq t\leq T}S_t<B\bigr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \cline{3-5}
        &&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{up-and-out}\\(\textit{knock-out})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\bigl\{\max\limits_{0\leq t\leq T}S_t<B\bigr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \cline{3-5}
        &&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{up-and-in}\\(\textit{knock-in})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\bigl\{\max\limits_{0\leq t\leq T}S_t>B\bigr\}}$}&$B\leq K$\\
        \cline{5-5}
        &&&&$B\geq K$\\
        \hline
    \end{tabular}
\end{center}
\end{table}
\FloatBarrier
\end{document}

在此处输入图片描述

答案2

与 Sebastiano 的答案类似,我使用\left\{...\right\}它来制作合适的花括号,如下所示。

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{bbm}
\usepackage{multirow}
\begin{document}
    \begin{table}
        \caption{Tipe opsi barrier.}
        \begin{center}
            \begin{tabular}{|c|c|c|c|c|}
                \hline
                Tipe Opsi&CBBC&\textit{Behavior}&\textit{Payoff}& \\
                \hline
                \multirow{8}{*}{Barrier \textit{Call}}& \multirow{2}{*}{\textit{Bull}}&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{down-and-out} \\ (\textit{knock-out})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\left\{\min\limits_{0\leq t\leq T}S_t>B\right\}}$}&$B\leq K$\\
                \cline{5-5}
                &&&&$B\geq K$\\
                \cline{2-5}
                &\multirow{6}{*}{}&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{down-and-in}\\(\textit{knock-in})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\left\{\min\limits_{0\leq t\leq T}S_t<B\right\}}$}&$B\leq K$\\
                \cline{5-5}
                &&&&$B\geq K$\\
                \cline{3-5}
                &&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{up-and-out}\\(\textit{knock-out})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\left\{\max\limits_{0\leq t\leq T}S_t<B\right\}}$}&$B\leq K$\\
                \cline{5-5}
                &&&&$B\geq K$\\
                \cline{3-5}
                &&\multirow{2}{*}{\begin{tabular}{@{}c@{}}\textit{up-and-in}\\(\textit{knock-in})\end{tabular}}&\multirow{2}{*}{$(S_T-K)^+\mathbbm{1}_{\left\{\max\limits_{0\leq t\leq T}S_t>B\right\}}$}&$B\leq K$\\
                \cline{5-5}
                &&&&$B\geq K$\\
                \hline
            \end{tabular}
        \end{center}
    \end{table}
\end{document}

结果是

在此处输入图片描述

相关内容