9

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

\usepackage{cmbright}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pxfonts}

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:

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

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)?

3
  • 4
    \DeclareMathOperator (from amsmath) is your friend. Apr 24, 2013 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, 2013 at 18:24
  • @Mico: Cool. Thanks for the tip. I'll see how it turns out. Apr 25, 2013 at 19:20

1 Answer 1

12

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

\documentclass{article}
\usepackage{cmbright}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pxfonts}

\DeclareMathOperator{\logit}{logit}

\begin{document}

\begin{gather}
\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)
\end{gather} 

\end{document}

enter image description here

1
  • A cleaner solution might be to use \mathrm{logit}.
    – bob
    Sep 11, 2022 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .