# How to type “田” with filled upper left and lower right sub-squares?

How to type “田” with filled upper left sub-square and lower right sub-square as a character in LaTeX?

-
You should check out the latex symbols documentation from page 118 onwards. There are a lot of symbols similar (the one you provided is called \boxplus) but I didn't see one filled how you said. tug.ctan.org/pub/tex-archive/info/symbols/comprehensive/… –  Supernovah Nov 14 '11 at 2:46
Try using the picture environment, with the \put and \rule commands, perhaps. –  Bruno Le Floch Nov 14 '11 at 4:50
Note that 田 is a CJK character, not a picture (it means "rice paddy" in Japanese). In many fonts it is more trapezoidal than square. It is not recommended to use CJK characters for drawing pictures, unless you're on a BBS. –  Dietrich Epp Nov 14 '11 at 13:11

Without using any graphic packages (like tikz or pstricks), you can typeset a checkered box \cbox using \rule and \fbox. Rules take the following arguments:

\rule[<raise>]{<width>}{<height>}


while \fbox has a rule width of \fboxrule and separation of \fboxsep. As such, the following minimal example provides \cbox with a NW/SE checkered box and \cbox* with a NE/SW checkered box. The current box width/height has a default of 1ex, although this can be modified by means of an optional <width> argument \cbox[*][<width>]. xparse provides the starred interface, although it could be done without.

\documentclass{article}%
\usepackage{xspace}% http://ctan.org/pkg/xspace
\usepackage{xparse}% http://ctan.org/pkg/xparse
\NewDocumentCommand{\cbox}{s O{1ex}}{%
\setlength{\fboxsep}{-\fboxrule}%
\IfBooleanTF{#1}% Condition on starred/unstarred
{\frame{\rule{0.5\dimexpr#2}{0.5\dimexpr#2}\rule[0.5\dimexpr#2]{0.5\dimexpr#2}{0.5\dimexpr#2}}}% \mybox*
{\fbox{\rule[0.5\dimexpr#2]{0.5\dimexpr#2}{0.5\dimexpr#2}\rule{0.5\dimexpr#2}{0.5\dimexpr#2}}}% \mybox
\xspace% Possible space
}
\begin{document}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{lc}
\verb!\cbox!: & \cbox \\
\verb!\cbox*!: & \cbox* \\
\verb!\cbox[20pt]!: & \cbox[20pt] \\
\verb!\cbox*[1.5em]!: & \cbox*[1.5em]
\end{tabular}
\end{document}


Using \setlength{\fboxsep}{-\fboxrule} removes any separation between the box contents the the surrounding/boxed rule. xspace corrects for any missed spacing correction after the control sequence.

-
You may use \frame instead of \fbox to avoid extra width and height by \fboxsep and \fboxrule. –  Schweinebacke Nov 14 '11 at 6:41
Thanks, but with \frame only the lower rule is below the baseline. –  Werner Nov 14 '11 at 7:29

You might like my package ytableau, which does this easily by design:

\documentclass{article}
\usepackage{ytableau}
\begin{document}
\begin{ytableau}
*(black) & \\
& *(black)
\end{ytableau}
\medskip

\ytableaushort{ {*(black)} {} , {} {*(black)} }
\medskip

\ydiagram[*(black)]{1,1+1} * {2,2}
\medskip

\ytableausetup{boxsize = 6pt}
\ydiagram[*(black)]{1,1+1} * {2,2}
\end{document}


It's supposed to produce Young tableaux in mathematics, but there's no reason not to use it for general box-piling. The syntax for this is very simple.

• You can use the environment form, which is just like any array-like environment, but also takes color specifications set off by a * and with the color in parentheses (anything accepted by xcolor is good).

• There's also a short form, where the rows are lists of cells (possibly enclosed in braces if they are not just single characters) with the same color specification syntax.

• There's also the Young diagram form, which doesn't allow anything in the boxes, but takes an optional argument that is put in every box, which can of course be a color specification. You can give it offsets in each row: 1+1 means "skip one space, then put one box". That's what you wanted for the black box in the second row.

• There's also the "chaining" operation: either the short form or the Young diagram can be followed by a * and then another argument list, which can only be for a Young diagram, possibly with an optional argument. The first diagram (either tableau or diagram) is then piled on top of the successive diagrams with the leftmost ones being on the upper layers. This way, you can construct complex color patterns.

• It also has a \ytableausetup command that changes a few things, in this case, the box size. You'll have to read the manual for the full story there.

The package is on CTAN, and therefore, also in TeX Live and (I think) MikTeX.

-
Thanks! Guys, Could you tell me how to install "ytableau" package? I checked the ctan.org/pkg/ytableau. There is no specific "Download" button. –  user9304 Nov 14 '11 at 16:11
@Dan I converted your answer into a comment since it's not a real answer. Your question won't be seen by many people here so it would be best to repost it as a fresh question. Follow-up questions like this are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background. However, please have a look at the existing questions about installing packages. –  Stefan Kottwitz Nov 14 '11 at 16:53
@Dan: First of all, did you check your package manager? Anything that's been on CTAN for a while should be in there. If you must install by hand: packages on CTAN are usually distributed as a .dtx and a .ins file, from which you can get the actual package and the documentation. To get the package, run latex on ytableau.ins; to get the manual, run pdflatex on ytableau.dtx. Put them in <personal texmf tree>/tex/latex/ytableau. –  Ryan Reich Nov 14 '11 at 16:55
@Dan: Also, see tex.ac.uk/cgi-bin/texfaq2html?label=installthings; this is a very Frequently Asked Question. –  Ryan Reich Nov 14 '11 at 16:57

I don't see that symbol listed anywhere but since you are in a hurry you could consider drawing it with tikz:

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[thick] (0,0)--(0,.5)--(.5,.5)--(.5,0)--cycle;
\filldraw (0,.5)--(.25,.5)--(.25,.25)--(0,.25);
\filldraw (.25,.25)--(.5,.25)--(.5,0)--(.25,0);
\end{tikzpicture}
and then some more text.
\end{document}


By varying the coordinates, you can make the symbol as big or small as you want.

-
You could use ex or em units for specifying the size, which will make the symbol scale with the surrounding text. Also, you could simplify your code by using \draw <corner> rectangle <opposite corner>;. I would suggest rewriting your code as something like \draw[thick] (0,0) rectangle (1.5ex,1.5ex); \fill (0,1.5ex) rectangle (0.75ex,0.75ex); \fill (0.75ex,0.75ex) rectangle (1.5ex,0pt); –  Jake Nov 14 '11 at 3:51
Sounds like a good idea. I still haven't gotten far in the tikz manual. –  DJP Nov 14 '11 at 3:58
Thanks! I will try it first. –  Dan Liu Nov 14 '11 at 4:00