![重现特定表格](https://linux22.com/image/378678/%E9%87%8D%E7%8E%B0%E7%89%B9%E5%AE%9A%E8%A1%A8%E6%A0%BC.png)
这是我所做的:
\begin{table}[!ht]
\center
\begin{tabular}[b]{|l|c c c c c|}
\hline
& \multicolumn{5}{|c|}{developpement year j} \\
\hline
Accident year & 1 & 2 & 3&4&j&... & $J$ \\
\hline \hline
1 & & & & & \\
2 & & & & & \\
3 & & & & & \\
4 & & & & & \\
j & & & & & \\
... & & & & & \\
$I$ & & & & & \\
\hline
\end{tabular}
\end{table}
一些帮助将不胜感激
答案1
这是一个简单的代码:
\documentclass[]{article}
\usepackage[showframe]{geometry}
\usepackage{multirow, booktabs, makecell, boldline}
\begin{document}
\begin{table}[!htbp]
\centering\setlength{\extrarowheight}{2pt}
\begin{tabular}{V{2}cV{2}*{10}{>{\centering\arraybackslash}p{8mm}}V{2}}
\hlineB{2}
\multirowcell{2}{Accident \\ Year $i$} & \multicolumn{10}{cV{2}}{Development Year $j$}\\
& 1 & 2 & 3 & 4 & & j & &\dots & & J \\
\hlineB{2}
1 & \multicolumn{10}{cV{2}}{}\\
\cline{11-11}
2 & \multicolumn{9}{c|}{} & \\
\cline{10-10}
3 & \multicolumn{7}{c}{$C_{ij}$} & \multicolumn{1}{c|}{} & & \\
\cline{9-9}
4 & \multicolumn{7}{c|}{(Observations)} & \multicolumn{2}{c }{} & \\
\cline{8-8}
& \multicolumn{6}{c|}{} & \multicolumn{3}{c }{} & \\
\cline{7-7}
$I-j$ & \multicolumn{5}{c|}{} & \multicolumn{4}{c}{} & \\
\cline{6-6}
& \multicolumn{4}{c|}{} & & \multicolumn{5}{cV{2}}{$C_{ij}$} \\
\cline{5-5}
$ I-2 $ & \multicolumn{3}{c|}{} & & & \multicolumn{5}{cV{2}}{(to be predicted)} \\
\cline{4-4}
$ I-1 $ & \multicolumn{2}{c|}{} & \multicolumn{7}{c}{} & \\
\cline{3-3}
$ I $ & \multicolumn{1}{c|}{} & \multicolumn{8}{c}{} & \\
\hlineB{2}
\end{tabular}
\end{table}
\end{document}
答案2
我倾向于使用 Ti钾Z,因为这更像是一个图表而不是表格。当然,你会得到不同的解决方案,但这里有一种方法matrix of math nodes
:
\documentclass[border=10pt]{standalone}
\usepackage{tikz,amsmath}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[thick]
\matrix (T) [matrix of math nodes, draw, nodes={minimum width=5ex, anchor=mid, text height=2ex, text depth=.5ex}, nodes in empty cells]
{
\text{Accident} & & & & & & & & & & \\
\text{year } i & 1 & 2 & 3 & 4 & & j & & \dots & & J \\
1 & & & & & & & & & & \\
2 & & & & & & & & & & \\
3 & & & & C_{i,j} & & & & & & \\
& & & & & & & & & & \\
I-j & & & & & & & & & & \\
& & & & & & & & & & \\
& & & & & & & & C_{i,j} & & \\
I-2 & & & & & & & & & & \\
I-1 & & & & & & & & & & \\
I & & & & & & & & & & \\
};
\node at (T-1-1.mid -| T-1-6) [anchor=mid] {Development year $j$};
\draw (T.west |- T-2-1.south) -- (T.east |- T-2-1.south) (T.north -| T-1-1.east) -- (T.south -| T-1-1.east)
(T.south -| T-12-2.east) \foreach \i/\j in {12/3,11/4,10/5,9/6,8/7,7/8,6/9,5/10,4/11} { |- (T-\i-\j.north east) } -- (T-4-11.north -| T.east);
\node [anchor=north] at (T-5-5.south) {(observations)};
\node [anchor=north] at (T-9-9.south) {(to be predicted)};
\end{tikzpicture}
\end{document}
矩阵被命名,T
并且单元格为T-1-1
,,等等。T-1-2
T-1-3