3
\documentclass[12pt]{article}

\usepackage{tabularx}

\begin{document}

\section{section 1}

\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} } | c | c | c | r | }
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1 & item 2 & item 3 & item 4 \\
    \hline
\end{tabular*}

\end{document}

And in the generated results, there are some extra lines. Why do I see these redundant borders and how to remove them?

table

Update:

Removing the first pipe line | does not help:

\documentclass[12pt]{article}

\usepackage{tabularx}

\begin{document}

\section{section 1}

\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} } c | c | c | r | }
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1 & item 2 & item 3 & item 4 \\
    \hline
\end{tabular*}

\end{document}

tabel2

and removal of @{\extracolsep{\fill} } gives me:

\documentclass[12pt]{article}

\usepackage{tabularx}

\begin{document}

\section{section 1}

\begin{tabular*}{0.75\textwidth}{ | c | c | c | r | }
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1 & item 2 & item 3 & item 4 \\
    \hline
\end{tabular*}

\end{document}

table3

4
  • Just move the first | of your columns specification directly before the @ symbol
    – AboAmmar
    Aug 3, 2015 at 1:13
  • @AboAmmar,there is no | before @ but if you mean the one after @ please see my update.
    – ar2015
    Aug 3, 2015 at 1:21
  • 1
    You specified a width (.75\textwidth) wider than your table contents. Use normal tabular and remove .75\textwidth
    – AboAmmar
    Aug 3, 2015 at 1:30
  • @AboAmmar, could you please leave your idea as answer?
    – ar2015
    Aug 3, 2015 at 1:51

2 Answers 2

0

Thanks to AboAmmar, I fixed the problem:

\documentclass[12pt]{article}

\usepackage{tabularx}

\begin{document}

\section{section 1}

\begin{tabular*}{0.75\textwidth}{ | c @{\extracolsep{\fill} } | c | c | r | }
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1 & item 2 & item 3 & item 4 \\
    \hline
\end{tabular*}

\end{document}

enter image description here

his other suggestion:

You specified a width (.75\textwidth) wider than your table contents. Use normal tabular and remove .75\textwidth

2
  • It would be more customary to leave a comment asking AboAmmar to post an answer you can accept so that he can get the credit for it, rather than taking credit for somebody else's solution yourself.
    – cfr
    Aug 3, 2015 at 1:48
  • @cfr, thanks for your comment. I know these humble guys don't like to leave answers. They could post answer from the beginning. I listened to you and asked AboAmmar to leave the answer. He didn't. While when I have had deleted my answer, some one else posted a new answer. So, I undeleted my answer and I will not delete it unless AboAmmar posts the answer.
    – ar2015
    Aug 3, 2015 at 3:47
0

There are two possible ways in this MWE. The first fits the box in a natural way and the second scales the box 50% larger than the standard size.

\documentclass[12pt]{article}
\usepackage{tabularx}

\begin{document}

\section{section 1}

\begin{tabular}{|c|c|c|r|}
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1 & item 2 & item 3 & item 4 \\
    \hline
\end{tabular}

\vspace{5mm}

\scalebox{1.50}{ %scales the box 1.5 times the normal size
\begin{tabular}{|c|c|c|r|}
    \hline
    label 1 & label 2 & label 3 & label 4 \\
    \hline
    item 1 & item 2 & item 3 & item 4 \\
    \hline
\end{tabular}
}

\end{document}

You must log in to answer this question.

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