Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to display a L-Tromino. L-tromino is a shape consisting of three equal squares joined at the edges to form a shape resembling the capital letter L. I have tried

\begin{array}{cc} \square& \\ \square&\square\end{array}

but this contains paddings. How can I use zero padding for a 2x2 table?

share|improve this question
1  
Welcome to TeX.SX! Please provide a full MWE. –  Count Zero Sep 13 '12 at 12:22
    
this appears similar to what's called "young tableaux". the youngtab package (and others) may be helpful, although overkill. –  barbara beeton Dec 17 '12 at 15:14
add comment

3 Answers

up vote 2 down vote accepted
\documentclass{article}
\usepackage{array,amssymb,tikz,graphicx}%  
\begin{document}

Using \verb|tabular|:
  \scalebox{.6}{%
  \begin{tabular}{|c|c}\cline{1-1}
     & \\\hline
     & \multicolumn{1}{c|}{} \\\hline
  \end{tabular}} 
  Compare the size with that of \verb|\square| : $\square$

  Using \verb|TikZ| %% (just for fun as many of us are obsessed with tikz):
  \begin{tikzpicture}[scale=.5]
    \draw[thick] (0,0) -- (1,0) -- (1,.5) -- (0,.5) -- cycle;
    \draw[thick] (0,.5) -- (0,1) -- (.5,1) -- (.5,0);
  \end{tikzpicture}
\end{document}

enter image description here

PS: The size has been reduced using \scalebox from graphicx. In tikz, the option scale is used.

If you are using them frequently, you can define a macro as in

\documentclass{article}
\usepackage{array,amssymb,tikz,graphicx}% 
%
\newcommand{\Ltromino}{%
  \scalebox{.6}{%
  \begin{tabular}{|c|c}\cline{1-1}
     & \\\hline
     & \multicolumn{1}{c|}{} \\\hline
  \end{tabular}}
  }
%
\newcommand{\LTromino}{%
  \begin{tikzpicture}[scale=.5]
    \draw[thick] (0,0) -- (1,0) -- (1,.5) -- (0,.5) -- cycle;
    \draw[thick] (0,.5) -- (0,1) -- (.5,1) -- (.5,0);
  \end{tikzpicture}
  }

\begin{document}
Using \verb|tabular|:

  \Ltromino

Compare the size with that of \verb|\square| : $\square$

Using \verb|TikZ|:

  \LTromino
\end{document}
share|improve this answer
    
How can I decrease the table size so that a cell has a dimension as \square –  user706071 Sep 13 '12 at 12:42
    
@user706071: See the edited answer. –  Harish Kumar Sep 13 '12 at 12:48
add comment
\begin{array}{@{} c @{} c @{}} 
  \square & \\ 
  \square & \square
\end{array}
share|improve this answer
add comment

Of course, the additional spaces of the array/tabular can be minimized to zero:

\documentclass[12pt]{article}
\usepackage{amssymb}
\usepackage{color}

\setlength{\parskip}{1ex}

\begin{document}

$
\renewcommand*{\arraystretch}{0}
\begin{array}{@{}c@{}c@{}}
  \square & \\
  \square & \square
\end{array}
$

\begingroup
  \renewcommand*{\arraystretch}{0}%
  \setlength{\tabcolsep}{0pt}%
  \setlength{\mathsurround}{0pt}%
  \begin{tabular}{cc}
    $\square$ &\\
    $\square$ & $\square$
  \end{tabular}%
\endgroup

\setlength{\fboxsep}{0pt}
\fbox{\textcolor{red}{$\square$}}

\end{document}

Result with array/tabular

But that does not solve your problems:

  • The character box is larger than the character itself. The black \fbox frame is wider than the red \sqare. These white spaces are called left and right side bearings. The values of these are unkown in TeX.

  • The upper line of the left lower box and the lower line of the upper box make a horizontal line with double line width. Also the line width of the glyph is not known in TeX.

Therefore I would do the drawing by graphics. An example for tikz that also allows rounded corners:

\documentclass[12pt]{article}
\usepackage{amssymb}

\usepackage{tikz}

\newdimen\squareunit
\newdimen\squarelinewidth 
\newcommand*{\BaseSquare}[1]{%
  \begingroup
    \settoheight{\squareunit}{$\square$}%
    \setlength{\squarelinewidth}{.055\squareunit}%
    \addtolength{\squareunit}{-\squarelinewidth}%
    \begin{tikzpicture}[
      x=\squareunit,   
      y=\squareunit,
      line width=\squarelinewidth,
      line join=round,
    ]
      \draw[line join=round]#1;%
    \end{tikzpicture}%
  \endgroup
}   
\newcommand*{\Square}{%
  \BaseSquare{(0,0) rectangle (1,1)}%
}

\newcommand*{\Ltromino}{%
  \BaseSquare{%   
    (0,0) -- (2,0) -- (2,1) -- (1,1) -- (1,2) -- (0,2) -- cycle
    (0,1) -- (1,1) -- (1,0)
  }%
}   

\newcommand*{\ltromino}{%
  \BaseSquare{%
    (0,0) -- (1,0) -- (1,3) -- (0,3) -- cycle
    (0,1) -- (1,1)
    (0,2) -- (1,2)
  }%
}

\begin{document}

$\square$\,\Square\,\Ltromino\,\ltromino

\end{document}

Trominos using tikz

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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