1

I created a table like this:

{\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}

But I get an empty line between the heading and the table. Can someone tell me how to get rid of it?

enter image description here

Thanks

2
  • 3
    Why are you squeezing a float in tcolorbox? And the space has its origin in tcolorbox's setting of space above and below of the box, most likely. Also don't use \bf and ... tcolorbox has its own way of using tabularx ... and please post compilable documents, not just fragments
    – user31729
    Mar 27, 2018 at 10:59
  • 1
    Just use the optional title argument of the tcolorbox environment to set the title, like `\begin{tcolorbox}[title=repding]' . Mar 27, 2018 at 11:03

1 Answer 1

4

Use the title={...} etc. options and say top=0pt, for example.

frame hidden is most times better than colframe=white, especially if the background colour isn't 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}

Using tabularx= option, which can be used directly in the options, so tcolorbox wraps smoothly around the tabularx environment.

\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}

enter image description here

3
  • The hyperref link does not work here, of course, since I there is no label for that so far
    – user31729
    Mar 27, 2018 at 11:28
  • @ehmunnehm: You're welcome. Happy TeXing!
    – user31729
    Mar 27, 2018 at 12:17
  • To the unknown downvoter: Why the downvote? What is wrong with it?
    – user31729
    Mar 27, 2018 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .