1

Here in my code i want to slightly (approximately 2cm) move table on left side. Is it possible?

MWE

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{parskip}
\usepackage[shortlabels]{enumitem}
\usepackage{mathrsfs}
\usepackage{array}
\usepackage{cellspace}
\setlength\cellspacetoplimit{7pt}
\setlength\cellspacebottomlimit{7pt}
\pagestyle{empty}
\usepackage{amssymb}
\renewcommand{\baselinestretch}{1.0}
\usepackage[left=1.300cm, right=1.300cm, top=1.300cm, bottom=1.300cm]{geometry}
\begin{document}
\begin{enumerate}[\bfseries(A),left=0pt]
\item Calculate for given data.

    \begin{tabular}{|c|              % <---
        *{10}{S{>{$}c<{$}}|}} % <---
    \hline
    $x$ & 43 & 44 & 36 & 38 & 47 & 40 & 41 & 54 & 37 & 46\\ \hline
    $y$ & 74 & 76 & 60 & 68 & 79 & 70 & 71 & 94 & 65 & 78\\ \hline
\end{tabular}
\item 
\item 
\end{enumerate}
\end{document}
koleygr
  • 20,105
SandyM
  • 2,757

1 Answers1

1

I suspect that you like to move table to the left text border. As mentioned @DavidCarlisle, table inside list start at \leftmarigini, so you need to move for this amount to the left by use of the \hspace*:

\documentclass[12pt,a4paper]{article}
\usepackage[margin=1.300cm]{geometry}
\usepackage[shortlabels]{enumitem}
\usepackage{mathrsfs}
\usepackage{array}
\usepackage{cellspace}
\setlength\cellspacetoplimit{7pt}
\setlength\cellspacebottomlimit{7pt}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{enumerate}[\bfseries(A),left=0pt]
\item Calculate for given data.

\hspace*{-\leftmargin}\begin{tabular}{% <---
        |c|*{10}{S{>{$}c<{$}}|}}  
    \hline
    $x$ & 43 & 44 & 36 & 38 & 47 & 40 & 41 & 54 & 37 & 46\\ \hline
    $y$ & 74 & 76 & 60 & 68 & 79 & 70 & 71 & 94 & 65 & 78\\ \hline
\end{tabular}
\item
\item
\end{enumerate}
\end{document}

enter image description here

(red lines indicate text borders)

Addendum: What you mean with right side? That the right border of table is aligned with right border of text area? In this case consider @Werner comments below. With it the result of above MWE is: enter image description here

Zarko
  • 296,517
  • If i want to move the table on right side then only i have to replace left by right? – SandyM Oct 01 '19 at 17:59
  • 1
    @Maths4Sandy: By "right side", are you referring to the right margin? That is, you want the table flush against the right margin? For that, replace \hspace*{-\leftmargin} with \mbox{}\hfill. – Werner Oct 01 '19 at 18:01
  • @Werner As in the solution given by Zarko, table is moved on left side. i am asking that is it possible to move the table on right side with same distance. – SandyM Oct 01 '19 at 18:04
  • @Maths4Sandy: You can just insert whatever horizontal space you need. For example, \hspace*{\leftmargin} would move it to the right in the same amount the \hspace*{-\leftmargin} would move it to the left (note the negative length). More details on lengths and horizontal movement is available here: What commands are there for horizontal spacing? – Werner Oct 01 '19 at 18:06
  • Got it thanks a lot to Werner. – SandyM Oct 01 '19 at 18:08