Redefine \mathbf in LaTeX for Custom Font - Tips and Troubleshooting

  • Context: LaTeX 
  • Thread starter Thread starter Dragonfall
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion revolves around redefining the \mathbf command in LaTeX to use a custom font. Participants explore the implications of overriding existing commands and suggest alternative approaches for achieving the desired formatting.

Discussion Character

  • Technical explanation, Debate/contested, Conceptual clarification

Main Points Raised

  • One participant suggests using \renewcommand to redefine \mathbf, but cautions against overriding existing macros due to their established meanings.
  • Another participant expresses a desire to change the font used by \mathbf to a combination of textsf and textbf for a less aggressive appearance, considering the option of manually replacing instances instead of redefining the command.
  • A different approach proposed involves creating a custom LaTeX command to achieve the desired formatting and using an editor command or script to replace instances of mathbf.
  • One participant recommends overriding the command using \DeclareMathAlphabet to set a preferred font definition, aligning with how LaTeX manages defaults.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to redefine \mathbf, with multiple competing views and methods discussed.

Contextual Notes

Some limitations include the lack of clarity on the underlying problem that prompted the desire to change \mathbf, as well as the potential implications of redefining established commands in LaTeX.

Who May Find This Useful

Users interested in customizing LaTeX document formatting, particularly those looking to redefine mathematical font commands.

Dragonfall
Messages
1,023
Reaction score
5
I want to redefine \mathbf to have a different font. I can't seem to make \newcommand work since it says "already defined". Help?
 
Physics news on Phys.org
It's \renewcommand.

Don't use it lightly. It's usually much better to define your own macros as opposed to overriding macros whose definitions have deep meaning.

This looks like an "XY" problem. Underneath the hood you are facing problem X, something about which you haven't told us a single word. You somehow see that approach Y is a solution to your underlying problem, so you ask how to do Y. It's usually much better is to ask us about X directly.

So, what's your real problem, and what is motivating you to want to change \mathbf?
 
I've used \mathbf throughout a very long work, and I want to change the font from what it is to textsf+textbf, which looks less... aggressive. I suppose I could just change every \mathbf instead redefining them.
 
I'd make a custom LaTeX command to get the desired formatting and then use an editor command or sed or something to replace mathbf.
 
What jhae said. But if you really want to do this, it would be better to do it the same way that LaTeX sets the default, i.e. override the command
Code:
\DeclareMathAlphabet      {\mathbf}{OT1}{cmr}{bx}{n}
with your preferred font definition.
 
Alright, thanks everyone.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K