7

i need some additional math symbols in latex. I did draw them in eps and include them with:

\newcommand*\triangleLeft{\ensuremath{\includegraphics{../triangleLeft}}}
\newcommand*\triangleRight{\ensuremath{\includegraphics{../triangleRight}}}
\newcommand*\triangleProp{\ensuremath{\includegraphics{../triangleProp}}}

This works fine for the most things. But it does not work for captions and notes (package: todonotes).

Do you have any better idea? Here is a screenshot of my symbols:

my new symbols

The x is subscript and does not belong to the symbol.

Kind regards, Max

Update:

\documentclass[12pt]{article}%, border=2pt]{standalone}

\usepackage{graphics}

\usepackage{MnSymbol}
\usepackage{sansmath}
\usepackage{stackengine, amsfonts} %


% Non of these work... :()
%\newcommand{\triangleLeft}{\ensuremath{\includegraphics{triangleLeft}}}
%\newcommand{\triangleLeft}{\mathrel{\text{\includegraphics{triangleLeft}}}}
%\newcommand{\triangleLeft}{\mathord{\stackMath\stackinset{c}{0pt}{c}{-0.3ex}{\scriptstyle\leftharpoonup}{\largetriangleup}}}

\begin{document}

\sansmath
 $ \triangleLeft_{\!x}$

$\triangleLeft_{\!x}$

\begin{figure}

% Next line fails!
\caption{$\triangleLeft_{\!x}$}

\end{figure}
\end{document} 

The error is either (for the first two definitions):

! Argument of \@caption has an extra }.
<inserted text> 
                \par 
l.25 \caption{$\triangleLeft_{\!x}$}

or

! Undefined control sequence.
\stackinset #1#2#3#4#5#6->\def \conditioned@inset 
                                                  {\stack@delim #5\stack@del...
l.25 \caption{$\triangleLeft_{\!x}$}

for the third version.

9
  • 1
    Welcome to the TeX.SE. Excuse me but into the symbol of the triangle, what are? I've never seen these symbols in mathematics enviroments. Could you add a complete code, please? Thank you for your cooperation.
    – Sebastiano
    Jul 2, 2020 at 11:37
  • I'd say something like \newcommand{\triangleLeft}{\mathrel{\text{\includegraphics[height=0.8\strutbox]{../triangleleft}}}}
    – egreg
    Jul 2, 2020 at 12:58
  • 1
    @Sebastiano The symbols represent that $x$ is in the symmetric difference of two sets. In the case of triangleLeft, $x$ is in the left set, and in the other case analog.
    – nopx
    Jul 17, 2020 at 12:18
  • 2
    @nopx If you plan to use it in captions or titles, use \DeclareRobustCommand instead of \newcommand.
    – egreg
    Jul 17, 2020 at 12:21
  • 1
    @Sebastiano It is newly defined by me for my thesis because I did not found any better symbol. You cannot know it. :)
    – nopx
    Jul 17, 2020 at 12:28

1 Answer 1

10

You can obtain these symbols very simply with Mnsymbol and the stackinset command from stackengine:

\documentclass[12pt]{article}%, border=2pt]{standalone}
\usepackage{MnSymbol}
\usepackage{sansmath}
\usepackage{stackengine, amsfonts} %
\newcommand{\leftharpoontriangle}{\mathord{\stackMath\stackinset{c}{0pt}{c}{-0.3ex}{\scriptstyle\leftharpoonup}{\largetriangleup}}}
\newcommand{\rightharpoontriangle}{\mathord{\stackMath\stackinset{c}{0pt}{c}{-0.3ex}{\scriptstyle\rightharpoonup}{\largetriangleup}}}

\begin{document}

\sansmath
 $ \rightharpoontriangle_{\!x}$

$\leftharpoontriangle_{\!x}$

 \end{document} 

enter image description here

5
  • 1
    Very very nice.
    – Sebastiano
    Jul 2, 2020 at 15:32
  • Does also not work in captions. :( See above ^^ But thanks a lot, very nice symbols.
    – nopx
    Jul 17, 2020 at 12:12
  • 1
    @nopx: to make it work in captions, use \caption{\protect\leftharpoontriangle}.
    – Bernard
    Jul 17, 2020 at 13:34
  • Yes, that works! Thanks! Do you have any idea how to make it scale appropriately in super or subscript?
    – nopx
    Jul 17, 2020 at 13:49
  • Probably defining a series of sizes with `\mathpalette. I don't have time at the moment to test the idea, but I'll do that this week-end.
    – Bernard
    Jul 17, 2020 at 14:08

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.