我使用多重\Diamond
产品符号(\bDiamond
),如多个 $\Diamond$ 乘积的符号。现在,另外,我想要一个填充的\Diamond
产品标志,即填充黑色。有什么建议吗?
答案1
有了amssymb
你\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}
答案2
以下是强制性的 unicode 答案:
% 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}
答案3
你可以用tikz
它来画它。以下是填写版本与\Diamond
笔记:
- 这个版本需要额外的工作才能像 egreg 的版本一样扩展以适应不同的数学规模。
- 如果希望在宏上方添加破折号,我会定义一个单独的宏。但是,如果您没有其他所需选项,我会定义一个带星号的宏变体
\MyDiamond*
以包含破折号。
代码:
\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}
答案4
\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}