9

To insert the abstract algebra operators, I tried:

\documentclass{article}
\usepackage{stackengine}
\usepackage{scalerel}
\newlength\triwidth
\newcommand\tridelt[1]{%
  \setlength\triwidth{\widthof{#1\ }}%
  \stackengine{-.1\triwidth}{#1\ }%
    {\scaleto{\Delta}{1\triwidth}}{O}{c}{F}{F}{L}%
}
\begin{document}

\begin{equation}
   C = A \tridelt{+} B, C = A \tridelt{x} B
\end{equation}

\end{document}

as in

Triangle with text in it

but the result looks ugly, how to fix it?

example

2

2 Answers 2

7

The symbols can be found in the in the Comprehensive LaTeX symbols list.

enter image description here

\usepackage{stix}

\begin{equation}
  \triangleplus \triangleminus \triangletimes 
\end{equation}

As shown above, this package provides lots of symbols that can be used in abstract algebra (\boxplus \boxminus \boxtimes).

3

Into the triangle you can put any symbols.
enter image description here

\documentclass{article}
\usepackage{mathtools}
\usepackage{mathptmx}
\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{xcolor}
\newcommand\trianglesignx[1][2.3ex]{%
  \renewcommand\stacktype{L}%
  \scaleto{\stackon[0.7pt]{\color{black}$\triangle$}{\tiny $\times$}}{#1}%
}
\newcommand\trianglesignplus[1][2.3ex]{%
  \renewcommand\stacktype{L}%
  \scaleto{\stackon[0.7pt]{\color{black}$\triangle$}{\tiny $\times$}}{#1}%
}
\begin{document}
\[\alpha \trianglesignx f(x,y)=M-M_{\alpha} \trianglesignplus\]
\end{document}

EDIT (as requested in comments):

I made the following changes in the code:

  1. Added \mathbin for proper spacing around the binary operators. See here for more details.
  2. Removed \color{black} -- not sure what that is for.

Code:

\documentclass{article}
\usepackage{mathtools}
\usepackage{mathptmx}
\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{stix}
\newcommand\trianglesignx[1][2.3ex]{%
    \renewcommand\stacktype{L}%
    \mathbin{%
    \scaleto{\stackon[0.7pt]{$\triangle$}{\tiny $\times$}}{#1}%
}}
\newcommand\trianglesignplus[1][2.3ex]{%
    \renewcommand\stacktype{L}%
    \mathbin{%
    \scaleto{\stackon[0.7pt]{$\triangle$}{\tiny $+$}}{#1}%
}}
\begin{document}
    Custom symbols:
    \[\alpha \trianglesignx f(x,y)=M-M_{\alpha} \trianglesignplus M_{\alpha}\]

    Symbols from \verb!stix! package: 
    \[\alpha \triangletimes f(x,y)=M-M_{\alpha} \triangleplus M_{\alpha}\]
\end{document}

example output

5
  • 1
    Hi, what's the use of \color{black}, and is the second one supposed to be + instead of \times? Cause I'm not getting the output you're showing with the above code
    – Troy
    Apr 29, 2017 at 9:43
  • 1
    I think you should also include \mathbin to get proper spacing around the triangle operators. :)
    – Troy
    Apr 29, 2017 at 10:10
  • I did not put the times and the symbol + why did I want to make it clear that within the triangle can put anything? I was hoping you would have appreciated my work. Could you edit my answer including the command \mathbin. For six months I'm signed up on TeX.SE and I only put two negative votes.
    – Sebastiano
    Apr 30, 2017 at 20:07
  • For the record, I'm not the one who downvoted your answer..
    – Troy
    May 1, 2017 at 1:36
  • @Troy Please can you modificate my code?
    – Sebastiano
    May 1, 2017 at 20:06

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.