Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to define an order relation where I to distinguish want to fill in with black so that I have a black lying triangle in the first case and a black lying triangle with the suitable line below as in \leq in the second case. I am not satisfied with \blacktriangleleft and \overset{\blacktriangleleft}{-}.

share|improve this question
    
Some \ooalign magic together with a \leq or a raised - plus the \blacktriangleleft might work. You can search this site to see how \ooalign work. –  Manuel Jul 29 at 20:58
    
I attempted the search, but the hits did not seem sufficiently useful for me. –  Frode Bjørdal Jul 29 at 21:09

2 Answers 2

up vote 10 down vote accepted

Here's the \ooalign black magic:

\documentclass{article}
\usepackage{amssymb}

\newcommand{\bleq}{\mathrel{\mathpalette\bleqinn\relax}}
\newcommand{\bleqinn}[2]{%
  \ooalign{%
    \raisebox{.2ex}{$#1\blacktriangleleft$}\cr
    $#1\leq$\cr
  }%
}

\begin{document}
$a\bleq b\leq c$

$\bleq_{\bleq_{\bleq}}$
\end{document}

enter image description here

share|improve this answer
    
Thanks! And how do you program \ble for a black <? –  Frode Bjørdal Jul 29 at 21:14
    
I withdraw that question, as then I use \blacktriangleleft of course. –  Frode Bjørdal Jul 29 at 21:16
    
@user24406 This works for the standard Computer Modern fonts; if you use a different math font, this might need a different workaround. –  egreg Jul 29 at 21:21
    
Your \newcommand worked well for me. I write in Tex-Studio, and am enough of a beginner to not understand the import of your invocation of fonts. –  Frode Bjørdal Jul 29 at 21:28
1  
@user24406 If you use a package such as fourier or newtxmath for different fonts, the shape of \blacktriangleleft will not fit any more with the shape of <. But in that case you'll probably would not use the filled triangle together with <, just because they would be too different. –  egreg Jul 29 at 21:31

The following example defines \blackleq by putting \blacktriangleleft over the minus sign and vertically centers the result:

\documentclass{article}
\usepackage{amssymb}
\usepackage{color}

\makeatletter
\newcommand*{\blackleq}{%
  \mathrel{%
    \mathpalette\@blackleq{}%
  }%
}
\newcommand*{\@blackleq}[2]{%
  % #1: math style
  % #2: unused
  \vcenter{%
    \m@th
    \setbox0=\hbox{$#1\mkern3mu$}%
    \setbox2=\hbox{$#1\vcenter{}$}%
    \setbox4=\hbox{\raisebox{-\ht2}[.2pt][.2pt]{$#1-$}}%
    \hbox{$#1\blacktriangleleft$}%
    \nointerlineskip
    \kern\wd0 %
    \copy4 %
  }%
}
\makeatother

\begin{document}
\[
  < \blacktriangleleft \leq \blackleq
  \;\scriptstyle
  < \blacktriangleleft \leq \blackleq
  \;\scriptscriptstyle
  < \blacktriangleleft \leq \blackleq
\]
% Show bounding boxes
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{.1pt}%
\[
  \color{red}
  \def\x#1{\fbox{\color{black}$#1$}}
  \x{<}
  \x{\blacktriangleleft}
  \x{-}
  \x{\leq}
  \x{\blackleq}
\]
\end{document}

Result

Remarks:

  • The height of the bounding box of the minus sign is much larger than the height of the minus sign. Therefore the minus sign is put into a box (4) and raised to the base line.

  • \mathpalette is used to get the current math style for the size adaptations.

  • It depends on the fonts, if \blacktriangleleft can be used as filled less symbol. CM fonts are ok, but the symbol is too small in MnSymbol and too small with different slopes in mathabx.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.