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 should explain beforehand, that I use XeLaTeX, so I have access to all kinds of fonts, and Unicode support.

Now, I'm using the "BALLOT BOX" (U+2610) and "BALLOT BOX WITH CHECK" (U+2611) quite often for attendance protocols.

Now, I'd like to add another character in the likes of that, but with a little "e" or "E" inside the ballot box. This is what I plan to use for "excused". I'd much rather mix the "BALLOT BOX" character with a smaller "E", rather than constructing a new shape as SVG or something, so it'll be no problem when changing to a different font.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Well, maybe you may just use a \fbox, and you can change the spacing and font size:

\documentclass{article}

\usepackage{relsize}

\begin{document}

A\raisebox{0.1em}{\smaller\fboxsep0.1em\fbox{E}}B

\end{document}

You don't need a Unicode font for this.


And of course, you can mix the two symbols:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial Unicode MS}
\usepackage{relsize}
\begin{document}

A\ooalign{\symbol{"2610}\cr\hfil\smaller[2]\raisebox{0.1em}{E}\hfil\cr}B\symbol{"2611}

\end{document}

enter image description here

share|improve this answer
    
Thank! I've used your second solution like that: \newcommand{\e}{ {\dejavusans \hspace{-.6em} \ooalign{☐\cr \tiny \hfil \hspace{0.01em} \raisebox{0.3em}{E} \hfil \cr}} } –  polemon Oct 27 '12 at 13:09

The following example defines \ballot that takes an argument that is put into the empty ballot box both horizontally and vertically centered. If necessary the contents is scaled down to fit the ballot box.

\documentclass[12pt]{article}
\usepackage{graphics}
\usepackage{fontspec}

\newdimen\BallotDimen
\newsavebox\BallotBoxEmpty
\newsavebox\BallotBoxChar
\newcommand*{\ballot}[1]{%
  \begingroup
    \setlength{\fboxrule}{0pt}%
    \sbox\BallotBoxEmpty{^^^^2610}%
    \setlength{\fboxsep}{.175\wd\BallotBoxEmpty}%
    \BallotDimen=\dimexpr\wd\BallotBoxEmpty-2\fboxsep\relax
    \sbox\BallotBoxChar{#1}%
    \ifdim\wd\BallotBoxChar>\BallotDimen
      \sbox\BallotBoxChar{\resizebox{\BallotDimen}{!}{\usebox\BallotBoxChar}}%
    \fi
    \ifdim\dp\BallotBoxChar>0pt %
      \sbox\BallotBoxChar{\raisebox{\dp\BallotBoxChar}{\usebox\BallotBoxChar}}%
    \fi
    \ifdim\ht\BallotBoxChar>\BallotDimen
      \sbox\BallotBoxChar{\resizebox{!}{\BallotDimen}{\usebox\BallotBoxChar}}%
    \fi
    \ooalign{%
      \usebox\BallotBoxEmpty\cr
      \hfil
      \raisebox{.5\dimexpr\ht\BallotBoxEmpty-\ht\BallotBoxChar}%
               {\usebox\BallotBoxChar}%
      \hfil
    }%
  \endgroup
}

\begin{document}
\fontspec{FreeSerif.otf}
^^^^2610^^^^2611^^^^2612\ballot{E}\ballot{e}\ballot{g}

\end{document}

Result

share|improve this answer

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.