答案1
我希望这对你有帮助。以下是我的代码。
\documentclass[dvipsnames,table]{article}
\usepackage{tikz}
\begin{document}
\begin{table}
\arrayrulecolor{cyan}
\begin{tabular}{|p{4.5cm}p{4.5cm}|} \hline
\rowcolor{Cyan!100} \multicolumn{2}{|c|}{\textbf{\textcolor{white}{TABLE 2.1 Terminology for Simple Regression}}} \\
\hspace{1.2cm} \textit{\textbf{y}} & \hspace{1.4cm} \textit{\textbf{x}} \\ \hline
\rowcolor{Cyan!10} Dependent variable & Independent variable \\
\rowcolor{White!100} Explained variable & Explanatory variable \\
\rowcolor{Cyan!10} Response variable & Control variable \\
\rowcolor{White!100} Predicted variable & Predictor variable \\
\rowcolor{Cyan!10} Regressand & Regressor \\ \hline
\end{tabular}
\end{table}
\end{document}
希望这会有所帮助。这是我的输出,
答案2
尝试这个:
\documentclass{article}
\usepackage{colortbl}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage{sans}
\renewcommand{\arraystretch}{1.5}
\begin{document}
\begin{table}
\refstepcounter{table}\label{tab:mytab}
\arrayrulecolor{cyan}
\rowcolors{3}{cyan!10}{white}
\begin{tabular}{|p{4.5cm}p{4.5cm}|} \hline
\rowcolor{cyan} \multicolumn{2}{|c|}{\textbf{\textcolor{white}{Table\thetable. Terminology for Simple Regression}}}\\
\centering\arraybackslash \textit{\textbf{y}} & \centering\arraybackslash\textit{\textbf{x}} \\ \hline
Dependent variable & Independent variable \\
Explained variable & Explanatory variable \\
Response variable & Control variable \\
Predicted variable & Predictor variable \\
Regressand & Regressor \\ \hline
\end{tabular}
\end{table}
From table \ref{tab:mytab}
\end{document}