TransWikia.com

Smaller bullet for homological grading

TeX - LaTeX Asked by Gaussler on December 31, 2020

When writing (co)homological grading, the command bullet yields a bullet that is too big for my taste, see the example below. Therefore, I usually define a command smallbullet as below. However, my construction should probably be made more robust using mathpalette, using ideas similar to this and this. However, if you apply the constructions from these other solutions, you get a bullet with the wrong vertical position. What would be the best (and most robust) way to correct this in my case?

documentclass{article}

usepackage{graphicx}

newcommandsmallbullet{%
    raisebox{-0.25ex}{scalebox{1.2}{$cdot$}}%
}

begin{document}

$ H^{bullet} $

$ H^{smallbullet} $

end{document}

enter image description here

3 Answers

I'd scale down a bullet, because cdot has quite wide sidebearings. Here the scale factor is 0.5, adjust to suit.

documentclass{article}

usepackage{graphicx}

makeatletter
newcommand{smallbullet}{} % for safety
DeclareRobustCommandsmallbullet{%
  mathord{mathpalettesmallbullet@{0.5}}%
}
newcommand{smallbullet@}[2]{%
  vcenter{hbox{scalebox{#2}{$m@th#1bullet$}}}%
}
makeatother

begin{document}

$ H^{bullet} $

$ H^{smallbullet} $

end{document}

enter image description here

Correct answer by egreg on December 31, 2020

Using for the smallbullet the nice macro of Steven B. Segletes in this question, Is there a black 'dot' symbol that I can use?

newcommandsbullet[1][.5]{mathbin{ThisStyle{vcenter{hbox{%
  scalebox{#1}{$SavedStylebullet$}}}}}%
}

that I have a bit adapted, I suggest to use strut to have a better positioning of the bullet as superscript. Here there is a possibile MWE that shows two different size of the bullets in addendum to the classical bullet.

documentclass[a4paper,12pt]{article}
usepackage{amsmath,amssymb}
usepackage{graphicx,scalerel}
newcommandsbullet[1][.5]{mathbin{ThisStyle{vcenter{hbox{%
  scalebox{#1}{$SavedStylebullet$}}}}}%
}
newcommandsmbullet[1][.8]{mathbin{ThisStyle{vcenter{hbox{%
  scalebox{#1}{$SavedStylebullet$}}}}}%
}
begin{document}
$Hstrut^{bullet}, Hstrut^{sbullet}, Hstrut^{smbullet}$
end{document}

enter image description here


Using your macro you will have the same and correct height for the smallbullet or bullet:

 documentclass[a4paper,12pt]{article}
    usepackage{amsmath,amssymb}
    usepackage{graphicx}
    newcommandsmallbullet{%
    raisebox{-0.25ex}{scalebox{1.2}{$cdot$}}%
}

    begin{document}
    $Pstrut^{bullet}, Hstrut^{smallbullet}$
    end{document}

enter image description here

Answered by Sebastiano on December 31, 2020

I decided to rewrite egreg’s excellent answer in expl3. However, as many TeX concepts (such as vcenter and mathpalette) seem to not yet have expl3 analogues, I was forced to mix up old and new standards. I was hoping egreg would comment and tell me if there is something that could be improved?

documentclass{article}

usepackage{expl3}

ExplSyntaxOn

cs_new_protected:Npngaussler_set_mathsurround_to_zero:
{
     % This is equivalent to "m@th"
    dim_set:Nn mathsurround { 0pt }
}

cs_set_protected:Npngaussler_bullet:
{
    mathord{mathpalette__gaussler_bullet_auxiliary:Nn{0.5}}
}

box_new:N l__gaussler_bullet_box

cs_set_protected:Npn__gaussler_bullet_auxiliary:Nn#1#2
{
    hbox_set:Nn l__gaussler_bullet_box { $gaussler_set_mathsurround_to_zero: #1 bullet$ }
    box_scale:Nnn l__gaussler_bullet_box { #2 } { #2 }
    vcenter{ hbox:n { box_use_drop:N l__gaussler_bullet_box } }
}

cs_set_eq:NNsmallbullet gaussler_bullet:

ExplSyntaxOff

begin{document}

$ H^{bullet} $

$ H^{smallbullet} $

end{document}

Answered by Gaussler on December 31, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP