5

I have the need to use greek blackboard bold letters and for this reason I checked this question and solved the package superposition problem thanks to the answer on this other question.

The problem is that I personally don't like the appearence of the bbold package font and I was looking for something like this (I don't see the bottom part of the image with the greek letters in my computer, but it's clearly visible on google images just typing the title of the question; if you have the same problem see here)

So I deduce that another type of blackboard bold greek font doesn't exist yet, am I right? Or maybe I just cannot find it? Thanks!

Rob Tan
  • 263
  • 1
    Thanks for the bonus! – Steven B. Segletes Sep 23 '20 at 12:03
  • 1
    It's the minimum I could do, you solved me a big problem: the problem became important when I had to write Dirac equation with $\alpha,\beta,\gamma,\sigma$ matrices and at the same time using $\alpha,\beta\gamma$ to indicate components of matrices, matrices for which normally I used '\mathbb' with latin letters until that point. I didn't really know what to do and to change my whole typographic convention (how anyway?) was not thinkable. Thanks a lot again! – Rob Tan Sep 23 '20 at 12:33

4 Answers4

8

The OP cites this question, Who can write a package for the new mathbb font as in the picture and compatible with Computer Modern font?, as a desired endpoint, in which it appears that an outline font is offered.

For work in pdflatex, and adapting my answer here: Outline text using TrueType fonts, you can set color of border, fill and line-thickness metric, and use pdf specials to accomplish the outline.

\documentclass{article}
\usepackage{xcolor}
\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\outline[1]{\leavevmode%
  \def\maltext{\mydelim #1\mydelim}%
  \setbox\qbox=\hbox{\maltext}%
  \boxgs{Q q 2 Tr \bbthickness\space w \fillcol\space \bordercol\space}{}%
  \copy\qbox%
}
\newcommand\mathbb[1]{\def\mydelim{$}\outline{#1}}
\newcommand\textbb[1]{\def\mydelim{}\outline{#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
}
\bordercolor{black}
\fillcolor{white}
\newcommand\bbthickness{.15}
\begin{document}
$y=\mathbb{\beta}+\textbb{R}$
\end{document}

enter image description here

  • That's absolutely great thanks! I would have stayed one thousand years to accomplish something like this, how can you do that??? P.S.: I redefined your command as '\mathb' instead of '\mathbb', so I can continue to use the latter and at the moment everything seems to work – Rob Tan Sep 17 '20 at 08:11
  • 2
    @Rob Just spending a small amount of time each day on this site, seeing what the active questions are, or else searching out questions of particular interest, helps to expand one's knowledge base. This particular technique of pdf specials is a way to have LaTeX plug into underlying features of the PDF language (in a very brute force way) and so (outside of the interface syntax) is not LaTeX, per se. Two users of this site whose answers taught me about this topic were Malipivo and wipet. – Steven B. Segletes Sep 17 '20 at 09:21
  • But is there a manual that covers the more advanced topics of LaTeX? Because I don't know nothing about it! I just know how to use simple commands but not how to really program something like this – Rob Tan Sep 17 '20 at 11:38
  • 2
    @Rob Different people learn different ways. Personally, I find the examples provided by the answers on this site to be every bit as valuable as a reference volume. Also, package documentation is very useful. Having seen in this answer that the pdf-trans package is what provided the utility needed, go to ctan.org and look up the package: https://ctan.org/pkg/pdf-trans. It provides an example.pdf file of uses. – Steven B. Segletes Sep 17 '20 at 11:45
  • 1
    @Rob ...or search this site for \boxgs and find questions like this: https://tex.stackexchange.com/questions/461534/list-of-all-available-parameters-of-boxgsarg1arg2-of-pdf-trans-package, which points you to this: https://wwwimages2.adobe.com/content/dam/acom/en/devnet/pdf/pdf_reference_archive/pdf_reference_1-7.pdf – Steven B. Segletes Sep 17 '20 at 11:50
  • So as you said you are like using some LaTeX code to act on the pdf output, am I right? But is there a way to use a procedure that starts and ends in LaTeX, or the only way to do this is to create a package? Thanks P.S. the example file is very clear – Rob Tan Sep 17 '20 at 12:11
  • I found an issue!! The '\mathb' command seems to do not work with '\textcolor', which I use a lot to get oriented between formulas; is it solvable? – Rob Tan Sep 17 '20 at 12:20
  • 1
    @Rob The color of the border is set with my provided macro \bordercolor. Remember, this technique uses a pdf special...it operates outside of the normal LaTeX rules. – Steven B. Segletes Sep 17 '20 at 12:37
  • Yes, now it works! Maybe is a bit bruce force as you said, but for the moment it works, thanks a lot! – Rob Tan Sep 17 '20 at 13:11
  • 1
    @Rob In the pdf world, color is not set with terms like red!50, etc. The \colsplit macro converts the given "LaTeX" color into the equivalent "PDF" color syntax. So if you execute \colsplit{1}{red}, the value of \bordercol will contain 1 0 0 RG. If you pass it cyan as the color, \bordercol will be set to 1 0 0 0 K, referring to the cmyk color schemes. The challenge in developing this approach was in developing macros like \colsplit to do the color conversions. – Steven B. Segletes Sep 17 '20 at 13:30
  • @StevenB.Segletes Your suggestion is wonderful, and the author of the package cmathbb tells that he'll update font with Greek symbols in his next release, once he fix that, will update the package soon... – MadyYuvi Sep 22 '20 at 13:03
  • @MadyYuvi Thank you for the nice words. – Steven B. Segletes Sep 22 '20 at 13:19
  • This is awesome, thanks so much! I am using this for a bbb \Pi letter. Small problem I have is: the pdf looks fine in VSCode, but not in Preview (I am running MacOS; there the \Pi looks like a normal \Pi, not the nice bbb \Pi) nor in Acrobat Reader (there the page is blank starting at the bbb \Pi); also, when I try to reduce its size with gs the bbb \Pi is absent. Any idea? Thanks again! – Martin Jun 30 '23 at 14:36
  • @Martin I have no advice to give, other than to note that sometimes different PDF viewers perform differently. I'll note that I have no problem with the result on Acrobat Reader. – Steven B. Segletes Jul 01 '23 at 15:02
  • 1
    OMG, I just diffed your answer and the code I copy-pasted, and somehow I had \tmpB{\tmpB#1#2} instead of \tmpB{\tmpB#1#2 }, which somehow seems to break the pdf…problem solved. Thanks again so much! – Martin Jul 02 '23 at 10:57
  • @Martin Take for example, \fillcolor{white!60!red}. With the space in the \tmpB definition, the value of \tmpB coming out of \colsplithelp is a valid color 1 0.6 0.6 rg. With the space not in the \tmpB definition, the exiting value of \tmpB becomes 10.60.6rg, which is not a valid color definition. This value is inserted, by way of \fillcol into the argument of the \boxgs call (a pdfspecial). – Steven B. Segletes Jul 02 '23 at 19:23
3

A very simple solution:

\documentclass[a4paper,12pt]{article}
\usepackage[outline]{contour}
\newcommand*{\fancy}[1]{{\color{white}\contour{black}{#1}}}
\begin{document}
\fancy{$\Gamma\Delta$}$\Gamma$$\Delta$\fancy{$\Xi\Theta\Delta$}
\end{document}

enter image description here

Denis
  • 5,267
  • Seems nice, but I can't make it work in my document! – Rob Tan Sep 22 '20 at 17:14
  • 1
    @Rob If you add aMWE showing the problem, I can try to see what is going on. – Denis Sep 22 '20 at 18:57
  • @Rob Forgot to say: I was assuming that you wanted to compile with pdfLaTeX. – Denis Sep 22 '20 at 19:03
  • Yes now it works, maybe yesterday, smartly, I forgot to use 'contour' package. Your solution is very clever; the only thing that perplex me is the fact that a math ambient should be used inside '\fancy' command; anyway, the command itself works fine, for example I can do '$\fancy{$A$}^\alpha$. Thanks! – Rob Tan Sep 23 '20 at 07:50
  • 1
    @Rob Fine. Yes the syntax is a bit clumsy but works fine. If you only need a few mathbb greek letters defining a command is the way to go to be sure the syntax is OK. – Denis Sep 23 '20 at 08:05
2

Blackboard bold letters used to be faked by (over)printing the base letter with a slight displacement, like this old FAQ on (La)TeX:

 A set of LaTeX macros for a ``lazy person's'' blackboard bold are:
       \newcommand{\R}{{\sf R\hspace*{-0.9ex}\rule{0.15ex}%
       {1.5ex}\hspace*{0.9ex}}}
       \newcommand{\N}{{\sf N\hspace*{-1.0ex}\rule{0.15ex}%
       {1.3ex}\hspace*{1.0ex}}}
       \newcommand{\Q}{{\sf Q\hspace*{-1.1ex}\rule{0.15ex}%
       {1.5ex}\hspace*{1.1ex}}}
       \newcommand{\C}{{\sf C\hspace*{-0.9ex}\rule{0.15ex}%
       {1.3ex}\hspace*{0.9ex}}}

You'd have to tweak your own fakes.

vonbrand
  • 5,473
  • Thanks for the answer, but the way the letters seem is very far from how I wanted it to be and I have no idea how to make it better! – Rob Tan Sep 17 '20 at 08:14
  • 2
    @Rob, as stated, this is a very rough approximation. Making them better looking requires designing a font. – vonbrand Sep 17 '20 at 09:30
1

If you have an outline font, in TrueType or OpenType, that supports Greek letters, you can load it in unicode-math with

\setmathfontface\varbb{SomeFont-Outline.otf}[
  Scale=MatchUppercase]

Unfortunately, I don’t have a good example at hand of a free outline font with Greek letters.

One disadvantage of doing things this way is that unicode-math might try to find the Unicode mathematical alphanumeric symbols (such as U+1D8FC, ) instead of the regular Greek letters (such as U+03B1, α). Since you’re loading a display font, not a math font, it will only have the regular letters. To work around this, you might need to type \varbb{\mupalpha}, \varbb{\mupTheta} and so on instead of \varbb{\alpha}. Or I guess you could write a function in expl3 to remap the input.

The \symbfup or \symbfit alphabet might be a good substitute. In PDFTeX, the isomath package also allows you to select an OML font, which support Greek, for your bold upright and bold italic alphabets.

Davislor
  • 44,045
  • I think I understood most of it, but sorry I don't get "You might additionally want to have the command select \symup, so that \varbb{\Theta} looks for the correct Unicode character. Otherwise, you might need to write \varbb{\mupTheta}." I tried for example to read here http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/unicode-math/unicode-math.pdf but I don't get what '\symup' command should do – Rob Tan Sep 22 '20 at 13:27
  • @Rob That paragraph wasn’t correct and I’ve changed it. – Davislor Sep 22 '20 at 21:38
  • Now I understand better, but as you say the problem is to find the font! – Rob Tan Sep 23 '20 at 07:57
  • 1
    @Rob It’d be possible to start with the bold Greek letters of Latin Modern Math, or maybe CMU Serif, and turn them into an outline or stencil. – Davislor Sep 23 '20 at 11:11
  • Sure, but I have no idea how ahah is it something like the main answer of the question? – Rob Tan Sep 23 '20 at 11:54