[Tex/LaTex] How to represent the “Triangle of Power” in LaTeX


So, I've just seen a video about a method of notation called "Triangle of Power", which simplifies things when it comes down to exponents, logarithms, etc. It was originally introduced in this post on Math.Stackexchange: https://math.stackexchange.com/questions/30046/alternative-notation-for-exponents-logs-and-roots/165225#165225

I wanted to use it in my LaTeX documents, but couldn't figure out a way to actually write it easily; my knowledge of custom commands and positioning of symbols is not enough.

So, what I want to do is this:

Triangle of Power
And it needs to have some nice way of not providing one of the values (really, see the video if you're interested). Moreover, it should more-or-less fit in line with other notation, so it shouldn't be too big nor sticking out, though it probably will look okay if the values themselves stick out a little.

How can I implement this?

Best Answer

Working from Akiiino's answer I came up with this, which also works in display mode



\newcommand{\tripow}[3]{% Syntax: \tripow{#1}{#2}{#3} gives you #1 ^ {#2} = #3
   \mathop{% We want it to an operator
      \mathchoice% We want different functionality in text and display mode
         {% DISPLAY MODE
            \vphantom{\dotriangle\LARGE}% \vphantom off-set: places the bottom entries.
            \rule[-1.4ex]{0.1em}{0pt}% Syntax: [<vetical drop #1>]{<left margin>}{<Should be 0>}
            _{\scriptstyle #1}% style of #1 entry
            {\overset{\scriptstyle #2}% style of #2 entry
            {\dotriangle\LARGE}}% Size of the displayed operator - should match the \vphantom off-set.
            \rule[-1.4ex]{0em}{0pt}% Syntax: [<vetical drop #3>]{<Should be 0>}{<Should be 0>} 
            _{\scriptstyle #3}% style of #3 entry
            \rule[0ex]{0.1em}{0pt}% Syntax: [<Should be 0>]{<right margin>}{<Should be 0>}
        {% TEXT MODE
            {\dotriangle\normalsize}% size in text mode
        {% SCRIPT MODE
            _{\scriptstyle #1}%
            {\overset{\scriptstyle #2}%
            {\dotriangle\normalsize}}% size in script mode
            _{\scriptstyle #3}%

Compiling this code

Here we see some fundamental relations:
    \text{or}& \tripow{x}{\tripow{x}{}{z}}{z}
    \text{or}& \tripow{x}{y}{\tripow{x}{y}{}}
    \text{or}& \tripow{x}{y}{\tripow{x}{y}{}}
    \text{or}& \tripow{\tripow{}{y}{z}}{y}{z}
This is a line of text. This text says alot of interesting stuff and 
does not intersect.
Here is some more in-line text followed by $\tripow{x}{y}{z}$ which is
the same as saying $x^y=z$. The text on the this line does not 
intersect either.

gives you example

Related Question