6

I have a table

\begin{table}[ht]
\caption{Caption} 
\label{Lable} \\
\begin{tabularx}{\textwidth}{@{}  LLLL @{}}
\toprule
& \textbf{Col 1} & \textbf{Col 2} & \textbf{Col3} \\
\midrule
A & 1 & 2 & 3 \\
B & 4 & 5 & 6 \\
C & 7 & 8 & 9 \\
\bottomrule
& 10 & 11 & 12
\end{tabularx}
\end{table}

Is there a way to make this table a certain amount wider than my textwidth, without taking it out of my textflow, using .pt values? I dont want the table to start on a new page/occupy a whole page after setting it wider than the textwidth.

1

4 Answers 4

3

You need to wrap the tabularx environment into a minipage environment which a larger \textwidth then center or lap that minipage. The simplest way is to use the adjustbox package for that:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{adjustbox}

\usepackage{lipsum}% only for example text 

\begin{document}
\lipsum

\begin{table}[ht]
\caption{Caption}\label{Lable} 
\begin{adjustbox}{minipage=18cm, center}
\begin{tabularx}{\textwidth}{@{} llll @{}}
\toprule
& \textbf{Col 1} & \textbf{Col 2} & \textbf{Col3} \\
\midrule
A & 1 & 2 & 3 \\
B & 4 & 5 & 6 \\
C & 7 & 8 & 9 \\
\bottomrule
& 10 & 11 & 12
\end{tabularx}
\end{adjustbox}
\end{table}

\lipsum
\end{document}

Note that I changed the column-characters from L to l as I didn't had the L definition handy.

Note: If you just want to add some pt value to the current textwidth use e.g minipage=\textwidth+20pt,center. This adds 10pt on the left and right.

If you want the table to go 10pt into the right margin only use minipage=\textwidth+10pt,left.

If you want the table to go 10pt into the left margin only use minipage=\textwidth+10pt,right.

enter image description here

2

i guessing ...

enter image description here

red lines indicate page layout.

with use of changepage package:

\begin{table}[ht]
    \begin{adjustwidth}{}{-12pt}
\caption{Caption}
\label{Lable}
\begin{tabularx}{\linewidth}{@{}  LLLL @{}}
\toprule
& \textbf{Col 1} & \textbf{Col 2} & \textbf{Col3} \\
\midrule
A & 1 & 2 & 3 \\
B & 4 & 5 & 6 \\
C & 7 & 8 & 9 \\
\bottomrule
& 10 & 11 & 12
\end{tabularx}
    \end{adjustwidth}
\end{table}

or if you like that table spill out on both side text body:

enter image description here

for this you only change

\begin{adjustwidth}{-12pt}{-12pt}

you not provide complete small document, so i test above solution in mine "table testbad", which is not intended to show here ...

2

I would go the simple route, \makebox[\textwidth]{table of \textwidth + xpt}. This will automatically center the table in addition to increasing the width by xpt.

\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{lipsum}% only for example text 
\begin{document}

\lipsum

\begin{table}[ht]
\caption{Caption}\label{Lable} 
\makebox[\textwidth]{%
\begin{tabularx}{\dimexpr\textwidth+50pt}{@{} llll @{}}
\toprule
& \textbf{Col 1} & \textbf{Col 2} & \textbf{Col3} \\
\midrule
A & 1 & 2 & 3 \\
B & 4 & 5 & 6 \\
C & 7 & 8 & 9 \\
\bottomrule
& 10 & 11 & 12
\end{tabularx}
}
\end{table}

\lipsum

\end{document}

enter image description here

1
  • this is what I'd do too:-) Commented Feb 15, 2018 at 14:17
1

Should you have a tabularx breaking across pages, you can load the ltablex package, which combines longtable and tabularx, so that you can use the longtable parameters within tabularx:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{ltablex}
\usepackage{adjustbox}

\usepackage{lipsum}% only for example text

\begin{document}

\lipsum[1-4]
\begingroup
\setlength\LTleft{-40pt}
\setlength\LTright{-40pt}
\keepXColumns
\begin{tabularx}{1.2\textwidth}{@{}*{4}{X}@{}}
\caption{Caption}\label{Lable} \\
\toprule
\endfirsthead
\multicolumn{4}{c}{\tablename~\thetable: Caption (continued)}\smallskip \\
\midrule
\endhead
\midrule
\multicolumn{4}{r@{}}{to be continued}\\
\endfoot
\bottomrule
\endlastfoot
& \textbf{Col 1} & \textbf{Col 2} & \textbf{Col3} \\
\midrule
A & 1 & 2 & 3 \\
B & 4 & 5 & 6 \\
C & 7 & 8 & 9 \\
D & 10 & 11 & 12 \\
E = & 13 & 14 & 15 \\
F = & 16 & 17 & 18 \\
\midrule
T & 51 & 57 & 63
\end{tabularx}
\endgroup

\lipsum[5]

\end{document} 

enter image description here

You must log in to answer this question.

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