1

Why I got an extra navy space to the left in the header of the table?

Also, I want the diagonal line to be fit properly, any help.

\documentclass[a4paper,12pt]{article}

\usepackage{pict2e}
\usepackage[svgnames,  table, x11names]{ xcolor}%
\usepackage{caption, tabularx,  booktabs,  hhline}
\usepackage{diagbox, eqparbox, hhline}
\setlength{\arrayrulewidth}{0.5mm}
\setlength{\tabcolsep}{20pt}
\renewcommand{\arraystretch}{1.5}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}

\begin{document}

\rowcolors{2}{PowderBlue!50}{PowderBlue!25} 
\begin{table}[H]
\centering
\caption{Decreasing percentage in amplitude}
\medskip
\label{tab:amplitude decreasing percentage}
\begin{tabular}[H]{>{\hspace{-1\tabcolsep}} *{6} {>{$}c<{$}}<{\hspace{-1\tabcolsep}}}
\rowcolor{Navy!80} \toprule
\textbf{\diagbox[height=8ex, width=4.5cm]{\raisebox{0.1\height}{\enspace\color{white}variables}}{ \raisebox{-1.5\height}{\, \color{white}$\Phi$}}}
& \color{white} 0.1\% &\color{white} 0.5\% &\color{white} 1\% & \color{white}1.5\% & \color{white}2\% \\ \midrule
x   &   3.34    &   16.19   &   31.11   &   44.65   &   56.77  \\ 
y  & 3.23   &   15.73   &   30.38 & 43.79    & 55.91 \\
\dot{x} & 3.36  &   16.2     &  31.09    &  44.61    &  56.80   \\
\dot{y} & 3.23  &   15.73    &  30.38    &  43.77    &  55.91 \\ 
\bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

  • @JohnKormylo > can be used, just that the argument is incorrect here as shown in Bernard's answer. – David Carlisle Mar 18 '17 at 7:44
5

The faulty was your >{\hspace{-1\tabcolsep}}. I took the opportunity to use siunitx to align numbers on the decimal dot and simplify the code:

\documentclass[a4paper,12pt]{article}

\usepackage{pict2e}
\usepackage{amsmath}
\usepackage[svgnames, table, x11names]{ xcolor}%
\usepackage{caption, tabularx, booktabs, hhline}
\usepackage{diagbox, eqparbox, hhline}
\setlength{\arrayrulewidth}{0.5mm}
\setlength{\tabcolsep}{20pt}
\renewcommand{\arraystretch}{1.5}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\usepackage{siunitx}
\sisetup{table-number-alignment=center}

\begin{document}

\rowcolors{2}{PowderBlue!50}{PowderBlue!25}
\begin{table}
\centering
\caption{Decreasing percentage in amplitude}
\medskip
\label{tab:amplitude decreasing percentage}%>{\hspace{-1\tabcolsep}}, height=8ex,
\begin{tabular}{>{$}c<{$}S[table-format=1.2]*{4} {S[table-format=2.2]}}
\rowcolor{Navy!60}%
 \toprule
\textbf{\diagbox[width=4cm, linecolor=PowderBlue!50,linewidth=1.2pt]{\raisebox{0ex}{\color{white}variables}}{ \raisebox{-1.5\height}{\, \color{white}$\boldsymbol\Phi$}}}
& {\color{white}\bfseries 0.1\,\%} &{\color{white}\bfseries 0.5\,\%} &{\color{white}\bfseries 1\,\%} & {\color{white}\bfseries1.5\,\%} & {\color{white}\bfseries 2\,\%} \\ \midrule
x & 3.34 & 16.19 & 31.11 & 44.65 & 56.77 \\
y & 3.23 & 15.73 & 30.38 & 43.79 & 55.91 \\
\dot{x} & 3.36 & 16.2 & 31.09 & 44.61 & 56.80 \\
\dot{y} & 3.23 & 15.73 & 30.38 & 43.77 & 55.91 \\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.