3

I wish to typeset a table with specific borders, where the the column rule separators are thicker, and also the first, second and last horizontal rules.

I've tried using the tabu package and it didn't even compile, so I'm working on this:

\usepackage{array}
\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
      \futurelet \reserved@a \@xhline
}

\newcolumntype{'}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother 

\begin{document}
.
.
.
\begin{center}
\begin{tabular}{'c'c'c'c|}\thickhline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$\\\thickhline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\thickhline
\end{tabular}
\end{center}

What I got is a table where the rules exceed the columns when I choose a thicker first column separator. I really looked into lots of questions and sites but couldn't solve my problem, and I'd like it to work; it doesn't matter how, better if in a simple way.

6

Please always post complete documents not just fragments.

You can simplify the horizontal case as you don't need the lookahead, and in the vertical case the padding was wrong, it is easier to use ! which automatically gets the same spacing as |.

enter image description here

\documentclass{article}
\usepackage{array}

\usepackage{array}
\makeatletter
\newcommand{\thickhline}{%
    \noalign {\hrule height 2pt}%
}

\newcolumntype{'}{!{\vrule width 2pt}}
\makeatother 

\begin{document}
.
.
.
\begin{center}
\begin{tabular}{'c|c|c|c'}\thickhline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$\\\thickhline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\hline
$(x)$ & $(x\pm x)$ & $(x\pm x)$ & $(x\pm x)$ \\\thickhline
\end{tabular}
\end{center}

\end{document}

(Someone is going to say you shouldn't use vertical rules and should look at the booktabs package, so I may as well mention that to pre-empt them)

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.