3

Is it possible to make a diamond like the National Fire Protection Association in tex? I made a table using xcolor package with [colortbl]. NFPA

  • 1
    Welcome to TeX.SX! On this platform, questions about how to draw specific graphics by just posting an image of the desired result are typically considered to be merely requests for “do it for me”. So, please post a minimal compilable document showing that you’ve tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. However, you should have a look at tikz. – Jasper Habicht Sep 14 '17 at 19:58
  • … or look at this answer. – Jasper Habicht Sep 14 '17 at 20:04
5

I wrote some macros for easy use of this diamond:

\documentclass{article}

\usepackage{tgheros,tikz}

\newcommand{\nowater}{\huge%
 \begin{tikzpicture}
  \node at (0, 0) {W};
  \draw[line width=.1ex] (-.55em, 0) -- (.55em, 0);
 \end{tikzpicture}%
}

\newcommand{\radioactive}{%
 \raisebox{.5ex}{\begin{tikzpicture}[scale=.7, rotate=60]
  \fill (0, 0) circle (.1);
  \fill (0:.15) arc (0:60:.15) -- (60:.5) arc (60:0:.5) -- cycle;
  \fill (120:.15) arc (120:180:.15) -- (180:.5) arc (180:120:.5) -- cycle;
  \fill (240:.15) arc (240:300:.15) -- (300:.5) arc (300:240:.5) -- cycle;
 \end{tikzpicture}}%
}

\newcommand{\hazarddiamond}[4]{\sffamily\huge%
 \begin{tikzpicture}[rotate=225]
  \fill[red!75] (0, 0) rectangle (1, 1);
  \fill[blue!75] (1, 0) rectangle (2, 1);
  \fill[yellow!75] (0, 1) rectangle (1, 2);
  \draw (0, 2) grid (2, 0);
  \node at (0.5, 0.5) {#1};
  \node at (1.5, 0.5) {#2};
  \node at (0.5, 1.5) {#3};
  \node at (1.5, 1.5) {\large#4};
 \end{tikzpicture}%
}

\begin{document}

\hazarddiamond{0}{0}{0}{}

\hazarddiamond{3}{1}{2}{\nowater}

\hazarddiamond{2}{4}{3}{\radioactive}

\hazarddiamond{4}{3}{3}{COR}

\end{document}

Result:

enter image description here

3
\documentclass{article}
\usepackage{xcolor,txfonts,stackengine,graphicx}
\newcommand\borderdiamond[2]{%
  \stackinset{c}{}{c}{}{\textcolor{white}{\bfseries\sffamily#2}}{%
    \stackinset{c}{}{c}{}%
    {\scalebox{2.3}{\color{#1}$\Diamondblack$}}%
    {\scalebox{2.4}{$\Diamondblack$}}%
  }%
}
\begin{document}
\renewcommand\stacktype{S}
\stackon[-9.7pt]{\smash{\borderdiamond{blue}{0}\kern-2.3pt\borderdiamond{yellow}{0}}}
  {\stackanchor[-.3pt]{\borderdiamond{red}{0}}{\borderdiamond{white}{}}}
\end{document}

enter image description here

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.