我创建了这样一个表格:
{\bf \color{LightBlue} \small repding}
\begin{tcolorbox}[arc=0pt, outer arc=0pt ,colback=ColWhite, colframe = ColWhite]
\begin{table}[H]
\begin{tabularx}{\textwidth}{cX}
\textcolor{GrayMid}{Code} & \textcolor{GrayMid}{Description} \\
[0.3ex]
\hline
\hyperref[fac68b5b180]{RA X} & RA\_O \\ \hline
\end{tabularx}
\end{table}
\end{tcolorbox}
但是标题和表格之间出现了一条空行。有人能告诉我如何去掉它吗?
谢谢
答案1
例如,使用title={...}
等选项并说。top=0pt
frame hidden
大多数情况下都比 更好colframe=white
,特别是当背景颜色不是白色时。
\documentclass{article}
\PassOptionsToPackage{x11names,dvipsnames,svgnames}{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{tabularx}
\usepackage{hyperref}
\colorlet{ColWhite}{white}
\colorlet{GrayMid}{black!50}
\begin{document}
\begin{tcolorbox}[enhanced, sharp corners, frame hidden,colback=ColWhite,fonttitle={\bfseries\small}, coltitle={LightBlue}, title={repding},top=0pt]
\begin{tabularx}{\textwidth}{cX}
\textcolor{GrayMid}{Code} & \textcolor{GrayMid}{Description} \\
[0.3ex]
\hline
\hyperref[fac68b5b180]{RA X} & RA\_O \\ \hline
\end{tabularx}
\end{tcolorbox}
\end{document}
使用 tabularx= 选项,可以在选项中直接使用,因此可以tcolorbox
顺利地环绕tabularx
环境。
\documentclass{article}
\PassOptionsToPackage{x11names,dvipsnames,svgnames,table}{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{tabularx}
\usepackage{hyperref}
\colorlet{ColWhite}{white}
\colorlet{GrayMid}{black!50}
\begin{document}
\begin{tcolorbox}[enhanced, sharp corners,frame hidden,colback=ColWhite,fonttitle={\bfseries\small}, coltitle={LightBlue}, lefttitle={0pt}, title={repding},top=0pt, tabularx={cX}]
\textcolor{GrayMid}{Code} & \textcolor{GrayMid}{Description} \\
[0.3ex]
\hline
\hyperref[fac68b5b180]{RA X} & RA\_O \\ \hline
\end{tcolorbox}
\end{document}