Custom enumeration with undesired kerning

The following code produces the desired result as shown below:

\documentclass[letterpaper]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb,calc,bbding}
\usepackage{enumitem}

\newlist{objective}{enumerate}{2}
\setlist[objective]{label=\protect\raisebox{-1pt}{\textcolor{blue!15}{\CheckmarkBold}}\hspace{-0.75\checklength}\arabic*}

\newlength{\checklength}
\settowidth{\checklength}{\CheckmarkBold}

\begin{document}
% Desired result.
\begin{objective}
\item First
\item Second
\end{objective}
% Not really a desired result.
{\large
\begin{objective}
\item First
\item Second
\end{objective}}
% Even worse.
{\huge
\begin{objective}
\item First
\item Second
\end{objective}}

\end{document}


If you notice at the first level everything seems fine and ok but as the font size increases, there is the issue of proper kerning. Probably if the enumeration can be fixed or scaled it would help a lot.

-

you don't actually need to know the width of the checkmark. you can simply superimpose the check with \rlap, shifting a bit to the left (relative to the current type size) since the check is a bit wider than a digit. here's a definition of your list item that will accomplish this:

\setlist[objective]{label=\protect\raisebox{-1pt}{\textcolor{blue!15}%
{\rlap{\kern-.3em\CheckmarkBold}}}\arabic*}


you can omit all the code for \checklength with this definition; nothing else needs to change.

Edit: to adjust for 2-digit numbers, it's necessary to check the numeric value of the counter. this is a bit tricky, since \setlist expands its arguments immediately, and this has to be suppressed so that the counter can be tested. (i've defined a test counter with a not very original name, but it should be possible to use one of the temporary counters already available in latex; i didn't take the time to investigate, since solving the expansion problem was the important thing.) replacing the above code by the following will work for two digits; adapting this for more than two digits is left as an exercise for the reader -- the principle should be clear.

\makeatletter
\newcount\xxtempcnt
\setlist[objective]{label=\protect\raisebox{-1pt}{\textcolor{blue!15}%
{\xxtempcnt=\@nameuse{c@\@listctr}%
\rlap{\noexpand\ifnum\xxtempcnt < 10 \kern-.3em
\noexpand\fi
\CheckmarkBold}}}\arabic*}
\makeatother


the result:

-
Very clever indeed. I forgot all about \rlap. –  azetina Dec 4 '12 at 17:12
Works fine up to 9 but as we enter 2 digit numbers, the display is inappropriate. –  azetina Dec 4 '12 at 19:10
@azetina -- 2-digit support added; support for more digits left as an exercise for the user, but it should be clear how to do it. –  barbara beeton Dec 4 '12 at 21:56
Understood! :-) But where did you get \@nameuse{c@\@listctr} from? –  azetina Dec 4 '12 at 22:56
@azetina -- i stole \@nameuse{c@\@listctr} out of enumitem.sty. it took some hunting to figure out the name of the counter, so i just copied it when i found it. (one always learns something from digging into the source code.) –  barbara beeton Dec 4 '12 at 23:17

You are setting \checklength at a fixed font size. Instead it should be done before use with the current font size:

\documentclass[letterpaper]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb,calc,bbding}
\usepackage{enumitem}

\newlist{objective}{enumerate}{2}
\setlist[objective]{label=%
\protect\raisebox{-1pt}{\textcolor{blue!15}{\CheckmarkBold}}%
\SetCheckLength
\hspace{-0.75\checklength}\arabic*}

\newlength{\checklength}
\settowidth{\checklength}{\CheckmarkBold}
\DeclareRobustCommand*{\SetCheckLength}{%
\settowidth{\checklength}{\CheckmarkBold}%
}

\begin{document}
% Desired result.
\begin{objective}
\item First
\item Second
\end{objective}
% Not really a desired result.
{\large
\begin{objective}
\item First
\item Second
\end{objective}}
% Even worse.
{\huge
\begin{objective}
\item First
\item Second
\end{objective}}

\end{document}


Different variant for support of more digits

The following example sets the check mark in the background behind the number without occupying additional space:

\documentclass[letterpaper]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb,calc,bbding}
\usepackage{enumitem}

\newlist{objective}{enumerate}{2}
\setlist[objective]{label=%
%  \protect\raisebox{-1pt}{\textcolor{blue!15}{\CheckmarkBold}}%
\protect\CheckNum{\arabic*}%
}
\newcommand*{\CheckNum}[1]{%
\begingroup
\leavevmode
\sbox0{#1}%
\hbox to \wd0{%
\hss
\raisebox{-1pt}[0pt][0pt]{\textcolor{blue!15}{\CheckmarkBold}}%
\hss
}%
\llap{\box0}%
\endgroup
}

\begin{document}

% Desired result.
\begin{objective}
\item First
\item Second
\item Tenth
\item Hundredth
\end{objective}
% Not really a desired result.
{\large
\begin{objective}
\item First
\item Second
\item Tenth
\item Hundredth
\end{objective}}
% Even worse.
{\huge
\begin{objective}
\item First
\item Second