我尝试使用 p{unit} 更改列,还尝试使用 thead 让表格中的最后一行换行。文本太多,超出页面范围,导致其他文本无法显示。有没有办法可以换行最后一行?
\documentclass[11pt,a4paper]{exam}
\usepackage{lmodern}
\usepackage[table]{xcolor}
\usepackage{makecell}
\usepackage{multicol}
\usepackage{array}
\usepackage[many,skins]{tcolorbox}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{parskip}
\usetikzlibrary{shapes.geometric}
\usepackage[margin=.75in]{geometry}
\definecolor{ND1}{RGB}{12,35,64}
\definecolor{ND2}{RGB}{201,151,0}
\setlength{\columnsep}{5cm}
\begin{document}
%-------------------------HEADING------------------------
\tcbset{fonttitle=\bfseries}
\begin{tikzpicture}
\draw[thick,fill=blue!15](0,23)--(8.2,23)--(8.2,21)--(0,21)--cycle;
\draw[thick,fill=blue!15](8.4,23)--(18.5,23)--(18.5,21)--(8.4,21)--cycle;
\node[ellipse,draw,text=blue,fill=white] (e) at (10.75,22) {\LARGE{UNIT 6}};
\node at (4,22.5){\Large{\textbf{Class Notes/}}};
\node at (4.5,22){\Large{\textbf{Guided Practice}}};
\node[anchor=west] at (13,22.6){\large{\textbf{Contextual}}};
\node[anchor=west] at (13,21.85){\large{\textbf{Applications of}}};
\node[anchor=west] at (13,21.3){\large{\textbf{Differentiation}}};
\end{tikzpicture}
%-------------------------LESSON SUMMARY------------------------
\begin{table}[h]
\centering
\begin{tabular}[h]{|c|c|c|c|}
\hline
\cellcolor{black}\textcolor{white}{FUN} & \cellcolor{ND2}AP Calculus BC & \cellcolor{ND2}Flint Hill Upper School & \cellcolor{ND2}Mr. Bennett \\ \hline
\rowcolor{brown!50}\cellcolor{ND1}\textcolor{white}{4}&Topic 6.8& \thead{Finding Antiderivatives and \\ Indefinite Inetgrals: Basic Rules and Notation} & Day 1 \& 2 \\ \hline
\multicolumn{4}{|l|}{\cellcolor{ND2}{\textbf{Learning Objective CHA-6C: Determine antiderivatives of functions and indefinite integrals, using knowledge of derivatives}.}} \\ \hline
\end{tabular}
\end{table}
\end{document}
任何帮助都将不胜感激。问题出在课程总结中
缺口
答案1
在图像中使用多部分形状,对于表格来说使用包似乎很tblr
方便tabularray
:
- 第三列使用的
X
列类型可以自动将长文本拆分为几行: - 对于最后一行,使用选项
hspan=\minimal
还可以将文本分成几行,如果它的长度超过跨列的宽度(在本例中是表格的宽度)
\documentclass[11pt,a4paper]{exam}
\usepackage[margin=.75in]{geometry}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{positioning,
shapes.geometric, shapes.multipart}
\definecolor{ND1}{RGB}{12,35,64}
\definecolor{ND2}{RGB}{201,151,0}
\usepackage{tabularray}
\begin{document}
%-------------------------HEADING------------------------
{\centering
\begin{tikzpicture}[
node distance = 0pt and 0.04\textwidth,
base/.style = {draw, thick, fill=blue!15,
inner sep=0pt, outer sep=0pt, minimum height=24mm,
font=\Large\bfseries},
M/.style = {base,
rectangle split, rectangle split parts=2, rectangle split horizontal,
rectangle split draw splits=false,
%rectangle split empty part width=0.22\textwidth,
text width = \dimexpr0.24\textwidth-0.5\pgflinewidth, align=center
},
N/.style = {base, text width =\dimexpr0.48\textwidth-0.5\pgflinewidth, align=center},
]
\node (n1) [N] {Class Notes\\Guided Practice};
\node (n2) [M, right=of n1]
{\nodepart{two} Contextual Applications of Differentiation};
\node[ellipse,draw, font=\Large, text=blue,fill=white] at (n2.mid) {UNIT 6};
\end{tikzpicture}
}
%-------------------------LESSON SUMMARY------------------------
\begin{table}[ht]
\begin{tblr}{hlines, vlines,
colspec = {c c X[c, m] c},
row{1,3} = {bg=ND1},
row{1,3} = {bg=ND2},
cell{1,2}{1} = {bg=black,fg=white},
cell{3}{1} = {c=4}{l},
hspan = minimal}
FUN & AP Calculus BC & Flint Hill Upper School & Mr. Bennett \\
4 & Topic 6.8 & Finding Antiderivatives and Indefinite Integrals: Basic Rules and Notation
& Day 1 \& 2 \\
Learning Objective CHA-6C: Determine antiderivatives of functions and indefinite integrals, using knowledge of derivatives.
& & & \\
\end{tblr}
\end{table}
\end{document}
答案2
您快到了:而不是
\multicolumn{4}{l}{...}`
你应该使用
\mulicolumn{4}{p<usable width>}{...}
最后一行的材料。要确定的值 <usable width>
,我建议您从文本块的整个宽度(参数\textwidth
)开始,减两端的两条垂直线所占用的空间(参数:)\arrayrulewidth
,以及减LaTeX 在左边和右边插入的填充(参数:)\tabcolsep
。
\documentclass[11pt,a4paper]{exam}
%% I've simplified the preamble as much as possible
\usepackage[margin=.75in]{geometry}
\usepackage{lmodern}
%\usepackage{parskip}
\usepackage{makecell}
%\usepackage{multicol}
%\setlength{\columnsep}{5cm}
\usepackage{array}
%\usepackage[many,skins]{tcolorbox}
%\usepackage{tikz,pgfplots}
%\pgfplotsset{compat=newest}
%\usetikzlibrary{shapes.geometric}
\usepackage[table]{xcolor}
\definecolor{ND1}{RGB}{12,35,64}
\definecolor{ND2}{RGB}{201,151,0}
\usepackage{calc} % <-- new, to simplify dimension calculations
\begin{document}
\begin{table}[h]
\setlength\extrarowheight{2pt} % optional, for a less-cramped look
%\centering % not needed
\begin{tabular}[h]{|c|c|c|c|} % LaTeX will determine width of fourth 'c' col. as a residual
\hline
\rowcolor{ND2}
\cellcolor{black}\textcolor{white}{\bfseries FUN} &
AP Calculus BC & Flint Hill Upper School & Mr.\ Bennett \\
\hline
\rowcolor{brown!50}
\cellcolor{ND1}\textcolor{white}{\bfseries 4} &
Topic 6.8 &
\thead{Finding Antiderivatives and \\
Indefinite Integrals: Basic Rules and Notation}
& Day 1 \& 2 \\
\hline
\rowcolor{ND2}
\multicolumn{4}{|%
>{\raggedright\arraybackslash}p{% % suppress justification and hyphenation
\textwidth-2\tabcolsep-2\arrayrulewidth}|}{% % calculate usable width
\bfseries Learning Objective CHA-6C: Determine antiderivatives of
functions and indefinite integrals, using knowledge of derivatives.} \\
\hline
\end{tabular}
\end{table}
\end{document}