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.

The eulervm package documentation indicates that one should use \mathbold instead of \mathbf to produce bold maths.

Could one write \renewcommand{\mathbf}{\mathbold}? What are the side effects?

share|improve this question
    
Welcome to TeX.SE. Since these require a parameter, you'll need to use \let\mathbf\mathbold, or use letltxmacro. –  Peter Grill Jul 12 '12 at 0:33
    
Thank you Peter for the answer. The renewcommand as I stated does work. I have tested it. I guess my question was more about the reason for introducing \mathbold. I am no expert on fonts in LaTeX. –  Pierre Jul 12 '12 at 0:59
1  
@PeterGrill The \renewcommand method is perfectly good; why shouldn't it be? There's no requirement that a renewed command should have the same number of arguments as the original. –  egreg Jul 12 '12 at 8:53
    
@egreg: I realize that it works in this case, but I find is confusing that then you have a definition as \renewcommand{\foo}{} which sort of implies there are no parameters, but needs to be used as \foo{}. Using \renewcommand{\foo}[1]{#1} clarifies that. Also using the let syntax it is not confusing as then just a new name is being redefined. I prefer to make the intent clearer even if it requires more characters to minimize any potential confusion –  Peter Grill Jul 12 '12 at 17:07
    
@PeterGrill The two commands don't take arguments! It may be confusing, but it's really the best way to cope with this problem. –  egreg Jul 12 '12 at 17:34
add comment

2 Answers 2

up vote 3 down vote accepted

The standard definition for \mathbf is

\DeclareMathAlphabet{\mathbf}{OT1}{cmr}{bx}{n}

This has the effect that math symbols declared as \mathalpha (essentially Latin letters, uppercase Greek letters, digits and accents) that happen to be in the argument of \mathbf are typeset from the stated font.

The eulervm package uses a different font for bold:

\DeclareMathAlphabet{\mathbold}{U}{zeur}{b}{n}

and also redeclares many symbols (for instance, also lowercase Greek letter are allowed in the argument of \mathbold).

Since the effect of \mathbold is different from \mathbf it's a good decision to use a different name. However

\renewcommand{\mathbf}{\mathbold}

is perfectly safe. What happens is that when TeX sees \mathbf it replaces it by \mathbold and then proceeds to look for the arguments to \mathbold. (Actually, as Werner showed, there's no argument to \mathbold, but this is immaterial.)

With this redefinition you lose the original meaning of \mathbf, but using eulervm it doesn't seem to be important. Would you keep it for some reason, it's better to say

\usepackage{letltxmacro}
\LetLtxMacro{\originalmathbf}{\mathbf}

before redefining \mathbf.

share|improve this answer
    
Thank you very much for your very clear answer. –  Pierre Jul 12 '12 at 13:38
add comment

Yes you can write \renewcommand{\mathbf}{\mathbold}. Why? Let's look at the definitions of both (using a definition of \pshow from The definitions of LaTeX commands on the UK TeX FAQ):

\documentclass{article}
\def\pshow#1{{\let\protect\show #1}}% http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ltxcmds
\pshow\mathbf
\usepackage{eulervm}% http://ctan.org/pkg/eulervm
\pshow\mathbold
\makeatletter
\show\select@group
\makeatother
\begin{document}
Dummy text.
\end{document}

yields in the .log:

> \mathbf =macro:
->\select@group \mathbf  \M@OT1 \OT1/cmr/bx/n .
\mathbf ->\protect \mathbf  

l.3 \pshow\mathbf


(c:/texlive/2011/texmf-dist/tex/latex/eulervm/eulervm.sty
Package: eulervm 2005/01/11 v4.0 (WaS)
)
> \mathbold =macro:
->\select@group \mathbold  \M@U \U/zeur/b/n .
\mathbold ->\protect \mathbold  

l.5 \pshow\mathbold


> \select@group=macro:
#1#2#3#4->\ifx \math@bgroup \bgroup \else \relax \expandafter \@firstofone \fi 
{\ifmmode \ifnum \csname c@mv@\math@version \endcsname <\sixt@@n \begingroup \e
scapechar \m@ne \getanddefine@fonts {\csname c@mv@\math@version \endcsname }#3\
globaldefs \@ne \math@fonts \endgroup \init@restore@version \xdef #1{\noexpand 
\use@mathgroup \noexpand #2{\number \csname c@mv@\math@version \endcsname }}\gl
obal \advance \csname c@mv@\math@version \endcsname \@ne \else \let #1\relax \@
latex@error {Too many math alphabets used in version \math@version }\@eha \fi \
else \expandafter \non@alpherr \fi #1{#4}}.
l.7 \show\select@group

Note that neither \mathbf nor \mathbold take an argument. There is a secondary macro called from both \mathbf and \mathbold that takes the argument supplied: \select@group. The first three arguments taken by \select@group is supplied within \mathbf and \mathbold, while the fourth is supplied additionally after each macro.

What are the side effects? You can't use the original definition of \mathbf. Some people circumvent this by using

\let\oldmathbf\mathbf% Store contents of \mathbf in \oldmathbf
\let\mathbf\mathbold% Rename \mathbf to \mathbold
share|improve this answer
1  
The fact that \mathbf and \mathbold don't have arguments is irrelevant. With \renewcommand{\mathbf}{\mathbold} you just tell TeX to change the former into the latter when expanding macros; only after this replacement TeX will start looking for arguments to \mathbold (of which there aren't, but it's another matter). –  egreg Jul 12 '12 at 8:55
    
@Werner Thanks for explaining how these commands work. –  Pierre Jul 12 '12 at 13:56
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.