我对 LaTeX 表格有问题,右侧的表格无法关闭
\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{amsfonts, amssymb, amsmath, array}
\usepackage{shapepar, pifont, color, enumerate}
\usepackage{multirow}
\voffset-30mm
\hoffset-15mm
\textwidth175mm
\textheight260mm
\begin{document}
\begin{tabular}[t]{|c|c|c|c|c|c|c|c|c|c|c|}
\hline
$x$ & $\left(-\infty;{0}\right)$ & $\left(0\right)$ & $\left(0;\frac{{4}}{3}\right)$ & $\frac{{4}}{3}$ & $\Big(\frac{{4}}{3};{\frac{8}{3}}\Big]$ & ${\frac{8}{3}}$ & $\left(\frac{{8}}{3};+\infty\right)$ \\
\hline
$f'(x)$ & $-$ & $0$ & $+$ & $+$ & $0$ & $-$ & $-$ \\
\hline
$f''(x)$ & $+$ & 0 & {$-$}& {$-$} & 0 & $+$ & $+$ \\
\hline
{$f(x)$} & {$\searrow$} & $f_{max}=$ &\multicolumn{2}{c|} {\multirow{2}{*}{$\nearrow$}} & $f_{min}=$ & \multicolumn{2}{c|} {\multirow{2}{*}{$\searrow$}} \\
& \multicolumn{1}{c|}{\phantom{,}} & ${\frac{121}{81}}$ & \multicolumn{2}{c|}{\phantom{,}} & ${-\frac{5}{3}}$ \\
\cline{2-8}
&\multicolumn{3}{c|}{\multirow{2}{*}{{\Large $\smile$}}} &Точка перегиба& \multicolumn{3}{c|}{\multirow{2}{*}{{\Large $\frown$}}} \\
& \multicolumn{3}{c|}{\phantom{,}} & \\
\hline
\end{tabular} \\
\end{document}
答案1
为什么在使用 8 列时要声明 11 列?我简化了您的代码以使用环境array
,将其替换\multirow
为\makecell
,这允许在标准单元格中换行,并为单元格添加了一些垂直填充。
无关:您指定布局参数的方式不正确(边注的空间溢出了纸张)。您应该使用geometry
更直观的包。
\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{amssymb, amsmath, array}
\usepackage{ makecell, bigstrut}
\voffset-30mm
\hoffset-15mm
\textwidth175mm
\textheight260mm
\begin{document}
\[ \setcellgapes{4pt}\makegapedcells
\begin{array}[t]{|*{8}{c|}}
\hline
x & (-\infty;{0} ) & (0 ) & \bigl(0;\frac{4}{3}\bigr) & \frac{4}{3} & \bigl(\frac{4}{3};{\frac{8}{3}}\bigr] & \frac{8}{3} & \bigl(\frac{{8}}{3};+\infty\bigr) \\
\hline
f'(x) & - & 0 & + & + & 0 & - & - \\
\hline
f''(x) & + & 0 & {-}& {-} & 0 & + & + \\
\hline
{f(x)} & {\searrow} &\makecell{f_\text{max}=\\ \frac{121}{81}} &\multicolumn{2}{c|} {\nearrow} & \makecell{f_\text{min}= \\ -\frac{5}{3}} & \multicolumn{2}{c|} {\searrow} \\
\cline{2-8}
&\multicolumn{3}{c|}{\text{\Large $ \smile $}} & \bigstrut[t]\text{Точка перегиба}& \multicolumn{3}{c|}{\text{\Large $ \frown $}} \\
\hline
\end{array} \]
\end{document}
答案2
使用包makecell
和tabularx
,由包决定的页面布局geometry
:
\documentclass[a4paper, 12pt]{article}
\usepackage[margin=25mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{amssymb,
nccmath} % for midsize fraction \mfrac{}{}. it also call amsmath
\usepackage{makecell, tabularx}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begingroup
\centering
\setcellgapes{4pt}\makegapedcells
\setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}[t]{|>{\centering\arraybackslash $}l<{$}|
*{7}{>{\centering\arraybackslash $}X<{$}|}}
\hline
x & (-\infty;{0} ) & (0 ) & \Bigl(0;\mfrac{4}{3}\Bigr) & \mfrac{4}{3} & \Bigl(\mfrac{4}{3};{\mfrac{8}{3}}\Bigr] & \mfrac{8}{3} & \Bigl(\mfrac{{8}}{3};+\infty\Bigr) \\
\hline
f'(x) & - & 0 & + & + & 0 & - & - \\
\hline
f''(x) & + & 0 & {-}& {-} & 0 & + & + \\
\hline
{f(x)} & {\searrow} &\makecell{f_\text{max}=\mfrac{121}{81}} &\multicolumn{2}{c|}{$\nearrow$}
& \makecell{f_\text{min}=-\mfrac{5}{3}} & \multicolumn{2}{c|} {$\searrow$} \\
\cline{2-8}
& \multicolumn{3}{c|}{\text{\Large $\smile $}}
& \makecell{\text{Точка}\\ \text{перегиба}}
& \multicolumn{3}{c|}{\text{\Large $\frown $}} \\
\hline
\end{tabularx}
\end{document}