# Color box issue

Here is my MWE (minimal working example):

\documentclass[]{article}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}

\begin{document}
\begin{center}
{\setlength{\fboxsep}{2.5pt}\colorbox{Orange}{ 9}}

{\setlength{\fboxsep}{2.5pt}\colorbox{Orange}{ 10}}
\end{center}
\end{document}


## Question

How can I make the orange box around 10 as wide as the one around 9 so they line up?

-

Instead of making the box containing 10 narrow, I would make box containing 9 broader.

\documentclass[]{article}
\usepackage{fancyhdr,amsmath}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\usepackage{calc}   %% provides \widthof macro

\begin{document}
\begin{center}
{\setlength{\fboxsep}{2.5pt}\colorbox{Orange}{\makebox[\widthof{10}][c]{9}}}

{\setlength{\fboxsep}{2.5pt}\colorbox{Orange}{10}}
\end{center}

\begin{center}
{\setlength{\fboxsep}{2.5pt}\colorbox{Orange}{9}}

{\setlength{\fboxsep}{2.5pt}\colorbox{Orange}{\makebox[\widthof{9}][c]{10}}}
\end{center}

\end{document}


-
Worked perfectly, thank you –  Jane Jan 15 '14 at 1:40