将表格直接放在示例标题下

将表格直接放在示例标题下

现在,浅蓝色空间中有一张表格。我想将这张表格放在其上方的深蓝色框中,就在示例下方。我也不想要任何缩进。这是我目前所拥有的。在此处输入图片描述

\documentclass[a4paper,11pt,addpoints]{exam}
\usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=2cm]{geometry}

%noindent for whole doc
\setlength\parindent{0pt} 
%noindent for whole doc

%%%%%COLORS
\usepackage[dvipsnames]{xcolor}

%tables
\usepackage{tabularray}

%clour cells in table
\usepackage{nicematrix}

\usepackage{mathrsfs} 

%%%%%EXAMPLE BOX
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{amssymb}
\tcbuselibrary{theorems}
\newtcbtheorem
  []% init options
  {Example}% name
  {\textcolor{black}{\textbf{Example}}}% title
  {%
    colback=cyan!5,
    colframe=cyan!40,
    fonttitle=\rmfamily,
    arc=0pt,
  }% options
  {exam}% prefix

%%%%%EXAMPLE BOX

\begin{document}

\begin{Example}{Complete the table and plot the points to sketch a line of the linear relationship, $y = x + 3$.
}{label}
 \begin{tblr}{colspec = {|X[1,c]|X[1,c]|X[1,c]|X[1,c]|X[1,c]|X[1,c]|X[1,c]|X[1,c]|},
cell{1}{1} = {yellow!40},
cell{2}{1} = {yellow!40},
}
    \hline
    $x$ & $-3$ & $-2$ & $-1$ & $0$ & 1 & 2 & 3 \\
    \hline
    $y$ & & & & &\\
    \hline
\end{tblr} 
  
\end{Example}

\end{document}

我一直在尝试让文本变黑,所以如果它很奇怪你可以忽略它。

答案1

我不确定我是否理解了你的问题。
我建议这样做:

\documentclass[a4paper,11pt,addpoints]{exam}
\usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=2cm]{geometry}

%noindent for whole doc
\setlength\parindent{0pt} 
%noindent for whole doc

%%%%%COLORS
\usepackage[dvipsnames]{xcolor}

%tables
\usepackage{tabularray}

%clour cells in table
\usepackage{nicematrix}

\usepackage{mathrsfs} 

%%%%%EXAMPLE BOX
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{amssymb}
\tcbuselibrary{theorems}
\newtcbtheorem
  []% init options
  {Example}% name
  {Example}% title
  {%
  theorem hanging indent=0pt,
    colback=cyan!5,
    colframe=cyan!40,
    fonttitle=\rmfamily,
    arc=0pt,
    coltitle=black,
    fonttitle=\bfseries,
    description font=\normalfont,
  }% options
  {exam}% prefix

%%%%%EXAMPLE BOX

\begin{document}

\begin{Example}{Complete the table and plot the points to sketch a line of the linear relationship, $y = x + 3$.\vspace{4pt}\newline
  \begin{tblr}{
    colspec = {*8{X[c]}},
    hlines, vlines,
    column{1} = {yellow!40},
    columns={mode=math},
    }
    x & -3 & -2 & -1 & 0 & 1 & 2 & 3 \\
    y &&&&&&&\\
  \end{tblr}
  }{label}

\end{Example}

\end{document}

在此处输入图片描述

相关内容