I'm using the following commands in my preamble to get the fonts I want:


I recently found that, in math mode, when I use the command \log or \exp (as opposed to \text{log} or \text{exp}), the logarithmic and exponential functions get resolved in the math font I want to use (pxfonts). However, I often use other functions such as "logit" and "expit", for example:

\text{logit} \Bigg \{ P(Y = 1| X = x) \Bigg \} = \beta_0 + s(x), 

In this case, "logit" resolves in the font used in the main text (cmbright), which stands out as somewhat of an eyesore. Is there a way I can create functions \logit and \expit that, in math mode, will return "logit" and "expit" using the desired math font (pxfonts) and not the main text font (cmbright)?

  • 4
    \DeclareMathOperator (from amsmath) is your friend. – Gonzalo Medina Apr 24 '13 at 13:53
  • Not related directly to your question, but hopefully still useful: Instead of \Bigg \{ P(Y = 1| X = x) \Bigg \}, you may want to write \bigl\{\, P(Y = 1\mid X = x) \,\bigr\}. If you really need the curly braces to be bigger than \big, try \Big -- but not \Bigg. – Mico Apr 24 '13 at 18:24
  • @Mico: Cool. Thanks for the tip. I'll see how it turns out. – Ashley Naimi Apr 25 '13 at 19:20

You can use \DeclareMathOperator from amsmath; this will also give you the right spacing:




\text{logit} \Bigg \{ P(Y = 1| X = x) \Bigg \} = \beta_0 + s(x)\\
\logit \Bigg \{ P(Y = 1| X = x) \Bigg \} = \beta_0 + s(x)


enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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