帮助解决乳胶中的多列表格问题。谢谢。
这是我目前所拥有的:
\begin{document}
\begin{table}
\begin{tabular}{c|c}
\begin{tabular}{c|c}
a & b \\ \hline
c & d
\end{tabular}
& b \\ \hline
c & d
\end{tabular}
\end{table}
\end{document}
第二次尝试,远非完美而且非常复杂:
\documentclass[aps,preprint,amsmath,floatfix]{revtex4}
\usepackage{bm}
\begin{document}
\begin{table}
\begin{tabular}{c|c}
\mbox{
\begin{tabular}{c|c|c}
\mbox{
\begin{tabular}{c|c}
\mbox{\bm{$8\otimes 8$}} &
\begin{tabular}{c}
$\bm{27}$ \\
2 \\
1 \\
1
\end{tabular}\\
\hline
\mbox{
\begin{tabular}{ccccccc}
1 & $\frac{1}{2}$ & $\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $\frac{1}{2}$
\end{tabular}
} & 1 \\
\end{tabular}
} &
\begin{tabular}{c}
$\bm{27}$ \\
2 \\
1 \\
0
\end{tabular} &
\begin{tabular}{c}
$\bm{\bar{10}}$ \\
2 \\
0 \\
0
\end{tabular} \\
\hline
\mbox{
\begin{tabular}{ccccccc}
1 & $\frac{1}{2}$ & $\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $-\frac{1}{2}$
\end{tabular}
} & $\sqrt{\frac{1}{2}}$ & $-\sqrt{\frac{1}{2}}$ \\
\hline
\mbox{
\begin{tabular}{ccccccc}
1 & $\frac{1}{2}$ & $-\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $\frac{1}{2}$
\end{tabular}
} & $\sqrt{\frac{1}{2}}$ & $\sqrt{\frac{1}{2}}$
\end{tabular}
}
&
\mbox{
\begin{tabular}{c}
\bf{27} \\
2 \\
1 \\
$-1$
\end{tabular}
} \\
\hline
\mbox{
\begin{tabular}{ccccccc}
1 & $\frac{1}{2}$ & $-\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $-\frac{1}{2}$
\end{tabular}
}
&
1
\end{tabular}
\end{table}
\end{document}
答案1
你是指这样的吗?
\documentclass{article}
\usepackage{amsmath}
\usepackage{picture}
\begin{document}
\begingroup\setlength{\unitlength}{1cm}
\makeatletter
\newcommand{\DIM}[1]{\dimexpr#1\unitlength-\@wholewidth\relax}
\makeatother
\newcommand{\block}[3]{\framebox(\DIM{#1},\DIM{#2}){#3}}
\newcommand{\HOR}[2]{\makebox[#1\unitlength][s]{#2}}
\newcommand{\VER}[2]{\vbox to #1\unitlength{#2}}
\newcommand{\VB}[1]{\hbox to\unitlength{\hss$#1$\hss}}
\begin{picture}(7,7)
\put(1.5,4.5){\makebox(0,0){$\underset{\sim}{8}\otimes\underset{\sim}{8}$}}
\put(0,3){%
\block{3}{1}{\HOR{3}{%
$\hfill1\hfill\frac{1}{2}\hfill\frac{1}{2}\hspace{\stretch{2}}%
1\hfill\frac{1}{2}\hfill\frac{1}{2}\hfill$%
}}%
}
\put(1,1){\block{3}{1}{%
\block{3}{1}{\HOR{3}{%
$\hfill1\hfill\frac{1}{2}\hfill{-}\frac{1}{2}\hspace{\stretch{2}}%
1\hfill\frac{1}{2}\hfill\frac{1}{2}\hfill$%
}}%
}}
\put(1,2){\block{3}{1}{%
\block{3}{1}{\HOR{3}{%
$\hfill1\hfill\frac{1}{2}\hfill\frac{1}{2}\hspace{\stretch{2}}%
1\hfill\frac{1}{2}\hfill{-}\frac{1}{2}\hfill$%
}}%
}}
\put(3,0){\block{3}{1}{%
\block{3}{1}{\HOR{3}{%
$\hfill1\hfill\frac{1}{2}\hfill{-}\frac{1}{2}\hspace{\stretch{2}}%
1\hfill\frac{1}{2}\hfill{-}\frac{1}{2}\hfill$%
}}%
}}
\put(3,3){\block{1}{1}{\HOR{1}{\hfill$1\vphantom{\frac{1}{2}}$\hfill}}}
\put(3,4){\block{1}{3}{%
\VER{3}{%
\vfill\VB{\underset{\sim}{27}}\vfill\VB{2}\vfill\VB{1}\vfill\VB{1}\vfill
}%
}}
\put(4,1){\block{1}{1}{\HOR{1}{\hfill$\sqrt{\frac{1}{2}}$\hfill}}}
\put(4,2){\block{1}{1}{\HOR{1}{\hfill$\sqrt{\frac{1}{2}}$\hfill}}}
\put(4,3){\block{1}{3}{%
\VER{3}{%
\vfill\VB{\underset{\sim}{27}}\vfill\VB{2}\vfill\VB{1}\vfill\VB{0}\vfill
}%
}}
\put(5,1){\block{1}{1}{\HOR{1}{\hfill$\sqrt{\frac{1}{2}}$\hfill}}}
\put(5,2){\block{1}{1}{\HOR{1}{\hfill$-\sqrt{\frac{1}{2}}$\hfill}}}
\put(5,3){\block{1}{3}{%
\VER{3}{%
\vfill\VB{\underset{\sim}{\overline{10}}}\vfill\VB{2}\vfill\VB{0}\vfill\VB{0}\vfill
}%
}}
\put(6,0){\block{1}{1}{\HOR{1}{\hfill$1\vphantom{\frac{1}{2}}$\hfill}}}
\put(6,1){\block{1}{3}{%
\VER{3}{%
\vfill\VB{\underset{\sim}{27}}\vfill\VB{2}\vfill\VB{1}\vfill\VB{-1}\vfill
}%
}}
\end{picture}
\endgroup
\end{document}
答案2
您还可以使用以下方式排版您的图形卡路里,但即使 acalstable
比和朋友扭曲以产生相当不错的副本更简单tabular
,显然@egreg 的解决方案更好,更简单。
注意:!在上一条消息中,我很遗憾忘记提及我从@egreg 的示例中复制了有关单元格内容的代码。
在这个第二个版本中,我简化了代码。我将列数减少到七列,第四行的单元格比其他列宽 50%。我还优化了一些地方的间距。
为了获得精确的副本或原始表格,您需要“手动”调整我的代码中的对齐。
以下是我收到的内容和代码:
\documentclass{article}
\usepackage{amsmath, cals}
\let\nc=\nullcell % Shortcuts
\let\sc=\spancontent
\begin{document}
\begin{calstable}[c]
% Defining 14 equal columns
\colwidths{{1.95cm}{1.3cm}{1.3cm}{1.3cm}{1.3cm}{1.3cm}{1.3cm}
}
% Set up the tabular
\makeatletter
\def\cals@framers@width{0.3pt} % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0.03pt}
\def\cals@bodyrs@width{0.3pt}
\cals@setpadding{Ag}
\cals@setcellprevdepth{Al}
\def\cals@cs@width{0.3pt} % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.3pt}
\def\cals@bgcolor{}
\def\bb{\ifx\cals@borderB\relax % Bottom Border switch (off-on)
\def\cals@borderB{0.0pt}
\else \let\cals@borderB\relax\fi}
\def\rb{\ifx\cals@borderR\relax % Right Border switch (off-on)
\def\cals@borderR{0.0pt}
\else \let\cals@borderR\relax\fi}
\def\lb{\ifx\cals@borderL\relax % Left Border switch (off-on)
\def\cals@borderL{0.0pt}
\else \let\cals@borderL\relax\fi}
\def\tb{\ifx\cals@borderT\relax % Top Border switch (off-on)
\def\cals@borderT{0.0pt}
\else \let\cals@borderT\relax\fi}
\def\cals@AtBeginCell{\vfil}
%\def\cals@AtEndCell{}
%% Start of tabular body, no header row
% R1B1
\brow
\lb\tb\nc{lt}
\nc{lt}
\nc{rt}\tb\lb
\nc{lrt}
\tb\rb\cell{}
\cell{}
\cell{}\rb\tb
\ht\cals@current@row=1.3cm
\erow
%R2B2
\brow
\lb\nc{l}
\nc{}
\nc{r}\lb
\nc{lr}
\nc{lrt}
\nc{lrt}
\rb\tb\cell{}\rb\tb
\ht\cals@current@row=1.3cm
\erow
%R3B3
\brow
\lb\nc{lb}
\nc{b}
\nc{rb}\alignC\sc{\vfill $\underset{\sim}{8}\otimes\underset{\sim}{8}$\\}\lb
\nc{lrb}\alignC\sc{$\underset{\sim}{27}$\\\vfil $2$\\\vfil $1$\\\vfil $0$\vfil}
\nc{lr}
\nc{lr}
\rb\tb\cell{}\rb\tb
\ht\cals@current@row=1.3cm
\erow
%R4B4
\brow
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{\hfill $1 \hfill\frac{1}{2}\hfill\frac{1}{2}\quad \hfill 1 \hfill\frac{1}{2} \hfill\frac{1}{2}$}
\alignC\cell{$1$}
\nc{lrb}\alignC\sc{$\underset{\sim}{27}$\\\vfil $2$\\\vfil $0$\\\vfil $0$\vspace{6.5pt}}
\nc{lrb}\alignC\sc{$\underset{\sim}{\overline{10}}$\\\vfil $2$\\\vfil $0$\\\vfil $0$\vspace{6.5pt}}
\nc{lrt}
\ht\cals@current@row=1.3cm
\erow
%R5B5
\brow
\lb\bb\cell{}\lb\bb
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{\hfill $1 \hfill\frac{1}{2}\hfill\frac{1}{2}\quad \hfill 1 \hfill\frac{1}{2} \hfill-\frac{1}{2}$}
\alignC\cell{$\sqrt{\frac{1}{2}}$}
\alignC\cell{$-\sqrt{\frac{1}{2}}$}
\nc{lr}
\ht\cals@current@row=1.3cm
\erow
%R6B6
\brow
\lb\bb\cell{}\lb\bb
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{\hfill $1 \hfill-\frac{1}{2}\hfill\frac{1}{2}\quad \hfill 1 \hfill\frac{1}{2} \hfill\frac{1}{2}$}
\alignC\cell{$\sqrt{\frac{1}{2}}$}
\alignC\cell{$\sqrt{\frac{1}{2}}$}
\nc{lrb}\alignC\sc{$\underset{\sim}{27}$\\\vfil $2$\\\vfil $0$\\\vfil $-0$\vspace{6.5pt}}
\ht\cals@current@row=1.3cm
\erow
%R7B7
\brow
\lb\bb\cell{}
\cell{}
\cell{}\lb\bb
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{\hfill $1 \hfill\frac{1}{2}\hfill-\frac{1}{2}\quad \hfill 1 \hfill\frac{1}{2} \hfill-\frac{1}{2}$}
\alignC\cell{$1$}
\ht\cals@current@row=1.3cm
\erow
\makeatletter
\end{calstable}\par
\end{document}
答案3
这是通过tikzpicture
使用tabular
(如在原始 MWE 中一样)来创建行和列来完成的。行使用可调节的p{}
柱子来保证间距。列用于arraystretch
分配行。由于原始 MWE 使用粗体而不是underset sim
,因此它的作用相同。
\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[transform canvas={scale=0.7,xshift=0mm,yshift=-130mm},remember picture]
\huge
% \draw[step=1cm,yellow,very thin] (0,0) grid (14,13);
\draw (6,0) rectangle node { \begin{tabular}{cccp{0.10cm}ccc}
1 & $\frac{1}{2}$ & $-\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $-\frac{1}{2}$\\ \end{tabular}
} (12,2);
\draw (12,0) rectangle node {1} (14,2);
\draw (2,2) rectangle node { \begin{tabular}{cccp{0.20cm}ccc}
1 & $\frac{1}{2}$ & $-\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $\frac{1}{2}$\\ \end{tabular}
} (8,4);
\draw (8,2) rectangle node {$\sqrt{\frac{1}{2}}$} (10,4);
\draw (10,2) rectangle node {$\sqrt{\frac{1}{2}}$} (12,4);
\draw (12,2) rectangle node { \def\arraystretch{1.4} \begin{tabular}{c}
${\textbf{27}}$ \\ 2 \\ 1 \\ -1\\
\end{tabular}
} (14,8);
\draw (2,4) rectangle node { \begin{tabular}{cccp{0.20cm}ccc}
$1$ & $\frac{1}{2}$ & $\frac{1}{2}$ & & $1$ & $\frac{1}{2}$ & $-\frac{1}{2}$\\ \end{tabular}
} (8,6);
\draw (8,4) rectangle node {$\sqrt{\frac{1}{2}}$} (10,6);
\draw (10,4) rectangle node {$-\sqrt{\frac{1}{2}}$} (12,6);
\draw (0,6) rectangle node { \begin{tabular}{cccp{0.3cm}ccc}
1 & $\frac{1}{2}$ & $\frac{1}{2}$ & & 1 & $\frac{1}{2}$ & $\frac{1}{2}$\\ \end{tabular}
} (6,8);
\draw (6,6) rectangle node {1} (8,8);
\draw (6,8) rectangle node { \def\arraystretch{1.30} \begin{tabular}{c}
${\textbf{27}}$ \\ 2 \\ 1 \\ 1\\
\end{tabular}
} (8,13);
\draw (8,6) rectangle node { \def\arraystretch{1.30} \begin{tabular}{c}
${\textbf{27}}$ \\ 2 \\ 1 \\ 0\\
\end{tabular}
} (10,11);
\draw (10,6) rectangle node { \def\arraystretch{1.30} \begin{tabular}{c}
${\overline{\textbf{10}}}$ \\ 2 \\ 0 \\ 0\\
\end{tabular}
} (12,11);
\draw (3,9) node {${\textbf{8}} \otimes {\textbf{8}}$};
\end{tikzpicture}
\end{document}