Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am interested in including a triangle with an exclamation point (unicode #9888: ⚠) in a tex document. I've looked in the usual places (detexify, etc.) and not found this symbol. The document should be compilable with pdflatex and the source should have ASCII encoding. I already have a tikz version that I like reasonably well, given by

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\newcommand{\warningsign}{\tikz[baseline=-.75ex] \node[shape=regular polygon, regular polygon sides=3, inner sep=0pt, draw, thick] {\textbf{!}};}
\begin{document}
\warningsign Warning
\end{document}

so I am also requiring that the answer be an actual character, or at least not done using graphics.

share|improve this question
2  
I usually use {\fontencoding{U}\fontfamily{futs}\selectfont\char 66\relax} for that symbol. –  Nicola Talbot Feb 10 at 17:38
    
@Nicola Talbot: Works like a charm! Please add that as an answer so that I can upvote it (and accept it unless someone comes along with a deeper explanation). –  Charles Staats Feb 10 at 17:53
    
You also have \usepackage{bclogo} and \bcattention. –  Gonzalo Medina Feb 11 at 1:51

5 Answers 5

up vote 15 down vote accepted

The fourier package provides \danger:

\documentclass{article}

\usepackage{fourier}

\begin{document}

\danger

\end{document}

I sometimes find that some of the fourier commands conflict with other packages I use, so if I only want this symbol I do:

\documentclass{article}

\begin{document}

{\fontencoding{U}\fontfamily{futs}\selectfont\char 66\relax}

\end{document}

which is essentially what \danger does.

share|improve this answer

A simple build assigned to the unicode symbol, so you can use or \Warning:

mWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{newunicodechar}

\newcommand\Warning{%
 \makebox[1.4em][c]{%
 \makebox[0pt][c]{\raisebox{.1em}{\small!}}%
 \makebox[0pt][c]{\color{red}\Large$\bigtriangleup$}}}%

\newunicodechar{⚠}{\Warning}

\begin{document}

    Do⚠not⚠put your finger

    on the power plug.

\end{document}
share|improve this answer

Here, I choose to build my own by overlaying a black, tiny ! atop a red $\triangle$, and then scaling the result to a desired [optional] size

\documentclass{article}
\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{xcolor}
\newcommand\dangersign[1][2ex]{%
  \renewcommand\stacktype{L}%
  \scaleto{\stackon[1.3pt]{\color{red}$\triangle$}{\tiny !}}{#1}%
}
\begin{document}
This is a danger sign 5ex tall: \dangersign[5ex]\par
Here is the default (2ex) size: \dangersign
\end{document}

Zoom of result, to clarify my response to Charles' comment.

enter image description here

If one prefers a bolder !, just make it \bfseries:

\documentclass{article}
\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{xcolor}
\newcommand\dangersign[1][2ex]{%
  \renewcommand\stacktype{L}%
  \scaleto{\stackon[1.3pt]{\color{red}$\triangle$}{\tiny\bfseries !}}{#1}%
}
\begin{document}
This is a danger sign 5ex tall: \dangersign[5ex]\par
Here is the default (2ex) size: \dangersign
\end{document}

enter image description here

share|improve this answer
    
Perhaps it's my imagination, but the exclamation point in the small version looks slightly off-center. –  Charles Staats Feb 10 at 20:03
    
@CharlesStaats Sometimes, when glyphs are overlaid, inexact rendering will make them appear off center. Zooming in reveals a better approximation, and the printed result is accurate. Zooming the small symbol to 6400% reveals aligned glyphs. –  Steven B. Segletes Feb 10 at 20:05
    
A question about the stackrel package: why does it render the \danger symbol from the fourier package as a letter B? –  Charles Staats Feb 11 at 2:26
    
@CharlesStaats Do you mean scalerel package? I would note that scalerel macros process their argument in math mode, by default, and one must actually delimit them with $...$ to process in text mode. So my guess is that the symbol is being processed in the wrong mode. –  Steven B. Segletes Feb 11 at 2:33
    
Your guess seems to have been entirely correct. Thanks! –  Charles Staats Feb 11 at 4:29

When you use XeLaTeX or LuaLaTeX you can simply use the character as is:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{STIXGeneral}
\newcommand\warningsign{⚠}
\begin{document}
    \warningsign Warning
\end{document}

Of course the font must contain it. (STIX does.)

It looks like this:

Warning sign

Notice that it is more common to give unicode code points in hexadecimal, here U+26A0.

If you don’t want to have unusual characters in your source code, you can specify the warning sign by its code point:

\newcommand\warningsign{\symbol{"26A0}}

(Found at “How do I enter an arbitrary Unicode code point into my document?”)

share|improve this answer
    
With the most recent version of the STIX fonts, the call should be \setmainfont[Ligatures=TeX]{STIX} –  egreg Feb 10 at 18:36
    
I appreciate the information, but prefer that my source code contain no characters that do not show up on my (American) keyboard. –  Charles Staats Feb 10 at 18:48
2  
@CharlesStaats: You can use ASCII characters: ^^^^26a0, see The ^^ notation in various engines –  Heiko Oberdiek Feb 10 at 18:54

You could have a better look at the The Comprehensive LATEX Symbol List.

The symbol is called \danger and it is provided by the fourier package.

If you don't have the need for the complete fourier package, but you want to use that symbol, you can extract it and use in your document:

\newcommand*{\TakeFourierOrnament}[1]{{%
\fontencoding{U}\fontfamily{futs}\selectfont\char#1}}
\newcommand*{\danger}{\TakeFourierOrnament{66}}

MWE

\documentclass{article}

\newcommand*{\TakeFourierOrnament}[1]{{%
\fontencoding{U}\fontfamily{futs}\selectfont\char#1}}
\newcommand*{\danger}{\TakeFourierOrnament{66}}

\begin{document}

\danger

\end{document}

Output

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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