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

  • LaTeX
  • Thread starter Dragonfall
  • Start date
  • Tags
    Latex
In summary, the conversation discusses the desire to redefine the \mathbf command to have a different font. However, there are concerns about overriding existing definitions and it is suggested to find a different approach to achieve the desired formatting.
  • #1
Dragonfall
1,030
4
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
  • #2
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?
 
  • #3
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.
 
  • #4
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.
 
  • #5
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.
 
  • #6
Alright, thanks everyone.
 

What is \mathbf in LaTeX and how is it used?

\mathbf is a command in LaTeX that is used to make text or symbols appear in bold font. It is commonly used in mathematical equations and formulas.

How can I redefine \mathbf for a custom font?

To redefine \mathbf for a custom font, you can use the \renewcommand{\mathbf}{\fontfamily{customfont}\selectfont} command, where "customfont" is the name of the font you want to use.

Why isn't the custom font showing up when I use \mathbf?

There could be a few reasons for this. First, make sure you have properly installed the custom font on your computer. Also, ensure that you have correctly specified the font name in the \renewcommand{\mathbf}{} command. If the issue persists, try clearing your LaTeX cache and recompiling the document.

Can I use multiple custom fonts with \mathbf in the same document?

Yes, you can use multiple custom fonts with \mathbf in the same document by redefining the command for each font. Make sure to use a different name for each font in the \renewcommand{\mathbf}{} command.

Are there any common troubleshooting tips for redefining \mathbf in LaTeX?

One common troubleshooting tip is to check for any typos or errors in the font name or command. You should also make sure that the font is compatible with LaTeX and has been properly installed. If you are still having issues, try consulting online forums or reaching out to other LaTeX users for assistance.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
789
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
943
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
879
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
974
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top