tabularray를 중심으로 테이블 그리기를 계속합니다.
이번에는 chicken game을 예로 듭니다.
(Swerve는 Sw.로, Straight는 St.로 줄여서 쓰겠습니다.)
tabluarray에서는 셀의 내용이 차지하는 크기에 따라 column의 폭이 달라집니다.
(가장 큰 폭에 따라 고르게 그려주는 spread 기능이 아직 지원되지 않습니다.)
\documentclass{article} \usepackage{tabularray} \usepackage{xcolor} \begin{document} \begin{tblr}{ vline{2-Z}={2-Z}{solid}, hline{2-Z}={2-Z}{solid}, colspec={Q[$,c]*{2}{Q[$,c]}}, } & Sw. & St. \\ Sw. & 0,0 & -1,1 \\ St. & 1,-1 & -100,-100 \\ \end{tblr} \vspace{1cm} \begin{tblr}{ vline{3-Z}={3-Z}{solid}, hline{3-Z}={3-Z}{solid}, colspec={Q[r]Q[$,c]*{2}{Q[$,c]}}, % for players cell{1}{3}={r=1,c=2}{mode=text,yellow}, cell{3}{1}={r=2,c=1}{mode=text,green}, % payoff color cell{3-Z}{Z}={bg=yellow}, cell{3-Z}{3}={bg=blue!10}, } & & Player II & \\ & & Sw. & St. \\ Player I & Sw. & 0,0 & -1,1 \\ & St. & 1,-1 & -100,-100 \\ \end{tblr} \end{document}
필요한 경우, column의 width를 "5em"처럼 수동으로 지정해줄 수 있습니다.
\documentclass{article} \usepackage{tabularray} \usepackage{xcolor} \begin{document} \begin{tblr}{ vline{3-Z}={3-Z}{solid}, hline{3-Z}={3-Z}{solid}, colspec={Q[r]Q[$,c]*{2}{Q[$,c,5em]}}, %%%%% 5em % for players cell{1}{3}={r=1,c=2}{mode=text,yellow}, cell{3}{1}={r=2,c=1}{mode=text,green}, % payoff color cell{3-Z}{Z}={bg=yellow}, cell{3-Z}{3}={bg=blue!10}, } & & Player II & \\ & & Sw. & St. \\ Player I & Sw. & 0,0 & -1,1 \\ & St. & 1,-1 & -100,-100 \\ \end{tblr} \end{document}
큰 폭의 column을 기준으로 균등하게 그려주면 편리할 듯합니다.
(tabu와 sgamex에서는 이 기능이 들어가 있지만, 사용자 입장에서 약간의 차이가 있습니다.)
KTUG 한국 텍 사용자 그룹