4

I would like to get a bold double struck one and I tried to use

\symbf{\symbb{1}}

but this does not work sadly. Is there some way to still get the desired result?

Thanks for your help :-)

Update: Here is the code I ended up using as proposed similar in the accepted answer.

\makeatletter
\DeclareRobustCommand{\pmbv}{\mathpalette\pmbv@}
\def\pmbv@#1#2{\setbox8\hbox{$\m@th#1{#2}$}%
    \setboxz@h{$\m@th#1\mkern.13mu$}\pmbraise@\wdz@
    \binrel@{#2}%
    \dimen@-\wd8 %
    \binrel@@{%
        \mkern-.4mu\copy8 %
        \kern\dimen@\mkern.25mu\raise\pmbraise@\copy8 %
        \kern\dimen@\mkern.25mu\raise2\pmbraise@\box8 %
    } 
}
\makeatother

which produces a one like this:

Ones

3 Answers3

6

Don't know if this approach has any appeal. Works with pdf specials (pdflatex). First column is \mathbb{R}. The other columns are variations on the stroke thickness. The top row is with black fill, the 2nd row with white fill.

\documentclass[10pt]{article}
\usepackage{xcolor,amssymb}
\input pdf-trans
\newbox\qbox
\def\usecolor#1{\csname\string\color@#1\endcsname\space}
\newcommand\bordercolor[1]{\colsplit{1}{#1}}
\newcommand\fillcolor[1]{\colsplit{0}{#1}}
\newcommand\colsplit[2]{\colorlet{tmpcolor}{#2}\edef\tmp{\usecolor{tmpcolor}}%
  \def\tmpB{}\expandafter\colsplithelp\tmp\relax%
  \ifnum0=#1\relax\edef\fillcol{\tmpB}\else\edef\bordercol{\tmpC}\fi}
\def\colsplithelp#1#2 #3\relax{%
  \edef\tmpB{\tmpB#1#2 }%
  \ifnum `#1>`9\relax\def\tmpC{#3}\else\colsplithelp#3\relax\fi
}
\newcommand\outline[1]{\leavevmode%
  \def\maltext{#1}%
  \setbox\qbox=\hbox{\maltext}%
  \boxgs{Q q 2 Tr \thickness\space w \fillcol\space \bordercol\space}{}%
  \copy\qbox%
}
\bordercolor{black}
\def\thickness{.3}% TO CHANGE THICKNESS OF SHADOW
\fillcolor{black}
\begin{document}
\fillcolor{black}
$\mathbb{R}$
\def\thickness{.1}% TO CHANGE THICKNESS OF SHADOW
\outline{$\mathbb{R}$}
\def\thickness{.2}% TO CHANGE THICKNESS OF SHADOW
\outline{$\mathbb{R}$}
\def\thickness{.3}% TO CHANGE THICKNESS OF SHADOW
\outline{$\mathbb{R}$}

\fillcolor{white}
$\mathbb{R}$
\def\thickness{.1}% TO CHANGE THICKNESS OF SHADOW
\outline{$\mathbb{R}$}
\def\thickness{.2}% TO CHANGE THICKNESS OF SHADOW
\outline{$\mathbb{R}$}
\def\thickness{.3}% TO CHANGE THICKNESS OF SHADOW
\outline{$\mathbb{R}$}
\end{document}

enter image description here

Ref: Composition of \mathbb and \mathcal

  • Thank you for your detailed response! Sadly I am using LuaLaTeX, sorry for not stating this before. – F. Spitzer Nov 04 '18 at 10:51
  • @Circumscribe Thanks, LOL. Having written stackengine, it "accidentally" ends up in a lot of my preambles. I have removed it. – Steven B. Segletes Dec 20 '18 at 10:16
  • 1
    This is very fancy. – manooooh Jan 10 '19 at 05:56
  • 1
    @manooooh Indeed, I recall being shocked the first time I saw that PDF could manipulate fonts as such. For further investigation, see https://tex.stackexchange.com/questions/125578/outline-text-using-truetype-fonts/313317#313317 and https://tex.stackexchange.com/questions/295243/have-latex-document-slowly-transform-fade-from-one-font-into-another/331002#331002 – Steven B. Segletes Jan 10 '19 at 10:40
3

You can use the poor man's bold from the amsbsy package, which prints the symbol three times slightly shifted (see, e.g., LaTeX Calligraphic Script Bold).

For symbols such as the double struck gamma in the example below this looks more or less fine, but in many other cases you can clearly see the overprint which does not look very nice (that's why it is called poor man's bold...). In the MWE below I have copied the definition of \pmb and removed one of the three copies to improve the result a little.

Code:

\documentclass{memoir}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{amsbsy}
\setmathfont{Asana Math}

\makeatletter
\DeclareRobustCommand{\pmbd}{\mathpalette\pmbd@}
\def\pmbd@#1#2{\setbox8\hbox{$\m@th#1{#2}$}%
\setboxz@h{$\m@th#1\mkern.5mu$}\pmbraise@\wdz@
\binrel@{#2}%
\dimen@-\wd8 %
\binrel@@{%
\mkern-.4mu\copy8 %
%\kern\dimen@\mkern.4mu\raise\pmbraise@\copy8 %
\kern\dimen@\mkern.4mu\box8 }%
}
\makeatother

\begin{document}
% regular
$1 2 \symbf{1} \symbf{2} \symbb{1} \symbb{2} \Gamma \symbf{\Gamma} \symbb{\Gamma}$
% poor man's bold double (from redefinition)
$\pmbd{1 2 \symbf{1} \symbf{2} \symbb{1} \symbb{2} \Gamma \symbf{\Gamma} \symbb{\Gamma}}$
% poor man's bold triple (from package)
$\pmb{1 2 \symbf{1} \symbf{2} \symbb{1} \symbb{2} \Gamma \symbf{\Gamma} \symbb{\Gamma}}$

\end{document}

Result:

enter image description here

Marijn
  • 37,699
2

You can get a bold math symbol by using the bold math style. In unicode-math, for example, you can use XITS Math Bold:

\documentclass[varwidth, preview]{standalone}
\usepackage{unicode-math}

\defaultfontfeatures{Scale=MatchUppercase}

\setmainfont{xits}[
  Scale = 1.0 ,
  Ligatures = {Common, TeX} ,
  UprightFont = *-regular ,
  BoldFont = *-bold ,
  ItalicFont = *-italic ,
  BoldItalicFont = *-bolditalic ,
  Extension = .otf
]
\setmathfont{xits-math.otf}
\setmathfont[version=bold]{xits-mathbold.otf}

\newcommand\mathbbbf[1]{\mbox{\boldmath\(\symbb{#1}\)}}
\newcommand\mathbbbfit[1]{\mbox{\boldmath\(\symbbit{#1}\)}}

\begin{document}
\( \mathbb{D} \mathbbbf{D} \mathbbit{D} \mathbbbfit{D} \)
\end{document}

Font Sample

Simpler and more convenient: \boldmath\mathbb from amsmath.

You can also declare these new math alphabets with \setmathfontface.

In legacy NFSS, there are several packages that provide a bold double-struck alphabet. I would recommend the mathalpha package (formerly mathalfa), which automatically loads bold-double-struck as \mathbbb if you select a blackboard alphabet that has a corresponding bold version:

\documentclass[varwidth, preview]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % The default since 2018
\usepackage{textcomp} % Not used here.
\usepackage[bb = boondox]{mathalpha}

\begin{document}
\( \mathbb{D} \mathbbb{D} \)
\end{document}

Boondox font sample

Davislor
  • 44,045