Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
How to separate table content and table style

is it possible to create a document wide table setting for how table border are applied for each table?

I want to have the first table line have bold borders on top and bottom and the last row of a table should have a bold border at the bottom. As i do not want to specify all of this for each table, is there a way to do it one?

====================
row 1
====================
row 2
--------------------
row ..
------------------
row n
===================

Legend:

"==" -> bold border

"--" -> normal border

share|improve this question

marked as duplicate by cmhughes, Thorsten, lockstep, Joseph Wright Mar 3 '12 at 22:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
very closely related: how-to-separate-table-content-and-table-style –  cmhughes Mar 2 '12 at 19:37
add comment

1 Answer

Below, I have defined a myTabular environment that you can use. It takes two parameters: the first is the usual parameter for tabular to specify the alignment, the second is the header row. So specifying something such as:

\begin{MyTabular}{c c}{Header 1 & Header 1}
    1.234  & 2.345\\\hline
    4.5678 & 5.123\\
\end{MyTabular}

produces:

enter image description here

References:

Code:

\documentclass{article}

% http://tex.stackexchange.com/questions/41758/how-can-i-reproduce-this-table-with-thick-lines
\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline
}
\makeatother

\newenvironment{MyTabular}[2]{%
    \begin{tabular}{#1}%
    \thickhline#2\\\thickhline%
}{%
    \thickhline%
    \end{tabular}%
}%

\begin{document}
\noindent
\begin{MyTabular}{c c}{Header 1 & Header 1}
    1.234  & 2.345\\\hline
    4.5678 & 5.123\\
\end{MyTabular}
\end{document}
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.