Generalspecial toprule and bottom rule of table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
samisoma
Posts: 4
Joined: Mon Oct 22, 2007 1:20 pm

special toprule and bottom rule of table

Post by samisoma »

Hi all,
I need to have a table of the following shape:
corner2.jpg
corner2.jpg (14.73 KiB) Viewed 7812 times
Description
toprule
contents
bottomrule

where Description is left-aligned
toprule is a horzontal line with ends having angled-corners opposite to the ones in bottomrule
bottomrule is a horizontal line looks like (|_______________|) but connected (no spaces).

it is something like in the attached file. In fact I am not sure is it "box" or a "table".

thanks for help!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

special toprule and bottom rule of table

Post by localghost »

Maybe the arydshln package could be helpful.
samisoma
Posts: 4
Joined: Mon Oct 22, 2007 1:20 pm

special toprule and bottom rule of table

Post by samisoma »

localghost wrote: Maybe the arydshln package could be helpful.


thanx for the tip localghost. I was not aware of arydshln (good to know:-)). However, it does not help unless I do some workarounds like introducing table inside another..

Sami
samisoma
Posts: 4
Joined: Mon Oct 22, 2007 1:20 pm

special toprule and bottom rule of table

Post by samisoma »

In cae it is valuable for others. After try-and-error sessions, I got uncomplete solution:

Code: Select all

\par\noindent{\rule[-5pt]{0.4pt}{5pt}\leaders\hrule\hfill\rule[-5pt]{0.4pt}{5pt}}\newline

The contents

\vspace*{-5pt}\par\noindent\textcolor{inputcol}{\rule{0.4pt}{5pt}\leaders\hrule\hfill\rule{0.4pt}{5pt}} \newline

I need to put it in a new \newcommand, but the problem now is how to add \caption to it to be on top of the top-rule, lef-align and without vspace

any help?
samisoma
Posts: 4
Joined: Mon Oct 22, 2007 1:20 pm

special toprule and bottom rule of table

Post by samisoma »

The final solution:

Code: Select all

\documentclass[12pt,letterpaper]{report}
\begin{document}

\newcommand{\mytoprule}[1]{#1\vspace*{-12pt}\par\noindent{\rule[-5pt]{0.4pt}{5pt}\leaders\hrule\hfill\rule[-5pt]{0.4pt}{5pt}}\newline}

\newcommand{\mybottomrule}{\vspace*{-1pt}\par\noindent{\rule{0.4pt}{5pt}\leaders\hrule\hfill\rule{0.4pt}{5pt}}\newline}

\mytoprule{{\flushleft S{\footnotesize YNTAX}E{\footnotesize XTENSION}}}
  \begin{tabular}{ll}				
    $F\ ::=\ /\ |\ *\ |\ f $	&	\textit{Field Pattern} \\
  \end{tabular}
\mybottomrule
\end{document}
It will produce:
corner3.jpg
corner3.jpg (8.07 KiB) Viewed 7766 times
Thanx for your help!
Sami
Post Reply