TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the multiple \Diamond-product sign (\bDiamond) as described in sign for multiple $\Diamond$-product. Now, in addition, I would like to have a filled \Diamond-product sign, i.e. filled with black. Any suggestions?

share|improve this question
2  
Lots of options here: tex.ac.uk/tex-archive/info/symbols/comprehensive/symbols-a4.pdf – Thruston Aug 17 '14 at 21:06
up vote 19 down vote accepted

With amssymb you have \blacklozenge:

\documentclass{article}
\usepackage{amssymb,graphicx}

\newcommand{\bDiamond}{\mathbin{\Diamond}}
\newcommand{\bLozenge}{\mathbin{\blacklozenge}}

\makeatletter
\newcommand\bigDiamond{\mathop{\mathpalette\bigDi@mond\relax}}
\newcommand\bigDi@mond[2]{%
  \vcenter{\hbox{\m@th
    \scalebox{\ifx#1\displaystyle 2\else1.2\fi}{$#1\Diamond$}%
  }}%
}
\newcommand\bigLozenge{\mathop{\mathpalette\bigL@zenge\relax}}
\newcommand\bigL@zenge[2]{%
  \vcenter{\hbox{\m@th
    \scalebox{\ifx#1\displaystyle 2\else1.2\fi}{$#1\blacklozenge$}%
  }}%
}
\makeatother

\begin{document}
\[
\bigoplus_{i=1}^n % just for comparison
\bigDiamond_{i=1}^n (a_i\bDiamond b_i)\quad
\textstyle\bigDiamond_{i=1}^n a_i\quad
\scriptstyle\bigDiamond_{i=1}^n a_i\quad
\scriptscriptstyle\bigDiamond_{i=1}^n a_i
\]
\[
\bigoplus_{i=1}^n % just for comparison
\bigLozenge_{i=1}^n (a_i\bLozenge b_i)\quad
\textstyle\bigLozenge_{i=1}^n a_i\quad
\scriptstyle\bigLozenge_{i=1}^n a_i\quad
\scriptscriptstyle\bigLozenge_{i=1}^n a_i
\]
\end{document}

enter image description here

share|improve this answer

You can use tikz to draw it. Here is a comparison of the filled in version along with the \Diamond

enter image description here

Notes:

  • This version requires additional work to be able to scale as well as egreg's version for different math sizes.
  • I defined a separate macro if a dash over it is desired. However, if you did not have other options that were required, I would define a starred variant of the macro \MyDiamond* to include the dash.

Code:

\documentclass{article}
\usepackage{amssymb,amsmath, graphicx}
\usepackage{tikz}

\newcommand{\sqdiamond}[1][fill=black]{\tikz [x=1.2ex,y=1.85ex,line width=.1ex,line join=round, yshift=-0.285ex] \draw  [#1]  (0,.5) -- (.5,1) -- (1,.5) -- (.5,0) -- (0,.5) -- cycle;}%
\newcommand{\sqdiamondDash}[1][fill=black]{%
    \tikz [x=1.2ex,y=1.85ex,line width=.1ex,line join=round, yshift=-0.285ex] 
        \draw  [#1]  
            (0,.5) -- (.5,1) -- (1,.5) -- (.5,0) -- (0,.5) -- cycle
            (0,1.1) --  (1,1.1);
}%
\newcommand{\MyDiamond}[1][fill=black]{\mathop{\raisebox{-0.275ex}{$\sqdiamond[#1]$}}}
\newcommand{\MyDiamondDash}[1][fill=black]{\mathop{\raisebox{-0.275ex}{$\sqdiamondDash[#1]$}}}


\begin{document}

$a \Diamond b \MyDiamond c \MyDiamond[draw=red,fill=cyan] d \MyDiamondDash[draw=red,fill=cyan] e$

\end{document}
share|improve this answer
1  
I would like to have the same shape as $\Diamond$. – ocon Aug 17 '14 at 21:14
1  
@HennerWild: Adjusted to be same shape as \Diamond. – Peter Grill Aug 18 '14 at 6:47
    
@Peter Grill Using your solution, is it possible to add an horizontal line above the diamond ? – Manuel Selva Nov 5 '15 at 14:42
1  
@ManuelSelva: Have updated solution to include that. – Peter Grill Nov 6 '15 at 3:07
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc} 
 \usepackage[x11names]{xcolor}

 \usepackage{amsmath,amssymb}
 \usepackage{array} 

\DeclareFontFamily{U}{mathb}{\hyphenchar\font45}
\DeclareFontShape{U}{mathb}{m}{n}{
<5><6><7><8><9><10>gen*mathbm
<10.95>mathbm10<12><14.4><17.28><20.74><24.88>mathbm12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareFontSubstitution{U}{mathb}{m}{n}
\DeclareMathSymbol{\blackdiamond}{\mathbin}{mathb}{"0C}
\def\bluediamond{\mathbin{\color{SteelBlue3}\blackdiamond}}    
\def\bluelozenge{\mathbin{\color{SteelBlue3}\blacklozenge}}

\begin{document}

\renewcommand\arraystretch{1.5}    
\begin{tabular}{l l}
With \texttt{mathabx}:   &  $ a \bluediamond b $ \\
With \texttt{amssymb}:  & $ a \bluelozenge b $
\end{tabular}

 \end{document} 

enter image description here

share|improve this answer

And here the obligatory unicode-answer:

% arara: lualatex

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITS-Math}
\usepackage{booktabs}

\begin{document}    
\begin{table}
    \centering
\begin{tabular}{lc}
    \toprule
    Unicode & Symbol\\
    \midrule
    \verb|U+2B26| & $\mdwhtdiamond$\\
    \verb|U+2B25| & $\mdblkdiamond$\\
    \verb|U+2B28| & $\mdwhtlozenge$\\
    \verb|U+2B27| & $\mdblklozenge$\\
    \verb|U+22C4| & $\smwhtdiamond$\\   
    \verb|U+2B29| & $\smblkdiamond$\\
    \verb|U+2B2B| & $\smwhtlozenge$\\
    \verb|U+2B2A| & $\smblklozenge$\\
    \verb|U+25C7| & $\mdlgwhtdiamond$\\
    \verb|U+25C6| & $\mdlgblkdiamond$\\
    \verb|U+2662| & $\diamondsuit$\\
    \verb|U+2666| & $\vardiamondsuit$\\
    \bottomrule
\end{tabular}
\end{table}    
If you can't decide, take $\blackinwhitediamond$ or a half version like these: $\diamondleftblack\diamondrightblack\diamondtopblack\diamondbotblack$    
\end{document}

enter image description here

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.