I was preparing a question paper where I have to insert the following question. How to print the table? My main point of the query is how to remove the borders from the boundary cells?
- 1I probably wouldn't do this a a table, but rather make it as a tikz graphics, much easier to control.daleif– daleif2018-08-28 10:30:50 +00:00Commented Aug 28, 2018 at 10:30
- 1By ‘removing the border’, you mean obtaining a table similar to the table in the image?Bernard– Bernard2018-08-28 10:41:43 +00:00Commented Aug 28, 2018 at 10:41
- Please, can you add your minimal working example?Sebastiano– Sebastiano2018-08-28 11:57:00 +00:00Commented Aug 28, 2018 at 11:57
- 1@Sebastiano I have not done anything in Tex. This table is done in MS Word.Subhajit Paul– Subhajit Paul2018-08-28 12:46:16 +00:00Commented Aug 28, 2018 at 12:46
- 1@SubhajitPaul sorry, then it is a do it for me question, which I do not have time for.daleif– daleif2018-08-28 13:28:02 +00:00Commented Aug 28, 2018 at 13:28
| Show 2 more comments
2 Answers
Here is an approach using \multicolumn and \cline to add lines in a table without vertical rules (\begin{tabular}{llll}).
\documentclass{article} \begin{document} \begin{tabular}{llll} & $D_{1}$ & $D_{2}$ & $a_{i}$ \\ \cline{2-3} $O_{2}$ & \multicolumn{1}{|l|}{12} & \multicolumn{1}{l|}{13} & 14 \\ \cline{2-3} $O_{3}$ & \multicolumn{1}{|l|}{15} & \multicolumn{1}{l|}{16} & 17 \\ \cline{2-3} $b_{j}$ & 21 & 22 & \\ \end{tabular} \end{document} Even easier is maybe starting with a table with vertical rules (\begin{tabular}{l|l|l|l}) and removing the borders only for the cells on the edges. The result is the same:
\documentclass{article} \begin{document} \begin{tabular}{l|l|l|l} \multicolumn{1}{l}{} & \multicolumn{1}{l}{$D_{1}$} & \multicolumn{1}{l}{$D_{2}$} & $a_{i}$ \\ \cline{2-3} $O_{2}$ & 12 & 13 & 14 \\ \cline{2-3} $O_{3}$ & 15 & 16 & 17 \\ \cline{2-3} \multicolumn{1}{l}{$b_{j}$} & \multicolumn{1}{l}{21} & \multicolumn{1}{l}{22} & \\ \end{tabular} \end{document} This is very simple with the blkarray package:
\documentclass{article} \usepackage{blkarray} \begin{document} \[ \setlength{\BAextrarowheight}{2pt} \begin{blockarray}{*{6}{c}}% & D₁ & D₂ & D₃ & D₄ & a_i \\ \BAhhline{~|---|-~} \begin{block}{c|*{4}{c|}c} O₁ & 23 & 27 & 16 & 18 & 30 \\ \BAhhline{~|----|~} O₂ & 12 & 17 & 20 & 51 & 40 \\ \BAhhline{~|----|~} O₃ & 22 & 28 & 12 & 32 & 53 \\ \end{block*} \BAhhline{~|----|~} b_j & 22 & 35 & 25 & 41 \end{blockarray} \] \end{document} 

