A note with the dangerous bend symbol: how to vertically center text and symbol?

Surprisingly enough, nobody has remarked yet that the manfnt package does provide a version of the \dbend command with the “ground” lifted to the level of the baseline, namely \textdbend. It suffices therefore to use this command instead of \dbend:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc} % not necessary here, but I prefer to use it
\usepackage{manfnt}
\usepackage{array}

\newcommand{\dnote}[1]{%
    \noindent % I guess this is intended...
    \begin{tabular}{@{}m{0.13\textwidth}@{}m{0.87\textwidth}@{}}%
        \huge\textdbend &#1%
    \end{tabular}%
    \par % ... and this too.
}



\begin{document}

\dnote{One-line note.}

\bigskip

\dnote{How much quacks would a TeXduck chuck if a TeXduck could chuck quacks?
Would a TeXduck chuck quacks if quacks could chuck TeXducks?}

\bigskip

\dnote{A longer note.  How much quacks would a TeXduck chuck if a TeXduck could
chuck quacks?  Would a TeXduck chuck quacks if quacks could chuck TeXducks?  How
much quacks would a TeXduck chuck if a TeXduck could chuck quacks?  Would a
TeXduck chuck quacks if quacks could chuck TeXducks?}

\bigskip

\dnote{And an even longer one; more precisely, one line longer than the previous
one.  How much quacks would a TeXduck chuck if a TeXduck could chuck quacks?
Would a TeXduck chuck quacks if quacks could chuck TeXducks?  How much quacks
would a TeXduck chuck if a TeXduck could chuck quacks?  Would a TeXduck chuck
quacks if quacks could chuck TeXducks?}

\end{document}

You can check that the output is quite satisfactory:

Output of the code

Allow me a brief digression here. It is well-known that the TeX source of The TeXbook is publicly available for educational purposes (only). Now, it may be interesting to remark that The TeXbook shows an evident example of “vertically centered” dangerous bend sign in the display on page vi (the sign of the display on page v is also vertically centered, but this may seem less evident); if you take a look to the TeX source to see how this is achived, you can guess that the segment that represents the “ground” on which the signal is stuck runs 11 points below the baseline, a fact that can be easily confirmed with a little experiment. This holds true for a font size of 10 points, that is, manfnt’s design size. At this size, the height of the \dbendcharacter is 7.5pt (you can measure it directly in TeX, or you can look it up in the TFM file, after converting it to a “Property List” file by giving the command

tftopl manfnt.tfm manfnt.pl

at your shell prompt). So, we see that the exact amount by which the character should be lifted is 11/7.5 = 22/15 of its height: this is exactly what the manfnt package does. Note that 22/15 = 1.466666666…, very close to @egreg’s guess of 1.475, but less close to Massimo’s, who proposed 1.2\height.


The \dbend glyph has no depth, but it extends far below the baseline nonetheless. Look at the first line in the example below, with the correction with \raisebox.

\documentclass{article}
\usepackage{manfnt}
\usepackage{array}

\newcommand{\dnote}[1]{%
  \begin{tabular}{@{}m{0.13\textwidth}@{}m{0.87\textwidth}@{}}
  \raisebox{1.475\height}{\huge\dbend} & #1
  \end{tabular}%
}

\begin{document}

\fboxsep=0pt \fboxrule=0.1pt
X\fbox{\dbend}X\fbox{\raisebox{1.475\height}{\dbend}}X%

\bigskip\bigskip

\noindent
\dnote{How much quacks would a \TeX duck chuck if a \TeX duck could
chuck quacks? Would a \TeX duck chuck quacks if quacks could chuck \TeX ducks?}
\end{document}

enter image description here

Not vertically centered? Well, this is an inherent limitation of how the m column type is implemented.

Tags:

Tables