我怎样才能使这三个表成为same width and height
和width of the first column of each table the same
?
另外,如何显示just to the right
“总计”表的“产品”表? minipage 环境似乎不适合我!
分数维:
\documentclass[10pt,a4paper]{article}
\pagestyle{empty}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{amsfonts,amsmath,amssymb,array,cellspace,tabularray,tabularx,tabvar,tikz,xcolor}
\UseTblrLibrary{varwidth}
\begin{document}
\begin{tblr}{
column{1}=36pt,
rows = {abovesep=4.5pt,belowsep=4.5pt},
columns = {leftsep=9pt,rightsep=9pt},
colspec={lcccccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {green!30},
stretch=-1,
measure=vbox}
\SetCell[r=1,c=1]{c} Somme \\
$\lim_{} f$ & $\ell$ & $\ell$ & $\ell$ & + $\infty$ & - $\infty$ & + $\infty$ \\
$\lim_{} g$ & $\ell '$ & + $\infty$ & - $\infty$ & + $\infty$ & - $\infty$ & - $\infty$ \\
$\lim_{} f + g$ & $\ell + \ell '$ & + $\infty$ & - $\infty$ & + $\infty$ & - $\infty$ & $?$ \\
\end{tblr}
\vspace{.3cm}
\begin{tblr}{
column{1}=36pt,
rows = {abovesep=4.5pt,belowsep=4.5pt},
columns = {leftsep=9pt,rightsep=9pt},
colspec={lcccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {blue!30},
stretch=-1,
measure=vbox}
\SetCell[r=1,c=1]{c} Produit \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0 $ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell '$ & $\infty$ & $\infty$ & $\infty$ \\
$\lim_{} f \times g$ & $\ell \times \ell '$ & $\infty$ & $\infty$ & $?$ \\
\end{tblr}
\vspace{.3cm}
\begin{tblr}{
column{1}=36pt,
rows = {abovesep=4.5pt,belowsep=4.5pt},
columns = {leftsep=9pt,rightsep=9pt},
colspec={lcccccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {purple!30},
stretch=-1,
measure=vbox}
\SetCell[r=1,c=1]{c} Quotient \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0$ & $\ell$ & $\infty$ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell ' \neq 0$ & $0$ & $\infty$ & $\ell$ & $\infty$ & $0$\\
$\lim_{} \dfrac{f}{g}$ & $\dfrac{\ell}{\ell '}$ & $\infty$ & $0$ & $\infty$ & ? & ? \\
\end{tblr}
\end{document}
提出的解决方案混合在一起,谢谢大家!
\noindent\begin{tblr}{
rows = {abovesep=4.5pt, belowsep=4.5pt},
rowspec={m{4mm} | t{10mm} | t{10mm} | t{10mm} },
columns = {leftsep=4pt, rightsep=4pt,26pt},
column{1}=1.5cm,
colspec={lcccccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {green!30},
stretch=-1,
% measure=\vbox
}
\SetCell[r=1,c=1]{c} Somme \\
$\lim_{} f$ & $\ell$ & $\ell$ & $\ell$ & $+\infty$ & $-\infty$ & $+\infty$ \\
$\lim_{} g$ & $\ell '$ & $+\infty$ & $-\infty$ & $+\infty$ & $-\infty$ & $-\infty$ \\
$\lim_{} f + g$ & $\ell + \ell '$ & $+\infty$ & $-\infty$ & $+\infty$ & $-\infty$ & $?$ \\
\end{tblr}
\vspace{.3cm}
\noindent\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt},
rowspec={m{4mm} | t{10mm} | t{10mm} | t{10mm} },
columns = {leftsep=4pt, rightsep=4pt,26pt},
column{1}=1.5cm,
colspec={lcccccc},
cell{1}{1}={c},
hline{2,3,4} = {1-6}{black},
vline{2} = {black},
cell{1}{1} = {purple!30},
stretch=-1,
% measure=\vbox
}
\SetCell[r=1,c=1]{c} Quotient \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0$ & $\ell$ & $\infty$ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell ' \neq 0$ & $0$ & $\infty$ & $\ell$ & $\infty$ & $0$\\
$\lim_{} \dfrac{f}{g}$ & $\dfrac{\ell}{\ell '}$ & $\infty$ & $0$ & $\infty$ & $?$ & $?$ \\
\end{tblr}
\hspace{.3cm}
\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt},
rowspec={m{4mm} | t{10mm} | t{10mm} | t{10mm} },
columns = {leftsep=4pt, rightsep=4pt,26pt},
column{1}=1.5cm,
colspec={lcccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {blue!30},
stretch=-1,
% measure=\vbox
}
\SetCell[r=1,c=1]{c} Produit \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0 $ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell '$ & $\infty$ & $\infty$ & $\infty$ \\
$\lim_{} f \times g$ & $\ell \times \ell '$ & $\infty$ & $\infty$ & $?$ \\
\end{tblr}
答案1
你问,
如何在“总计”表的右侧显示“产品”表?
我看不出这里有什么好的环境用例tblr
。我会改用三个array
环境——这样做的好处是不必提供那么多$
符号。此外,当迫切需要使用内联分数符号时,不要害怕使用。
\documentclass[a4paper]{article}
\usepackage[margin=2.5cm]{geometry} % set page parameters suitably
%% \usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{amssymb,amsmath}
\usepackage{array} % for 'w' column type
\usepackage{xcolor} % color support
\usepackage{colortbl} % for '\cellcolor' macro
% Determine widths of (a) header column and (b) data columns:
\newlength\lenA \settowidth\lenA{\textsf{Quotient}}
\newlength\lenB \settowidth\lenB{$\ell'\ne0$}
\begin{document}
\begin{table}[ht]
\renewcommand\arraystretch{1.5}
$\begin{array}{wl{\lenA} | *{6}{wc{\lenB}} @{}}
\cellcolor{green!30} \textsf{Somme} & \\
\hline
\lim f & \ell & \ell & \ell & +\infty & -\infty & +\infty \\
\hline
\lim g & \ell' & +\infty & -\infty & +\infty & -\infty & -\infty \\
\hline
\lim f{+}g& \ell+\ell' & +\infty & +\infty & +\infty & +\infty & \text{?}
\end{array}$
\hfill % maximize the horizontal separation
$\begin{array}{wl{\lenA} | *{4}{wc{\lenB}} @{}}
\cellcolor{blue!30} \textsf{Produit} & \\
\hline
\lim f & \ell & \ell\ne0 & \infty & 0 \\
\hline
\lim g & \ell' & \infty & \infty & \infty \\
\hline
\lim f{\times}g& \ell\times\ell' & \infty & \infty & \text{?}
\end{array}$
\bigskip
$\begin{array}{wl{\lenA} | *{6}{wc{\lenB}} @{}}
\cellcolor{purple!30} \textsf{Quotient} & \\
\hline
\lim f & \ell & \ell\ne0 & \ell & \infty & \infty & 0 \\
\hline
\lim g & \ell'\ne0 & 0 & \infty & \ell & \infty & 0 \\
\hline
\lim f{/}g& \ell/\ell' & \infty & 0 & \infty & \text{?} & \text{?}
\end{array}$
\end{table}
\end{document}
答案2
我不确定这是否是你想要的:
您需要删除表格之间的空行(这会导致新段落的开始)。
之后,columns = {leftsep=4pt, rightsep=4pt, 9mm}
会将所有列固定在9mm
。要使第一列特殊,请放置column{1}=36pt
后命令columns
。
\documentclass[10pt,a4paper]{article}
\pagestyle{empty}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{amsfonts,amsmath,amssymb,array,cellspace,tabularray,tabularx,tabvar,tikz,xcolor}
\UseTblrLibrary{varwidth}
\begin{document}
\noindent\begin{tblr}{
rows = {abovesep=4.5pt, belowsep=4.5pt},
columns = {leftsep=4pt, rightsep=4pt, 9mm},
column{1}=36pt,
colspec={lcccccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {green!30},
stretch=-1,
measure=vbox}
\SetCell[r=1,c=1]{c} Somme \\
$\lim_{} f$ & $\ell$ & $\ell$ & $\ell$ & + $\infty$ & $-\infty$ & $+\infty$ \\
$\lim_{} g$ & $\ell '$ & $+\infty$ & $-\infty$ & $+\infty$ & $-\infty$ & $-\infty$ \\
$\lim_{} f + g$ & $\ell + \ell '$ & $+\infty$ & $-\infty$ & $+\infty$ & $-\infty$ & $?$ \\
\end{tblr}
\quad
\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt},
columns = {leftsep=4pt, rightsep=4pt, 9mm},
column{1}=36pt,
colspec={lcccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {blue!30},
stretch=-1,
measure=vbox}
\SetCell[r=1,c=1]{c} Produit \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0 $ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell '$ & $\infty$ & $\infty$ & $\infty$ \\
$\lim_{} f \times g$ & $\ell \times \ell '$ & $\infty$ & $\infty$ & $?$ \\
\end{tblr}
\vspace{4mm}
\noindent\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt},
columns = {leftsep=4pt, rightsep=4pt, 9mm},
column{1}=36pt,
colspec={lcccccc},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {purple!30},
stretch=-1,
measure=vbox}
\SetCell[r=1,c=1]{c} Quotient \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0$ & $\ell$ & $\infty$ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell ' \neq 0$ & $0$ & $\infty$ & $\ell$ & $\infty$ & $0$\\
$\lim_{} \dfrac{f}{g}$ & $\dfrac{\ell}{\ell '}$ & $\infty$ & $0$ & $\infty$ & ? & ? \\
\end{tblr}
\end{document}
答案3
像这样的东西??
\documentclass{article}
\usepackage{tabularray,xcolor,mathtools}
\begin{document}
\noindent\begin{tblr}{
rows = {abovesep=4.5pt, belowsep=4.5pt},
rowspec={m{4mm} | t{10mm} | t{10mm} | t{10mm} },
columns = {leftsep=4pt, rightsep=4pt,25pt},
column{1}=1.5cm,
colspec={XXXXXX},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {green!30},
stretch=-1,
% measure=\vbox
}
\SetCell[r=1,c=1]{c} Somme \\
$\lim_{} f$ & $\ell$ & $\ell$ & $\ell$ & + $\infty$ & - $\infty$ & + $\infty$ \\
$\lim_{} g$ & $\ell '$ & + $\infty$ & - $\infty$ & + $\infty$ & - $\infty$ & - $\infty$ \\
$\lim_{} f + g$ & $\ell + \ell '$ & + $\infty$ & - $\infty$ & + $\infty$ & - $\infty$ & $?$ \\
\end{tblr}
\noindent
\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt},
rowspec={m{4mm} | t{10mm} | t{10mm} | t{10mm} },
columns = {leftsep=4pt, rightsep=4pt,25pt},
column{1}=1.5cm,
colspec={XXXX},
cell{1}{1}={c},
hline{2,3,4} = {1-7}{black},
vline{2} = {black},
cell{1}{1} = {blue!30},
stretch=-1,
% measure=\vbox
}
\SetCell[r=1,c=1]{c} Produit \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0 $ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell '$ & $\infty$ & $\infty$ & $\infty$ \\
$\lim_{} f \times g$ & $\ell \times \ell '$ & $\infty$ & $\infty$ & $?$ \\
\end{tblr}
\noindent\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt},
rowspec={m{4mm} | t{10mm} | t{10mm} | t{10mm} },
columns = {leftsep=4pt, rightsep=4pt,25pt},
column{1}=1.5cm,
colspec={XXXXXX},
cell{1}{1}={c},
hline{2,3,4} = {1-6}{black},
vline{2} = {black},
cell{1}{1} = {purple!30},
stretch=-1,
% measure=vbox
}
\SetCell[r=1,c=1]{c} Quotient \\
$\lim_{} f$ & $\ell$ & $\ell \neq 0$ & $\ell$ & $\infty$ & $\infty$ & $0$ \\
$\lim_{} g$ & $\ell ' \neq 0$ & $0$ & $\infty$ & $\ell$ & $\infty$ & $0$\\
$\lim_{} \dfrac{f}{g}$ & $\dfrac{\ell}{\ell '}$ & $\infty$ & $0$ & $\infty$ & ? & ? \\
\end{tblr}
\end{document}
答案4
我建议使用带有 3 个参数的命令
% #1--> color of the title (option)
% #2 --> number of columns 6 par défaut
% #3 --> the table
使用 mode=math 时,$ 不是必需的
EDIT2:为了解决过满问题,我改变了第一列的宽度,并建议在 em 中采取措施
\documentclass[10pt]{article}
\usepackage[margin=0.5cm]{geometry}
\usepackage{amsmath}
\usepackage{tabularray}
%\UseTblrLibrary{varwidth}
\usepackage{xcolor}
\ExplSyntaxOn
\NewDocumentCommand \sacha { O{} O{6} +m }
{ % #1--> couleur (option)
% #2 --> nombre de colonnes 6 par défaut
% #3 --> le tableau
\begin{tblr}{
rows = {abovesep=4.5pt,belowsep=4.5pt,ht=1.5\baselineskip},
columns = {leftsep=9pt,rightsep=9pt},
colspec = {
Q[l,wd=4em,mode=math]
*{#2}{Q[c,wd=2.6em,mode=math]}
},
cell{1}{1}={c,mode=text,bg=#1},
hline{2-4} = {1-Z}{black},
vline{2} = {black},
%stretch=-1,
%measure=vbox
}
#3
\end{tblr}
}
\ExplSyntaxOff
\begin{document}
\sacha[green!30]{
\SetCell[r=1,c=1]{c} Somme \\
\lim_{} f & \ell & \ell & \ell & + \infty & - \infty & + \infty \\
\lim_{} g & \ell ' & + \infty & - \infty & + \infty & - \infty & - \infty \\
\lim_{} f + g & \ell + \ell ' & + \infty & - \infty & + \infty & - \infty & ? }
\quad\sacha[blue!30][4]{
\SetCell[r=1,c=1]{c} Produit \\
\lim_{} f & \ell & \ell \neq 0 & \infty & 0 \\
\lim_{} g & \ell ' & \infty & \infty & \infty \\
\lim_{} f \times g & \ell \times \ell ' & \infty & \infty & ?
}
\smallskip
\sacha[purple!30]{
\SetCell[r=1,c=1]{c} Quotient \\
\lim_{} f & \ell & \ell \neq 0 & \ell & \infty & \infty & 0 \\
\lim_{} g & \ell ' \neq 0 & 0 & \infty & \ell & \infty & 0 \\
\lim_{} \dfrac{f}{g} & \dfrac{\ell}{\ell '} & \infty & 0 & \infty & ? & ?}
\end{document}