Ich habe ein Problem beim Erstellen einer Tabelle in LaTeX, wie in der Abbildung unten angehängt. Bitte helfen Sie mir.
Ich versuche es so:
\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}
Aber ich komme nicht.
Ich bin neu im Latexbereich, also helfen Sie mir bitte.
Antwort1
Ansatz 1
Ihre Tabelle mit p{...}
Spalten fester Breite.
\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}
Ansatz 2
Verwendung booktabs
ohne „Sudoku-Gitter“ und p{...}
Spalten mit fester Breite.
\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}
Ansatz 3
Verwenden booktabs
Sie skalierbare Spalten wie in 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}
Ansatz 4
BeginnTische, ein Tisch in einem Tisch!
\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}