4

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?

enter image description here

7
  • 1
    I probably wouldn't do this a a table, but rather make it as a tikz graphics, much easier to control. Commented Aug 28, 2018 at 10:30
  • 1
    By ‘removing the border’, you mean obtaining a table similar to the table in the image? Commented Aug 28, 2018 at 10:41
  • Please, can you add your minimal working example? Commented Aug 28, 2018 at 11:57
  • 1
    @Sebastiano I have not done anything in Tex. This table is done in MS Word. Commented 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. Commented Aug 28, 2018 at 13:28

2 Answers 2

4

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} 

LaTeX

3

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} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.