Graphics, Figures & Tables ⇒ Rectangles around Table Cells
Rectangles around Table Cells
I'd like to achieve the attached image in LaTeX.
How could I make a rectangle around a bunch of cells in LaTeX?
Thanks
- Attachments
-
- Screen shot 2011-05-25 at 5.17.47 PM.png (21.02 KiB) Viewed 15167 times
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
Rectangles around Table Cells
I used it long time ago. More recently, but still some years ago I made some Karnaugh maps with TikZ. If you are interested I can send you some example.
Ignasi
Re: Rectangles around Table Cells
Therefore I would like to do it myself..
Rectangles around Table Cells
Best regards,
Ignasi
Code: Select all
\documentclass{article}\usepackage{tikz}\usetikzlibrary{matrix,calc}%internal group%#1-space between node and grouping line. Default=0%#2-top left node%#3-bottom right node\newcommand{\implicant}[3][0]{\draw[rounded corners=3pt] ($(#2.north west)+(135:#1)$) rectangle ($(#3.south east)+(-45:#1)$);}%group lateral borders%#1-space between node and grouping line. Default=0%#2-top left node%#3-bottom right node\newcommand{\implicantcostats}[3][0]{\draw[rounded corners=3pt] ($(rf.east |- #2.north)+(90:#1)$)-| ($(#2.east)+(0:#1)$) |- ($(rf.east |- #3.south)+(-90:#1)$);\draw[rounded corners=3pt] ($(cf.west |- #2.north)+(90:#1)$) -| ($(#3.west)+(180:#1)$) |- ($(cf.west |- #3.south)+(-90:#1)$);}%group top-bottom borders%#1-space between node and grouping line. Default=0%#2-top left node%#3-bottom right node\newcommand{\implicantdaltbaix}[3][0]{\draw[rounded corners=3pt] ($(cf.south -| #2.west)+(180:#1)$) |- ($(#2.south)+(-90:#1)$) -| ($(cf.south -| #3.east)+(0:#1)$);\draw[rounded corners=3pt] ($(rf.north -| #2.west)+(180:#1)$) |- ($(#3.north)+(90:#1)$) -| ($(rf.north -| #3.east)+(0:#1)$);}%group corners%#1-space between node and grouping line. Default=0\newcommand{\implicantcantons}[1][0]{\draw[rounded corners=3pt] ($(rf.east |- 0.south)+(-90:#1)$) -| ($(0.east |- cf.south)+(0:#1)$);\draw[rounded corners=3pt] ($(rf.east |- 8.north)+(90:#1)$) -| ($(8.east |- rf.north)+(0:#1)$);\draw[rounded corners=3pt] ($(cf.west |- 2.south)+(-90:#1)$) -| ($(2.west |- cf.south)+(180:#1)$);\draw[rounded corners=3pt] ($(cf.west |- 10.north)+(90:#1)$) -| ($(10.west |- rf.north)+(180:#1)$);}%Empty Karnaugh map 4x4\newenvironment{Karnaugh}%
Re: Rectangles around Table Cells
I am having the same issue. Did you find the right code?
Were you able to draw the kmap in your picture?
Thank you
OOzy
Re: Rectangles around Table Cells
Ignasi
Rectangles around Table Cells
Yes, I did but it does not produce the image shown above with:
Code: Select all
A________| |
Thank you
Rectangles around Table Cells
I hope you could adapt the code to your needs.
Code: Select all
\documentclass{article}\usepackage{tikz}\usetikzlibrary{matrix,calc}%internal group%#1-space between node and grouping line. Default=0%#2-top left node%#3-bottom right node\newcommand{\implicant}[3][0]{\draw[rounded corners=3pt] ($(#2.north west)+(135:#1)$) rectangle ($(#3.south east)+(-45:#1)$);}%group lateral borders%#1-space between node and grouping line. Default=0%#2-top left node%#3-bottom right node\newcommand{\implicantcostats}[3][0]{\draw[rounded corners=3pt] ($(rf.east |- #2.north)+(90:#1)$)-| ($(#2.east)+(0:#1)$) |- ($(rf.east |- #3.south)+(-90:#1)$);\draw[rounded corners=3pt] ($(cf.west |- #2.north)+(90:#1)$) -| ($(#3.west)+(180:#1)$) |- ($(cf.west |- #3.south)+(-90:#1)$);}%group top-bottom borders%#1-space between node and grouping line. Default=0%#2-top left node%#3-bottom right node\newcommand{\implicantdaltbaix}[3][0]{\draw[rounded corners=3pt] ($(cf.south -| #2.west)+(180:#1)$) |- ($(#2.south)+(-90:#1)$) -| ($(cf.south -| #3.east)+(0:#1)$);\draw[rounded corners=3pt] ($(rf.north -| #2.west)+(180:#1)$) |- ($(#3.north)+(90:#1)$) -| ($(rf.north -| #3.east)+(0:#1)$);}%group corners%#1-space between node and grouping line. Default=0\newcommand{\implicantcantons}[1][0]{\draw[rounded corners=3pt] ($(rf.east |- 0.south)+(-90:#1)$) -| ($(0.east |- cf.south)+(0:#1)$);\draw[rounded corners=3pt] ($(rf.east |- 8.north)+(90:#1)$) -| ($(8.east |- rf.north)+(0:#1)$);\draw[rounded corners=3pt] ($(cf.west |- 2.south)+(-90:#1)$) -| ($(2.west |- cf.south)+(180:#1)$);\draw[rounded corners=3pt] ($(cf.west |- 10.north)+(90:#1)$) -| ($(10.west |- rf.north)+(180:#1)$);}%Empty Karnaugh map 4x4\newenvironment{Karnaugh}%
Re: Rectangles around Table Cells
- Attachments
-
- karnaughmapalternative.sty
- For free use.
- (11.78 KiB) Downloaded 523 times