What would be the best practice approach to typeset the Triforce symbol known from the Nintendo® Zelda™ series?
7 Answers
Here is a nice shaded TikZ version which you can draw in variable sizes.
You have to call the \triforce
macro with one parameter, which is the width of the Triforce, e.g. \triforce{10cm}
.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadings, calc}
\colorlet{triforcefilloutercolor}{Gold!50!Yellow}
\colorlet{triforcefillinnercolor}{white!80!triforcefilloutercolor}
\colorlet{triforceoutlineinnercolor}{white}
\colorlet{triforceoutlineoutercolor}{Goldenrod}
\tikzset{%
triforcefillshade/.style={%
inner color=triforcefillinnercolor,%
outer color=triforcefilloutercolor%
},%
triforceoutlineshade/.style={%
inner color=triforceoutlineinnercolor,%
outer color=triforceoutlineoutercolor%
}%
}
\newcommand{\triforce}[1]{%
\begin{tikzpicture}%
\newdimen\triforcewidth%
\newdimen\triforceheight%
\triforcewidth=#1%
\pgfmathparse{sqrt(3)}%
\pgfmathsetlength{\triforceheight}{\pgfmathresult / 2 * \triforcewidth}%
%
\foreach \x / \y in {0 / 0, 0.5\triforcewidth / 0, 0.25\triforcewidth / 0.5\triforceheight}%
{%
\shade[triforcefillshade, xshift=\x, yshift=\y]%
(0, 0) -- +(.5\triforcewidth, 0) -- +(60:.5\triforcewidth) -- cycle;%
\shade[triforceoutlineshade, xshift=\x, yshift=\y]%
(0, 0) -- +(.5\triforcewidth, 0) -- +(60:.5\triforcewidth) -- cycle%
(30:.0175\triforcewidth) -- ($(60:.5\triforcewidth) + (-90:.0175\triforcewidth)$) -- ($(0.5\triforcewidth, 0) + (150:.0175\triforcewidth)$) -- cycle;%
}%
\end{tikzpicture}%
}
\begin{document}
\triforce{10cm}
\end{document}
-
Hmm, I think I like this the most, because it looks pretty much like the logo on Wikipedia. I suppose I can use things like
1em
as width to make this fit into a line of text, right?– polemonJul 15, 2014 at 12:41 -
1@polemon I don't think it will look as good in such a small size. Perhaps you would be better off using Heiko's answer colored black and put in a resizebox with a size of 1em.– szantaiiJul 15, 2014 at 17:18
-
A simple tikz
solution:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikz\fill[yellow]
(0,0) -- +(1,0) -- +(60:1) -- cycle
(1,0) -- +(1,0) -- +(60:1) -- cycle
(60:1) -- +(1,0) -- +(60:1) -- cycle
;
\end{document}
-
4Your answer also provides an interesting optical illusion (on my screen). If I stare at the graphic, I see a bright yellow color. But if I move my gaze anywhere else, the graphic color goes to a dimmer color, until I refix my gaze on the graphic. Jul 14, 2014 at 20:19
With stacks. The top one is a simple stack of \TriangleUp
symbols, whereas the bottom one uses a shrunken \stackinset
upon the same, to achieve a border, as shown on the wiki reference.
\documentclass{article}
\usepackage{stackengine,xcolor,bbding,graphicx}
\def\LTri{\stackinset{c}{}{c}{-.2pt}{\scalebox{.85}
{\textcolor{yellow!20}{\TriangleUp}}}
{\textcolor{yellow}{\TriangleUp}}}
\begin{document}
\textcolor{yellow}{\stackon[0pt]{\TriangleUp\TriangleUp}{\TriangleUp}}
\stackon[0pt]{\LTri\LTri}{\LTri}
\end{document}
Compile with XeLaTex :
\documentclass{article}
\usepackage{pifont}
\usepackage{color}
\begin{document}
I can triforce !
\noindent
~~\ding{115}\\
\ding{115}~\ding{115}
Even in yellow:
\color{yellow}{
\noindent
~~\ding{115}\\
\ding{115}~\ding{115}
}
\end{document}
-
-
-
2@JonathanLandrum : I think it is more in the spirit of the forum triforce ! The one by @klingt.net is nice, too.– ClémentJul 15, 2014 at 15:31
-
1It's certainly in the spirit of the "I can triforce" meme Jul 15, 2014 at 15:31
Just for fun, with pict2e
:
\documentclass{standalone}
\usepackage{pict2e}
\begin{document}
\begin{picture}(2,1.732050808)
\newsavebox{\tripart}
\savebox{\tripart}{\moveto(0,0)\lineto(1,0)\lineto(0.5,0.866025404)\closepath\fillpath}
\put(0,0){\usebox{\tripart}}
\put(1,0){\usebox{\tripart}}
\put(0.5,0.866025404){\usebox{\tripart}}
\end{picture}
\end{document}
Only with amssymb
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\begin{document}
\Huge%
\hspace{-8pt}$\blacktriangle$\vspace{-15pt}\\
$\blacktriangle$\hspace{-4pt}$\blacktriangle$
\end{document}
Based on Heiko Oberdiek's answer, there is --- just for the fun --- an even simpler drawing with TiKz.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[yellow] (0,0) -- +(2,0) -- +(60:2) -- cycle;
\fill[white] (60:1) -- +(1,0) -- (1,0) -- cycle;
\end{tikzpicture}
\end{document}
Below the drawing with [blue!05]
instead of [white]
, just to mess with Steven B. Segletes's screen.
And to get a "triforce symbol logo of 1em height", as szantaii suggests :
\documentclass{article}
\usepackage{tikz}
\newcommand{\triforce}{\resizebox{1em}{!}{
\begin{tikzpicture}
\fill[black] (0,0) -- +(2,0) -- +(60:2) -- cycle;
\fill[white] (60:1) -- +(1,0) -- (1,0) -- cycle;
\end{tikzpicture}
}}
\begin{document}
I'd like to introduce the \triforce{} symbol.
\end{document}
-
Strictly speaking, Oberdiek's answer is more correct, because of the lack of "white-out". This is most evident when the output is in PNG format.– bugJul 17, 2014 at 6:02
-
@Clément I agree with bug's comment. Try using path clipping combined with TikZ's even odd rule instead of white filling the unnecessary area. See section 15.9 Clipping and Fading (Soft Clipping) in the TikZ & PGF manual (version 3.0.0). Example:
\begin{tikzpicture}[even odd rule] \clip (0, 0) -- +(2, 0) -- +(60:2) -- cycle (1, 0) -- +(60:1) -- +(120:1) -- cycle; \fill (0, 0) -- +(2, 0) -- +(60:2) -- cycle; \end{tikzpicture}
.– szantaiiJul 17, 2014 at 9:35 -
-
1@Clément: Thank you very much for creating this. I've just added it to my symbol classifier website (link, it wasn't added to the classifier as I guess not many people will need it) Mar 28, 2015 at 14:48
:)