2012-10-19 5 views
1

LaTeX에서이 Wikipedia article에 표시된 true, true, negative 등의 테이블처럼 보이는 다중 행 테이블을 만들려고합니다.다중 행 테이블을 만드는 방법

나는 multirow을 사용하려고하는데, y 모자를 '외부'테이블로 가져 오는 방법을 모르겠다.

\begin{table}[tbh!] 
\centering 
    \begin{tabular}{|l|l|l|} 
    \multicolumn{3}{c}{$y$} \\ \hline 
    %\multirow{3}{*}{$\hat{y}$} \\ 
    & \textbf{T} & \textbf{F} \\ \hline 
    \textbf{T} & TP & FP \\ \hline  
    \textbf{F} & FN & TN \\ \hline 
\end{tabular} 
\caption{Truth and prediction comparison.} 
\label{tab:revpol} 
\end{table} 

누구나 내가 이것을 달성하기 위해 바꿀 필요가있는 것을 설명 할 수 있습니까?

답변

1

는 그것은 tabular 구조의 일부로서 "표 중"구성 요소를 포함하는 가장 쉬운 방법 :

enter image description here

\documentclass{article} 
\usepackage{multirow}% http://ctan.org/pkg/multirow 
\begin{document} 
\begin{table}[t] 
    \centering 
    \begin{tabular}{l|l|l|l|} 
    \multicolumn{2}{c}{} & \multicolumn{2}{c}{$y$} \\ \cline{3-4} 
    \multicolumn{2}{c|}{} & \textbf{T} & \textbf{F} \\ \cline{2-4} 
    \multirow{2}{*}{$\hat{y}$} & \textbf{T} & TP & FP \\ \cline{2-4}  
    & \textbf{F} & FN & TN \\ \cline{2-4} 
    \end{tabular} 
    \caption{Truth and prediction comparison.} 
    \label{tab:revpol} 
\end{table} 
\end{document} 

\cline의는 특정 컬럼에 \hline을 넣어하기위한 것입니다. \multicolumntabular 열 지정을 사용하여 삽입 된 수직선을 숨기는 데 사용됩니다.

참고로 booktabstabular 대체 표현으로 간주하십시오.