1

I'd like to find a ⚡ symbol for TeX. When I try to draw something like it in Detexify, I get similar symbols, but they have a an arrow at the south end of the lightning bolt, unlike Unicode U+26A1 (which is ⚡). Are there any packages that implement such a lightning bolt?

  • Can you use xelatex or lualatex? – David Purton Sep 16 '16 at 4:44
  • @DavidPurton No, sorry, I think I have to use latex! – user89 Sep 16 '16 at 4:45
  • 1
    With U+26A1 one refers to an “abstract character”; the graphic realization (the “glyph”) is a free choice by the font designer. What you see here is the particular realization in the font used by the browser when requested to represent U+26A1 and different people may see different glyphs, maybe with the arrow tip. – egreg Sep 17 '16 at 8:41
5

A solution with TikZ. The drawn symbol \Lightning has the height of a H. It has an optional argument to set some parameters like the fill and drawing colors. Also LaTeX's \newcommand makes macros with an optional argument robust.

\documentclass{standalone}
\usepackage{tikz}

\newcommand*{\Lightning}[1][]{%
  \tikz[
    x=.55 * height("H"),  % symbol width
    y=height("H"),  % symbol height
    baseline=(current bounding box.south),
    line width=.02 * height("H"),
    line join=bevel,
  ]
  \filldraw[{#1}]
    (-.5, -.5) -- (.4, -.03) -- (-.1, .06) --
    (.5, .5) -- (-.4, .03) -- (.1, -.06) --
    cycle
    % side bearings
    (-.5 - .08, 0)
    (.5 + .08, 0)
  ;%
}

% Test
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\begin{document}
  \fbox{\Lightning[fill=red, draw=blue]}%
  \Lightning
  \Lightning[fill=yellow, line join=round, xscale=1.25]
\end{document}

Result

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.