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

% Double box just to make things clearer  
\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}}  

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:


Alternatively, you might ignore the depth:

\usepackage{amsmath} % for optional argument to `\smash`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.