3

How to create a symbol like the one used in the TeXbook for designating material that is for wizards only, circled in red in the image below, only with an arbitrary English alphabet letter instead of the zigzag (I'd like to be able to determine ad-hoc which letter will be displayed)? And how to insert this symbol at the beginning of paragraphs of my choosing, in a similar fashion as done in the TeX book?

The Wizards Only symbol used in the TeX book

3
7

Nowadays you would make something like that in TikZ. I don't use it on a regular basis so there will surely be better ways, but here is an idea:

\documentclass{article}

\usepackage{tikz}

\newcommand{\mydangersymbol}[1]{%
      \begin{tikzpicture}[baseline=(x.base)]
         \draw[rounded corners=.01em] (-.05em,-1.3em)rectangle(.05em,.9em);
         \draw[fill=white,rounded corners=1] (0,.8em)--(.8em,0)--(0,-.8em)--(-.8em,0)--cycle;
         \draw[very thick,line cap=round](-.3em,-1.3em)--(.3em,-1.3em);
         \node(x) at (0,0em) {\normalfont\sffamily\small#1};
      \end{tikzpicture}%
}

\newenvironment{mydanger}[1]{%
  \par\medskip\noindent
  \sbox0{\mydangersymbol{#1}\space}%
  \hangindent\wd0
  \parindent\hangindent
  \hangafter=-2
  \smash{\llap{\box0}}%
  \small
  \ignorespaces
 }{\par\smallskip}

\begin{document}

The symbol \mydangersymbol{A} is used to indicate an anecdote,
whereas the symbol \mydangersymbol{C} is used to indicate a caveat.
Note that using these symbols inline will cause horrible spacing.
\begin{mydanger}{A}
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
\end{mydanger}
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
\begin{mydanger}{C}
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.
Lorem ipsum dolor sit text to fill the line.

And a new paragraph within this \texttt{mydanger}
environment to show what happens when you have
more than one paragraph.
\end{mydanger}

\end{document}

enter image description here

7
  • Could it be possible that the content of mydanger remains always at the right of the "sign"?
    – projetmbc
    Jul 7 at 11:48
  • 1
    Very nice answer. :-)
    – Sebastiano
    Jul 7 at 11:56
  • 1
    @projetmbc Thanks for the edit (copy/paste slip). As far as your question goes, the probably easiest way would be to use a list and put the box with the symbol in the optional argument to \item.
    – campa
    Jul 7 at 11:59
  • Thanks! But what if I want to use the symbol inline, for instance in order to explain what the symbol is, as in: the symbol \mydanger{A} is used to indicate an anecdote, whereas the symbol \mydanger{C} is used to indicate a caveat?
    – Evan Aad
    Jul 7 at 12:12
  • 1
    @EvanAad See edit. However, given the fact that the symbol spans roughly two lines of text, using it inline doesn't look pretty...
    – campa
    Jul 7 at 13:35
-1

See page 44 in the texbook:

enter image description here

See also e.g. here: Is there a simple way to get the Bourbaki dangerous bend symbol (without extra)? or here: https://en.wikipedia.org/wiki/Bourbaki_dangerous_bend_symbol .

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.