I am trying to write a LaTeX document involving a lot of definitions. For this reason, I decided to create a mdframed environment (see below), and place my definitions one after the other in a two-column environment.

    frametitleaboveskip=5pt, frametitlebelowskip=5pt,

Basically, this gives me a simple titled box, with a gray header, and a white background for the definition itself. However, I noticed that the height of my gray headers varies. This is particularly annoying when the second column receives its first definition:

    \begin{numframed}[frametitle=Text with letters going below line]

    % ... other definitions until the end of the first column

    \begin{numframed}[frametitle=Text without these letters]

mdframed titles with irregular height

As you can see, in the first column, the first definition's title contains letters which go "below the line" : the g's. There is no such letter in the first definition of the second column. In each case, LaTeX naturally fits the container to the content.

Now, having these two boxes, one next to the other, and getting misaligned title headers really annoys me. Would there be a way for me to fix the title header's height (and possibly set vertical alignment to center afterwards) in order to align my header areas completely?

  • Did you try minimum height=1.5em for example? – Sigur Feb 23 '15 at 15:50
  • @Sigur It does not appear to be a valid parameter when defining an environment (titledframe). Wouldn't it apply to the entire box instead of just the title? I've never manipulated TikZ parameters before. – John WH Smith Feb 23 '15 at 15:59
  • 3
    Add a \strut to the title,as in frametitle={\strut The title text\strut}. I'm writing an answer in which this is done automatically. – Gonzalo Medina Feb 23 '15 at 16:05

One option using \strut for the title:


    frametitleaboveskip=5pt, frametitlebelowskip=5pt,


    \begin{numframed}{Text with descenders py}
    \begin{numframed}{Text with no descenders in two lines}
    \begin{numframed}{Text with no descenders}
    \begin{numframed}{Text with descenders in two lines py}


enter image description here

The new syntax for numframed is

\begin{numframed}[<options to mdframed>]{<title>}
  • Works like a charm :) I simplified it a little by removing the options passed to mdframed by numframed, since they will not be necessary in my document. – John WH Smith Feb 23 '15 at 16:22

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.