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 tried to create a checkbox, analogous to Creating Boxed Check Mark

This woks correctly:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
\makebox[0pt][l]{$\square$}\raisebox{.15ex}{\hspace{0.1em}$\checkmark$}
\end{document}

enter image description here

But when I tried to use a cross symbol instead of checkmark, it is shifted to the bottom:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
\makebox[0pt][l]{$\square$}{$\times$}
\end{document}

enter image description here

  1. How to vertically center the cross symbol?
  2. How to change the size of the box and internal symbol, making them bigger / smaller?
share|improve this question
    
You might find it nice to have a pair of matching symbols for the check and the cross, see: tex.stackexchange.com/questions/42619/x-mark-to-match-checkmark/… –  Christoph B. May 2 '13 at 13:25
add comment

2 Answers

up vote 5 down vote accepted

Why not use the already available \boxtimes?

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

$\boxtimes$

\end{document}

enter image description here

share|improve this answer
add comment

Here is another possibility:

\documentclass{article}
\usepackage{amssymb,tikz,pdftexcmds,xparse}

\tikzset{box/.style={
    minimum size=0.225cm,
    inner sep=0pt,
    draw,
  },  
  insert mark/.style={
    append after command={%
         node[inner sep=0pt,#1]
           at (\tikzlastnode.center){$\checkmark$}
     }     
  },
  insert bad mark/.style={
    append after command={%
         [shorten <=\pgflinewidth,shorten >=\pgflinewidth]
         (\tikzlastnode.north west)edge[#1](\tikzlastnode.south east)
         (\tikzlastnode.south west)edge[#1](\tikzlastnode.north east)
     }     
  },
}

\makeatletter
\NewDocumentCommand{\tikzcheckmark}{O{} m}{%
  \ifnum\pdf@strcmp{#2}{mark}=\z@%
    \tikz[baseline=-0.5ex]\node[box,insert mark={#1},#1]{};%
  \fi%
  \ifnum\pdf@strcmp{#2}{bad mark}=\z@%
    \tikz[baseline=-0.5ex]\node[box,insert bad mark={#1},#1]{};%
  \fi%
  \ifnum\pdf@strcmp{#2}{no mark}=\z@%
    \tikz[baseline=-0.5ex]\node[box,#1]{};%
  \fi%
}
\makeatother

\begin{document}


\tikzcheckmark[scale=0.75]{mark}\quad\tikzcheckmark[scale=0.75]{no mark}\quad\tikzcheckmark[scale=0.75]{bad mark}

\vspace{1cm}

\tikzcheckmark{mark}\quad\tikzcheckmark{no mark}\quad\tikzcheckmark{bad mark}

\vspace{1cm}

\tikzcheckmark[scale=2,red]{mark}\quad\tikzcheckmark[scale=2,red]{no mark}\quad\tikzcheckmark[scale=2,red]{bad mark}

\end{document}

The result:

enter image description here

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.