Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I get the output I get without unicode-math using unicode-math, preferably (not necessarily) using the same code (\boldmath)? I would like the solution to work with at least the XITS and Latin Modern fonts, both of which have no build-in bold math font..

edit: I can see attention is fading away. Of course it is not possible to make non-bold fonts 'truly bold', but the output Word produces when you make formulae bold is acceptable, and Cambria Math also doesn't have a bold font. You can even make XITS and Latin Modern bold in math just by pressing CTRL+B. I accept any answer that makes LaTeX behave like Word in this.

Without unicode-math

\documentclass{article}
\begin{document}
  This should be entirely bold: {\boldmath$O(\log n)$} \\
  This should not be bold: $O(\log n)$
\end{document}

I get nice-looking output:

Output without unicode-math.

With unicode-math, the code

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\begin{document}
This should be entirely bold: {\boldmath$O(\log n)$} \\
This should not be bold: $O(\log n)$
\end{document}

gives

With unicode-math 1.

I already tried a bunch of things, for example the following code.

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\setmathfont[range=\mathup/{greek,Greek,latin,Latin,num}]{XITS}
\setmathfont[range=\mathit/{greek,Greek,latin,Latin,num}]{XITS Italic}
\setmathfont[range=\mathbfup/{greek,Greek,latin,Latin,num}]{XITS Bold}
\setmathfont[range=\mathbfit/{greek,Greek,latin,Latin,num}]{XITS Bold Italic}
\begin{document}
This should be entirely bold: {\boldmath$O(\log n)$} \\
This should not be bold: $O(\log n)$
\end{document}

Which unfortunately gives me this:

With unicode-math 2.

Word output looks like this:

enter image description here.

share|improve this question
    
shouldn't this be ${\boldmath O(\log n)}$ instead? –  pluton May 11 '12 at 14:44
3  
There is no "XITS Math Bold" font (at the moment), so \boldmath doesn't do anything useful. –  egreg May 11 '12 at 14:57
    
@pluton Nope, \boldmath should be activated outside of math mode. giss.nasa.gov/tools/latex/boldmath.html –  Semafoor May 11 '12 at 14:57
    
@egreg But can't I use regular XITS Bold for the regular latin characters, greek characters and numbers inside of the equation? When I pust XITS Bold and XITS Bold Italic in the \mathup and \mathit range I get the output I want (but then everything is always bold). –  Semafoor May 11 '12 at 15:00
1  
@Semafoor: The only OpenType math font with bold version is Lucida, even Cambria Math (the de-facto standard OT math font) does not have one. I plan to do one for XTIS, but no time for it now (unless someone wants to pay me to do it). On the other hand, patches are welcome :). –  Khaled Hosny May 11 '12 at 17:46
show 6 more comments

2 Answers 2

up vote 3 down vote accepted

A "poor person's \boldmath can be obtained by

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\setmathfont[version=bold,FakeBold=3.5]{XITS Math}

\begin{document}
This should be entirely bold: {\boldmath$O(\log n)$} \\
This should not be bold: $O(\log n)$
\end{document}

I presume that this is how word processors fake bold for fonts not having a real one.

enter image description here

Note: choosing XITS "non math" for math symbols may have adverse effects.

share|improve this answer
    
At this point I'm quite desperate for an answer and this certainly works: I'll probably make this the accepted answer. As you also pointed out earlier, it only works in XeLaTeX. The output doesn't look as nice as the one word produces though (I added the Word output to the original input); this becomes more visible with 'more difficult' equations. –  Semafoor May 12 '12 at 17:59
    
@Semafoor Experiment with the boldness factor. Of course the solution is either non using bold math or getting a font that has real bold math. –  egreg May 12 '12 at 18:13
    
A problem is that, as KhaledHosny pointed out, there is currently only a single font (Lucida) that can be made bold, and it is not free. As someone who's not familiar with how LaTeX/XeLaTeX/... actually works under the hood, I'm surprised to 'lose' this functionality. For me, the best solution probably is reworking my document to no longer depend on unicode-math... But thanks for the effort you put in to solving my question! –  Semafoor May 12 '12 at 18:18
    
@Semafoor: XITS Math now have a bold companion, it needs more work, but you can try it if you feel adventurous. Bug reports are welcomed. Next version of unicode-math will auto-load bold math fonts if avialable. –  Khaled Hosny May 15 '12 at 21:44
    
@KhaledHosny Nice! Works and looks much better than fake bold. I'll try it out next time I have to write a LaTeX document :). –  Semafoor May 19 '12 at 1:17
add comment

When using the package unicode-math, you will find the \bm and \boldsymbol don't work. You can nonetheless specify how you want it to deal with your bold math symbols using an option while loading it. \usepackage[bold-style=ISO]{unicode-math} will give the recommended italic bold math symbols for both greek and latin characters, while \usepackage[bold-style=TEX]{unicode-math} will give upright latin characters. This is explained in the unicode-math documentation.

A mwe:

\documentclass{article}
\usepackage[bold-style=ISO]{unicode-math}
%\usepackage[bold-style=TEX]{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\begin{document}
This is bold and italic $\mathbf{O(\log n)}+\mathbf{O(\lambda,\,\epsilon)}$ where it must :)
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.