5

I'm looking for how to create a diamond symbol with a dash that horizontally divides it. One like the following:

enter image description here

I found the diamondminus on MnSymbol package, but this new package is incompatible with other packages that I use such as amssymb.

Could you know how to create such a symbol?

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Sep 13 '18 at 10:25
  • Have a look at tex.stackexchange.com/questions/427270/… here a diamond (filled) with an questionmark is defined, maybe you can adjust it / have a starting point for your purposes. – albert Sep 13 '18 at 10:26
8

I used the amssymb package symbol you mentioned and added the dash, using scalebox (offered by graphicx) with different values for x and y to keep the thickness of the dash.

\documentclass[12pt]{article}

\usepackage{amssymb}
\usepackage{graphicx}

\newcommand{\clap}[1]{\makebox[0pt]{\hss#1\hss}}
\newcommand{\mydiamond}{%
  \sbox0{$\lozenge$}%
  \usebox0\kern-.5\wd0\clap{\raisebox{.1ex}{\scalebox{.7}[1]{$-$}}}\kern.5\wd0%
}

\begin{document}
\mydiamond

\end{document}

enter image description here

  • 2
    If you do not want white space between the two symbols, use \scalebox{.80}[1]{$-$} – Denis Sep 13 '18 at 11:18
6

Two Approaches:

Use existing \Diamond of amssymb

\documentclass{article}
\usepackage{stackengine,amssymb,graphicx}
\newcommand\DDiamond{\ensurestackMath{%
  \stackengine{.5pt}{\Diamond}{\scalebox{.75}[1]{$-$}}{O}{c}{F}{F}{L}}}
\begin{document}
$\DDiamond$ as created\par
$\Diamond$ is the amssymb version
\end{document}

enter image description here

If you want the cross-line to be a "dash" with space around it, reduce the value of .75 in the \scalebox to, for example, .6:

enter image description here

IMPORT JUST ONE MnSymbol

Import just \DDiamond from MnSymbol. Thus, it does not screw up the other definitions of amssymb. I've declared it as \mathrel but you can change that.

I've set up convenient macros (between the %%%% delimiters) for importing stuff from MnSymbol. Once those macros are set up (copied/pasted into your preamble), the import goes as follows:

\ImportFromMnSymbol{C}
\DeclareMnSymbol{\DDiamond}{\mathrel}{C}{120}
%\MnSymbolGlyphs{C}

\MnSymbolGlyphs{} shows the font table for MnSymbolA, B, C, etc, given the subset as the argument. This is how to locate a glyph's subset and slot number.

\ImportFromMnSymbol{} sets up for importing symbols from the specified MnSymbol subset.

\DeclareMnSymbol{<macroname>}{<math category>}{<subset>}{<slot>} to grab the MnSymbol from the specified slot in the given subset.

\documentclass{article}
\usepackage{amssymb}
%%%%
\def\MnSymbolGlyphs#1{% IF ONE NEEDS TO LOCATE GLYPHS
  \usepackage{MnSymbol,fonttable}%
  \AtBeginDocument{\fonttable{MnSymbol#110}}%
}
\def\ImportFromMnSymbol#1{%
  \DeclareFontFamily{U} {MnSymbol#1}{}
  \DeclareFontShape{U}{MnSymbol#1}{m}{n}{
   <-6> MnSymbol#15
   <6-7> MnSymbol#16
   <7-8> MnSymbol#17
   <8-9> MnSymbol#18
   <9-10> MnSymbol#19
   <10-12> MnSymbol#110
   <12-> MnSymbol#112}{}
  \DeclareFontShape{U}{MnSymbol#1}{b}{n}{
   <-6> MnSymbol#1-Bold5
   <6-7> MnSymbol#1-Bold6
   <7-8> MnSymbol#1-Bold7
   <8-9> MnSymbol#1-Bold8
   <9-10> MnSymbol#1-Bold9
   <10-12> MnSymbol#1-Bold10
   <12-> MnSymbol#1-Bold12}{}
  \DeclareSymbolFont{MnSy#1} {U} {MnSymbol#1}{m}{n}
}
\newcommand\DeclareMnSymbol[4]{\DeclareMathSymbol{#1}{#2}{MnSy#3}{#4}}
%%%%
\ImportFromMnSymbol{C}
\DeclareMnSymbol{\DDiamond}{\mathrel}{C}{120}
%\MnSymbolGlyphs{C}
\begin{document}
$\DDiamond$ as imported from MnSymbol\par
$A \DDiamond B\quad\scriptstyle A \DDiamond B\quad\scriptscriptstyle A \DDiamond B$

$\Diamond$ is still the amssymb version
\end{document}

enter image description here

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.