0

To get table as shown in picture, I used following tex code but resultant table is not as shown in picture, what corrections are required in tex code to get similar result.

1) Table Image (Picture):enter image description here

2) Tex file:

    \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{collectbox}

\makeatletter
\newcommand{\sqbox}{%
    \collectbox{%
        \@tempdima=\dimexpr\width-\totalheight\relax
        \ifdim\@tempdima<\z@
            \fbox{\hbox{\hspace{-.5\@tempdima}\BOXCONTENT\hspace{-.5\@tempdima}}}%
        \else
            \ht\collectedbox=\dimexpr\ht\collectedbox+.5\@tempdima\relax
            \dp\collectedbox=\dimexpr\dp\collectedbox+.5\@tempdima\relax
            \fbox{\BOXCONTENT}%
        \fi
    }%
}
\makeatother
\title{try}


\begin{document}

\begin{center}
  \begin{tabular}{ |l | c | r | }
    \hline
   \sqbox{1}& \sqbox{2} & \sqbox{3} \\ \hline
    4 & 5 & 6 \\ \hline
    7 & 8 & 9 \\
    \hline
  \end{tabular}
\end{center}


\end{document}

3) Tex output:

enter image description here

4
  • 3
    Welcome! Please show what you've tried Mar 17 '16 at 11:40
  • en.wikibooks.org/wiki/LaTeX/Tables
    – Sverre
    Mar 17 '16 at 12:13
  • Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. Mar 17 '16 at 12:20
  • 1
    Please don't downvote below a score of -1, even if the question in its current form needs some improvement. A score of -1 is enough to show that the question needs work, anything below that is of no use. Also, if you downvote or vote to close, please leave a comment explaining why you did so, but wait at least 24 hours after asking the OP for improvements to the question before voting to close. Mar 17 '16 at 12:20
4

The package hhline and array are your friends:

enter image description here

\documentclass[border=3mm,
               preview]{standalone}
\usepackage{array,hhline}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}
\begin{tabular}{||C{12mm}||C{12mm}||c||}
\hhline{|t:=:t:=:t:=:t|}
multiple lines  &   b               &   c   \\
\hhline{|:=::=::=:|}
d               &   multiple lines  &   f   \\
\hhline{|:=::=::=:|}
g               &   h               &   i   \\
\hhline{|b:=:b:=:b:=:b|}
\end{tabular}
    \end{document}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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