I'm trying to change the margin of a page containing a table so that the table start after 1cm from left and right. I found this solution but when I tried it, it only changes one side of the table. Does anyone know how to change it for both sides?!
\documentclass{article}
\usepackage[margin=2.3cm]{geometry} %The margin for the whole document
\usepackage[hidelinks]{hyperref}
\usepackage{color, colortbl}
\usepackage{caption}
\captionsetup[table]{skip=5pt}
\usepackage{enumitem, etoolbox, tabularx, makecell, booktabs}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\begin{document}
You can find table \ref{table:Mytable} on page \pageref{table:Mytable}.
\newpage
\definecolor{Gray}{gray}{0.9}
\begin{table}[!htbp]
\caption{My table}
\label{table:Mytable}
{\renewcommand{\arraystretch}{3}
\setlist[itemize]{wide=0pt, leftmargin=*, topsep=0pt, after=\vspace*{-\baselineskip}}
\AtBeginEnvironment{itemize}{\compress}
\hspace*{-1cm}\begin{tabularx}{\linewidth}{X *{3}{p{20mm}} p{18mm}p{42mm}}
\rowcolor{Gray}
\toprule
& \textbf{\thead{Column \\ 2}} & \textbf{\thead{Column \\ 3}} & \textbf{\thead{Column \\ 4}} & \textbf{\thead{Column \\ 5}} & \textbf{\thead{Column \\ 6}} \\
\midrule
%Row1
entry1 & \centering entry2 & \centering entry3 & \centering entry4 & \centering entry5 & \begin{itemize} \item entry6.1 \item entry6.2 \end{itemize}
\\
\bottomrule
\end{tabularx}\hspace*{-1cm}}
\end{table}
\newpage
\end{document}
margin
of the table? Your table leaks into the left margin, which is the consequence of\hspace*{-1cm}
...\newgeometry
statement, with respective margin settings, but please note that that\newgeometry
will ship a new page first