![접근법 1](https://rvso.com/image/281487/%EC%A0%91%EA%B7%BC%EB%B2%95%201.png)
아래 그림과 같이 LaTeX로 테이블을 만드는데 문제가 생겼습니다. 저를 도와주세요.
나는 다음과 같이 노력하고 있습니다 :
\begin{document}
\begin{tabular}{|p{1cm}|p{1cm}|p{5cm}|}
\hline
\multicolumn{2}{l|}{Input Values} & \multicolumn{1}{l|}{Output Values} \\
\hline
1&2&The values \\
\hline
3&5&\begin{tabular}{|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
1 & 2 & & & \\
\hline
& & & & \\
& & & & \\
& & & & \\
& & & & \\
& & & & \\
& & & & \\
\hline
\end{tabular}
\end{tabular}
\end{document}
하지만 오지 않습니다.
나는 라텍스를 처음 접하므로 도와주세요.
답변1
접근법 1
p{...}
고정 너비의 열이 있는 테이블입니다 .
\documentclass{article}
\pagestyle{empty}
\begin{document}
\begin{tabular}{|p{3cm}|p{3cm}|p{3cm}|p{3cm}|}
\hline
\multicolumn{2}{|c|}{Date with place} & \multicolumn{2}{c|}{Output Values} \\
\hline
21/01 & x & \multicolumn{2}{c|}{The data for different day} \\
\hline
22/01 & y & sunday & 233 \\
\hline
23/01 & z & Mon & 233 \\
\hline
24/01 & p & tues & 134 \\
\hline
25/01 & q & wed & 76 \\
\hline
26/01 & r & thurs & 35 \\
\hline
27/01 & s & fi & 87 \\
\hline
28/01 & t & sat & 7 \\
\hline
\end{tabular}
\end{document}
접근법 2
booktabs
"스도쿠 그리드"와 p{...}
고정 너비의 열 없이 사용합니다 .
\documentclass{article}
\pagestyle{empty}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{p{3cm}p{3cm}p{3cm}p{3cm}}
\toprule
\multicolumn{2}{c}{Date with place} & \multicolumn{2}{c}{Output Values} \\
\midrule
21/01 & x & \multicolumn{2}{c}{The data for different day} \\
\cmidrule{3-4}
22/01 & y & sunday & 233 \\
23/01 & z & Mon & 233 \\
24/01 & p & tues & 134 \\
25/01 & q & wed & 76 \\
26/01 & r & thurs & 35 \\
27/01 & s & fi & 87 \\
28/01 & t & sat & 7 \\
\bottomrule
\end{tabular}
\end{document}
접근법 3
booktabs
에서와 같이 열을 사용 하고 확장 가능합니다 l
.
\documentclass{article}
\pagestyle{empty}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{llll}
\toprule
\multicolumn{2}{c}{Date with place} & \multicolumn{2}{c}{Output Values} \\
\midrule
21/01 & x & \multicolumn{2}{c}{The data for different day} \\
\cmidrule{3-4}
22/01 & y & sunday & 233 \\
23/01 & z & Mon & 233 \\
24/01 & p & tues & 134 \\
25/01 & q & wed & 76 \\
26/01 & r & thurs & 35 \\
27/01 & s & fi & 87 \\
28/01 & t & sat & 7 \\
\bottomrule
\end{tabular}
\end{document}
접근법 4
처음테이블, 테이블 안의 테이블!
\documentclass{article}
\pagestyle{empty}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{cc}
\toprule
Date with place & Output Values \\
\midrule
\begin{tabular}{ll}
21/01 & x \\
22/01 & y \\
23/01 & z \\
24/01 & p \\
25/01 & q \\
26/01 & r \\
27/01 & s \\
28/01 & t \\
\end{tabular}
&
\begin{tabular}{ll}
\multicolumn{2}{c}{The data for different day} \\
\midrule
sunday & 233 \\
Mon & 233 \\
tues & 134 \\
wed & 76 \\
thurs & 35 \\
fi & 87 \\
sat & 7 \\
\end{tabular}
\\
\bottomrule
\end{tabular}
\end{document}