以下 tex 代码创建一个 3x3 表,其中前两行中的每一行都合并为一个单元格。前两行中的每一行都由另一个 3x3 表填充。我因为各种单元格的下划线而苦恼。给定单元格内表格中的下划线不会像原始较大表格中的下划线那样长。我很好奇是否有办法让单元格内的表格按比例最大化单元格。我知道我的问题可能有点不清楚,我很抱歉。如果您愿意询问,我很乐意进一步解释。谢谢!
%2multibyte Version: 5.50.0.2960 CodePage: 1252
\documentclass{article}%
\usepackage{amsmath}%
\setcounter{MaxMatrixCols}{30}%
\usepackage{amsfonts}%
\usepackage{amssymb}%
\usepackage{graphicx}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{Codepage=1252}
%TCIDATA{CSTFile=40 LaTeX article.cst}
%TCIDATA{Created=Tuesday, September 26, 2023 01:00:32}
%TCIDATA{LastRevised=Tuesday, September 26, 2023 01:04:30}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{<META NAME="DocumentShell" CONTENT="Standard LaTeX\Blank - Standard LaTeX Article">}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\newtheorem{theorem}{Theorem}
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{criterion}[theorem]{Criterion}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{solution}[theorem]{Solution}
\newtheorem{summary}[theorem]{Summary}
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\begin{document}
%
\begin{tabular}
[c]{lll}%
\multicolumn{3}{l}{%
\begin{tabular}
[c]{lll}
& & \\
rtyu & fghj & vbnm\\\hline
qwer & asdf & zxcv\\\hline
\end{tabular}
}\\
\multicolumn{3}{l}{%
\begin{tabular}
[c]{lll}
& & \\
rtyu & fghj & vbnm\\\hline
qwer & asdf & zxcv
\end{tabular}
}\\\cline{1-3}%
qwer & asdf & zxcv\\\hline
\end{tabular}
\end{document}
答案1
您需要更改两个实例
\multicolumn{3}{l}{%
到
\multicolumn{3}{@{}l@{}}{%
为了抑制在单列两侧自动应用空白填充l
。
补充说明:我不知道对两个“内部”tabular
环境和外部环境应用相同的列宽是否对您来说很重要。如果重要,我建议加载包array
并使用具有固定宽度的列类型(例如w{l}{1in}
或 )p{1in}
,而不是基本l
列类型,用于内部tabular
环境和外部tabular
环境。
\documentclass{article}
\begin{document}
\begin{tabular}{lll}%
\hline % <-- new
\multicolumn{3}{@{}l@{}}{% % suppress whitespace padding
\begin{tabular}{lll}
& & \\
rtyu & fghj & vbnm\\ \hline
qwer & asdf & zxcv\\
\end{tabular}
}\\
\hline
\multicolumn{3}{@{}l@{}}{%
\begin{tabular}{lll}
& & \\
rtyu & fghj & vbnm\\ \hline
qwer & asdf & zxcv
\end{tabular}
}\\
\cline{1-3}% % why not write "\hline"?
qwer & asdf & zxcw\\
\hline
\end{tabular}
\end{document}