# Is there a “proper” way to fix alignment of text in a \framebox?

The \framebox command aligns its contents vertically centered, but this has a tendency to produce results that are extremely visually displeasing. Case in point:

\documentclass{article}
\usepackage{relsize}
% Double box just to make things clearer
\newcommand{\DoubleBox}[1]{\framebox{\framebox{\textbf{#1}}}}
\begin{document} \noindent
\DoubleBox{I think this is visually displeasing} \par\noindent
\DoubleBox{\raisebox{0pt}[9pt]{I think this is an ugly hack}} \par\noindent
\DoubleBox{\larger\raisebox{0pt}[9pt]{And said hack doesn't work for larger text}}
\end{document}


Is there a way to fix this that "just works" so things look right at all sizes?

-
What do you mean by "visually displeasing"? Of course a boldface doubly framed text is visually displeasing :), but maybe you mean something else. Did you try \strut in the argument of \DoubleBox? – egreg Sep 12 '11 at 15:12
I meant the vertical alignment of the text. It looks to me like the text is placed "too high" in the box. – kahen Sep 12 '11 at 15:13

There are two ways of solving the problem (assuming it is a problem to begin with).

The first one is to "normalize" the height and depth via \strut:

\newcommand{\DoubleBox}[1]{\framebox{\framebox{\bfseries\strut#1}}}


Alternatively, you might ignore the depth:

\usepackage{amsmath} % for optional argument to \smash
\newcommand{\DoubleBox}[1]{\framebox{\framebox{\smash[b]{\bfseries#1}}}}

-