47

Is there a way to create a box with a check mark in the center of it and the check mark coming out of the box?

For example: $\boxdot$ or $\boxtimes$, but instead have a check mark placed at the center extending outside the box.

P.S. How can I get things to work in math mode on this site. For example, the above sample code does not display the pictures.

3
  • 6
    There is no math mode functionality on this site. We need to display math-code as code much more often then displaying the graphical representation of it. You will need to add it them as images by yourself if you really want them. Commented Apr 17, 2011 at 12:14
  • @Martin: given the frequency that this comes up, may be a line in the FAQ or the How To Ask section about MathJax not supported here would be nice. Commented Apr 17, 2011 at 13:06
  • 1
    @Willie: Good idea. meta.tex.stackexchange.com/q/1272/86 Commented Apr 17, 2011 at 18:11

6 Answers 6

42

One can choose between the following two solutions; the first one centers the two symbols with respect to one another, the second one draws the square and then displaces the check mark.

\documentclass{article}
\usepackage{amssymb}
\begin{document}

\mbox{\ooalign{$\checkmark$\cr\hidewidth$\square$\hidewidth\cr}}

\makebox[0pt][l]{$\square$}\raisebox{.15ex}{\hspace{0.1em}$\checkmark$}

\end{document}

By acting on the two dimensions, one can find by trial and error the best relative positioning of the check mark with respect to the box.

This gives (with magnification x16 and displayed horizontally):

enter image description here

5
  • Nice. Would you mind putting the other headers it needs to properly display as an output, such as Martin did above. Thanks
    – night owl
    Commented Apr 17, 2011 at 12:52
  • Both attempts were very close, but how could I use what you gave and tweak around with the positioning of the check mark to make it precisely in the middle of the check box with it touching the side or base of the box. Only the extending arm of the check mark is going through the upper right corner of the box and no other part of the check mark is touching the box.
    – night owl
    Commented Apr 17, 2011 at 13:05
  • Could you please define a command for this? (e.g. \checkedBox , \uncheckedBox)? Commented Feb 29, 2016 at 17:40
  • Is there a way to automatically scale this box when it is inside of a table to the full table cell size? Commented Feb 29, 2016 at 17:41
  • @MartinThoma \newcommand{\checkedBox}{\mbox{\ooalign{$\checkmark$\cr\hidewidth$\square$\hidewidth\cr}}} I'm not sure what you mean by “automatically scale”
    – egreg
    Commented Feb 29, 2016 at 17:45
41

You could overlay two symbols using \rlap as shown below. The use of \text should ensure that the checkmark is scaled in subscripts, which might not be really necessary for such a symbol. See also Overlay symbol with another to learn how to center one symbol on another one.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}

$\text{\rlap{$\checkmark$}}\square$

\end{document}

Result

If this is not what you want you still could draw the symbol by yourself e.g. using tikz. See the answers of Square with a diamond in it for this.

8
  • Awesome +1.., this is primarily what I was looking for. But just slightly wanted the checkmark to be in the center of the box. I can check out the link on 'tikz' on doing this.
    – night owl
    Commented Apr 17, 2011 at 12:37
  • 1
    \rlap is good, but sometimes it may surprise LaTeX users; \makebox[0pt][l]{$\checkmark$}$\square$ perhaps uses more resources, but it's safe in all contexts. In your code \text is superfluous, actually. A robust solution should take into account \mathsurround, too: \mbox{\mathsurround=0pt \makebox[0pt][l]{$\checkmark$}$\square$}.
    – egreg
    Commented Apr 17, 2011 at 12:39
  • @egrep: Yes, in the shown example the \text is not necessary, but -- as mentioned -- would scale the checkmark if used in a subscript. It all depends on the exact usage. Ok, a symbol like this is hardly used inside an equation. Commented Apr 17, 2011 at 12:49
  • 2
    Based on your typo of egreg, I s'pose you are a *nix user? :-D Commented Apr 17, 2011 at 13:08
  • 2
    Confirming that this is working with XeLaTeX and the fontspec package. Also, I personally like the aesthetic of making the checkmark slightly larger than the box: $\text{\rlap{\large$\checkmark$}}\square$ -- added the \large macro inside the \rlap macro.
    – user59034
    Commented Jun 15, 2015 at 22:10
28

If you just want to get the checkmark in a box and don't specifically need to create it yourself, there are two symbols listed in The Comprehensive LaTeX Symbol List that you could use:

\documentclass{article}

\usepackage{wasysym}
\usepackage{marvosym}

\begin{document}
\CheckedBox% from wasysym
\Checkedbox% from marvosym
\end{document}

checkbox pics


EDIT: Also, there's the Unicode character 9745 "Ballot Box With Check" ☑ that you can insert directly using XeLaTeX. If you choose the right font, the checkmark will be inside the box entirely. I just used two fonts that I found on my Win7 machine.

%to be compiled with XeLaTeX!
\documentclass{article}

\usepackage{fontspec}

\begin{document}
\setmainfont{Arial Unicode MS}Arial Unicode MS: ☑

\setmainfont{DejaVu Sans}DejaVu Sans: ☑
\end{document}

XeLaTeX checkbox pic

2
  • @donherry: Thanks for this insight. I used the marosym package before but did not no it contained this command. This is much simpler than creating a \newcommand. :) P.S. Is there a command or way to position the check-mark in the center of the box?
    – night owl
    Commented Jun 23, 2011 at 11:28
  • @night owl: I don't think there is an (easy) way to modify the packages' characters. I added a solution using XeLaTeX. If you want to put the checkbox within a document using a different font, you could again create a \newcommand with the \setmainfont and the checkbox in it.
    – doncherry
    Commented Jun 23, 2011 at 11:55
6

You can also try bbding package. It has a set of checks and crosses (for example \XSolidBrush and \Checkmark).

5

I find it easiest just to type $\boxed{\checkmark}$. It's much simpler, however it doesn't come out as well.

1
  • But OP wants the checkmarks extending outside the box... Probably you need to add some \smash or something.
    – Symbol 1
    Commented Feb 4, 2015 at 5:28
3
\documentclass[12pt]{article}

   \usepackage{amsmath}

   \usepackage{amssymb}

\begin{document}

$\checkmark\hspace{-.38cm}\Box$

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .