On 2018-11-07, Patrick Dupre wrote:



>> On 2018-11-07 07:21, Patrick Dupre wrote:
>> > Hello,
>> > 
>> > I used to use small formula in section or sub-section title.
>> > Unfortunately, if latex manage the font of the Titles (by typically
>> > using a bold font) for the regular text, it just use the "standard"
>> > font for the formula.
>> > The transition from bold to regular is just ugly. Is there a way to
>> > coordinate the fonts?
>> > 
>> > Thank.

>> Hi,

>> Just to be sure: So just using \boldsymbol manually for formulas in the 
>> title and headings does not work for you, right? You want it to switch 
>> automatically whenever the surrounding text is bold?

>> Daniel

> Yes, I could edit each formula of the section title, but I would like to find
> an automatic way to have these formula, let say in \boldsymbol.
> Actually, my formula are already in \rm (Chemistry formula for example).
> They cannot be switched in \boldsymbol, but probably in \mathbf

The LaTeX tool for adapting a math formula to bold text style is switching to
the math version "bold" *before* the formula.
http://ctan.math.washington.edu/tex-archive/macros/latex2e/contrib/isomath/isomath.html#math-font-selection

The switch is valid until another \mathversion command or the end of the
current group (e.g. a section command argument):

\documentclass[]{article}
\begin{document}

\section{$\mathrm{H_20}$ \mathversion{bold} $\mathrm{H_20}$}

back to normal math version $\mathrm{H_20}$
switch to bold math version \mathversion{bold} 
test $\mathrm{H_20}$

\end{document}

Some symbols don't exist in a bold version, so it may become a strange mix
of bold and normal characters, though.


There are packages that allow to define a default command for each section,
so you can automate the math version switch. If you are using the
KOMA-Script document classes, see their documentation for details.

Hope this helps,

Günter

Reply via email to