I am creating a question sheet using a method (I don't know the exact name, maybe bubble sheet format) as follows:
My question is how to improve the appearance such that the framed letters get proportional size based on the context. If the frame letter must work as an exponent, it must be smaller. If it works as a lower index in integral or sum, it also must be smaller.
Here is my code snippet after "normalization" :-)
\documentclass[dvipsnames,dvips,cmyk]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{bera}
\fboxsep=2pt
\fboxrule=0.8pt
\newcommand{\boxy}[1]{\ensuremath{\,\fbox{\;\,{\color{red}\bf#1}\,\;}\,}}
\newcommand{\ltr}[1]{{\color{red}\bf#1}}
\begin{document}
\noindent%
Each letter \ltr{A}, \ltr{B}, \ltr{C}, etc in the equations represents a numeral (from 0 to 9) or the minus sign ($-$).
\[
\int_{\boxy{A}}^{\boxy{B}}f(x)\,\textrm{d}x=\frac{1-\boxy{P}}{\boxy{Q}+\boxy{R}}
\]
\[
-2 x^{\boxy{XYZ}}-\boxy{W}\sqrt{\boxy{V}+1}
\]
\[
\sum_{i=\boxy{A}}^{\boxy{BC}}=\tan\left(\boxy{D}-\boxy{E}\right)
\]
\end{document}