將文字放在引出三角形的中間(表格)

將文字放在引出三角形的中間(表格)

考慮下面的 MWE,給出下圖:

在此輸入影像描述

現在我想調整我的程式碼,以便在表格中間顯示相同的文本,如下圖所示。在不改變三角形形狀的情況下,最好的方法是什麼?

在此輸入影像描述

\documentclass[a4paper,12pt]{report}
\usepackage{caption}
\usepackage{float}

\begin{document}

\begin{table}[h]
\centering
\caption{Run-off triangle}
\begin{tabular}{l|llllllllll}
\textbf{\begin{tabular}[c]{@{}l@{}}Accident year i/\\ Development year     j\end{tabular}} & \textbf{1}            & \textbf{2}            & \textbf{3}              & \textbf{...}          & \textbf{...}          & \textbf{...}          &      \textbf{j}            & \textbf{...}          & \textbf{...}          & \textbf{J}            \\ \hline
\textbf{1}                                                                                 &                       &                       &                       &                           &                       &                       &                       &                      &                       & \multicolumn{1}{l|}{} \\ \cline{11-11} 
\textbf{2}                                                                                  &                       &                       &                       &                        &                       &                       &                       &                          & \multicolumn{1}{l|}{} &                       \\ \cline{10-10}
\textbf{\vdots}                                                                           &                       &                       &                       &                        &                       &                       &                       &    \multicolumn{1}{l|}{} &                       &                       \\     \cline{9-9}
\textbf{\vdots}                                                                        &                       &                       &                       &                       &                       &                       & \multicolumn{1}{l|}{} &                        &                       &                       \\ \cline{8-8}
\textbf{i}                                                                             &                       &                       &                       &                       &                       & \multicolumn{1}{l|}{} &                       &                       &                       &                       \\ \cline{7-7}
\textbf{\vdots}                                                                        &                       &                       &                       &                        & \multicolumn{1}{l|}{} &                       &                       &                       &                       &                       \\ \cline{6-6}
\textbf{\vdots}                                                                        &                       &                       &                       &   \multicolumn{1}{l|}{} &                       &                       &                       &                       &                       &                       \\   \cline{5-5}
\textbf{\vdots}                                                                           &                       &                       & \multicolumn{1}{l|}{} &                       &                       &                       &                       &                       &                       &                       \\ \cline{4-4}
\textbf{I-1}                                                                           &                       & \multicolumn{1}{l|}{} &                       &                       &                       &                       &                       &                       &                       &                       \\ \cline{3-3}
\textbf{I}                                                                               & \multicolumn{1}{l|}{} &                       &                       &                       &                       &                       &                       &                       &                       &                       \\ \cline{2-2}
\end{tabular}
\end{table}

\end{document}

答案1

您可以使用

\llap{Observations $C_{ij},X_{ij}$}

在特定單元格中插入文字。您只需要找出是哪一個!

由於你的程式碼太複雜,你可以透過計算行數和列數來確定。

我將它插入到第 2 行,另一個插入到第 3 行,就在下面。

在此輸入影像描述

\textbf{2}  & & & & & & & \llap{Observations $C_{ij},X_{ij}$} 
      & & \multicolumn{1}{l|}{} & \\ \cline{10-10}
\textbf{\vdots}  & & & & & & & \llap{$(i+j\leq 1)$} 
        & \multicolumn{1}{l|}{} & & \\ \cline{9-9}

編輯:我也會使用$\mathbf{i}$等等來表達數學內容。

相關內容