Here is the table in question:
- [Came during my attempting to answer this question (not relevant for this question). Improved by using leandriis's answer and Bernard's answer].
As we see, the colour overflows the table side margins.
- What is causing this?
- How to fix it? Minimally invasive procedure is preferred.
I have currently not reduced the MWE further to increase possibility that the solution works for the case at hand (lipsum part is removed).
\documentclass[12pt]{article}
\usepackage[labelsep=period, tableposition=top, labelfont=bf, singlelinecheck=false]{caption}
\usepackage[table]{xcolor} %for cell colour
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{siunitx} %for the case when the table had lots of numbers to align (not used here)
\usepackage{threeparttable}
\makeatletter\usepackage{microtype}\g@addto@macro@verbatim{\microtypesetup{activate=false}}\makeatother%
\renewcommand\cellalign{cr} %align inside \makecell
\newcolumntype{N}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{O}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
#1\ignorespaces
} %to make entire row boldface/color with one command instead of one at a time
\begin{document}
\begin{table}[!htbp]
\setlength{\extrarowheight}{1.5ex}
\centering
\begin{threeparttable}
\caption{Title for your table goes here \vspace{-0.7em}}
\begin{tabular}{@{} Nc|Oc|Oc|Oc|Oc @{}}
\Xhline{0.1em}
\rowstyle{\bfseries\cellcolor{cyan!70}} %here is where the colouring takes place
{Parabola} & {Curve} & {Focus} & {Directrix} & {Vertex}\[1ex]
\Xhline{0.07em}
$x^2 = 4py$ & \makecell{up if $p > 0$ \ down if $p < 0$} & $F(0, p)$ & $y = -p$ & $V(0, 0)$\
\Xcline{1-5}{0.03em}%horisontal line
$y^2 = 4px$ & \makecell{right if $p > 0$\ left if $p < 0$} & $F(p, 0)$ & $x = -p$ & $V(0, 0)$\
\Xhline{0.08em}
\end{tabular}
\label{table: label for table}
\end{threeparttable}
\end{table}
\end{document}



@{}. – leandriis Apr 24 '21 at 17:14@{}. – Bernard Apr 24 '21 at 17:16@{}. – leandriis Apr 24 '21 at 17:17