10

How can I typeset a partial derivative symbol (∂) in an upright, sans-serif font?

I am using pdfLaTeX. I know this problem could be solved easily by switching to another engine — and feel free to post XeLaTeX or LuaLaTeX solutions for the benefit of posterity if you wish — but I am specifically looking for a solution within pdfLaTeX.


Edited to add an image to contrast what LaTeX generates with what I want:

partial derivative symbol in LaTeX and in Helvetica Neue

10
  • If it's sans-serif and upright, is it still the partial symbol? Commented Nov 7, 2014 at 20:46
  • 1
    @Sverre: French traditional typography typesets partial symbol in upright shape. So I would say the answer is ‘yes’. Commented Nov 7, 2014 at 20:51
  • 1
    One could use the schwa symbol with tipa, but it wouldn't be sans-serif. Commented Nov 7, 2014 at 20:53
  • 1
    Check the answers here. tex.stackexchange.com/q/27527/24974 Commented Nov 7, 2014 at 21:01
  • 2
    @Sverre -- schwa isn't a partial symbol; it's a rotated lowercase "e". for anyone who has had any exposure to phonetics it definitely wouldn't be recognized as a partial symbol. Commented Nov 7, 2014 at 21:39

6 Answers 6

16

Partial solution.

\usepackage{graphicx}
\renewcommand*\partial{\textsf{\reflectbox{6}}}

enter image description here

6
  • 7
    Pun ~ intended. Commented Nov 7, 2014 at 23:24
  • Wow, I love it for sheer cheek. I probably should choose a more generalizable solution as my accepted answer, but this is an amazingly clever one-liner quick fix. Commented Nov 9, 2014 at 7:49
  • 1
    Well, @thecommexokid, you didn't say what font you where using, so I guessed that (at least) you tried with cmbright and you didn't like the partial of that font, so I improvised a new one. In case you want the partial from that font (or whatever font you choose), the answer to your question is here. Commented Nov 9, 2014 at 15:27
  • I am trying to understand the answers of the question you linked to. It seems as though I will need to know the character number of the \partial character within cmbright; how do I find that? Commented Nov 9, 2014 at 20:46
  • 1
    That's something I don't control pretty well, but doing a \meaning\partial inside a document, it will print its definition: in this case \mathchar"140. So, if I were to guess a number I would say "140 :) I don't know how “people” in this site get/know those numbers, but in my case that's the only way I know (in case you are happy with the .log may be you prefer to use \show\partial rather than \meaning\partial). Commented Nov 9, 2014 at 20:50
8

How about using cmbright to get sans serif math and rotating the \partial?

\documentclass{article}
\usepackage{cmbright}
\usepackage{graphicx}
\newcommand{\upartial}{\rotatebox[origin=c]{15}{\ensuremath{\partial\mkern-2mu}}}
\begin{document}
\[\frac{\partial x}{\partial t}\quad\textnormal{vs.}\quad\frac{\upartial x}{\upartial t}\]
\end{document}

Edit:

One can get cmbright only in math mode with the following code. However, in doing so I discovered this solution is not very robust. As you can see in the image, the upright \partial gets typeset in \displaystyle despite being inside \(...\).

enter image description here

Code:

\documentclass{amsart}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern,cmbright}
\renewcommand*\familydefault{\rmdefault}
\usepackage{graphicx}
\newcommand{\upartial}{\mathsurround=0pt \rotatebox[origin=c]{15}{$\partial\mkern-2mu$}}
\begin{document}
Normal vs.\ upright partial: \(\frac{\partial x}{\partial t}\) vs.\ \(\frac{\upartial x}{\upartial t}\)
\end{document}

Note: I've also changed the definition of \upartial after reading @egreg's answer here, but the inline math problem persists.

5
  • \usepackage{cmbright} will typeset the entire document in sans-serif, no? Commented Nov 9, 2014 at 7:51
  • To clarify: I have no objection to using cmbright for my sans-serif font, and I like the look of the symbols in your screenshot the best of any of the suggested solutions. But my document is a mixture of serif and sans-serif type, so it is unacceptable to switch the whole document to cmbright. Is there a way to use cmbright only for my sans-serif needs? Commented Nov 9, 2014 at 8:12
  • @thecommexokid I've modified my answer to produce only sans serif math, but in doing so I found an issue with my proposed solution. Commented Nov 9, 2014 at 20:03
  • 1
    It doesn't use \displaystyle but \textstyle. You should take a look at \mathpalette and \mathchoice. Commented Nov 9, 2014 at 20:08
  • 1
    Re: "One can get cmbright only in math mode with the following code." Thank you for the attempted fix, but alas this is still not what I am trying to do. I do not wish to typeset all the math in my document in sans-serif, only some individual characters. All I want is \somecommand that does what I had naively expected \mathsf{\partial} to do. It's fine to use cmbright for all my sans-serif in the document; it's not fine to use it for all my math. Commented Nov 9, 2014 at 20:28
6
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\def\uppartial{{\mathversion{sf}\ensuremath{\partialup}}}
\begin{document}
$\partial$ partial derivative symbol in \LaTeX

\sffamily
\uppartial{} partial derivative symbol in \LaTeX
\end{document}

enter image description here

You can also use \usepackage[partialup]{kpfonts} if you do not need the default version. Then \partial is upright by default.

2
  • Hm. For me, the \mathversion{sf} in this definition seems to have no effect, and I am getting a symbol that, while it is upright, matches the style of the serif font family. It looks better in your picture. Commented Nov 9, 2014 at 8:04
  • I am using up-to-date TeXLive 2014 and version 3.31 of the kpfonts. Commented Nov 9, 2014 at 8:41
5

In 2024, if you're willing to use LuaLaTeX, XeLaTeX, ConTeXt, OpTeX, or any engine which supports OpenType Math, you can use the New Computer Modern Sans Math font.

\documentclass{article}

\PassOptionsToPackage{math-style=ISO, bold-style=ISO, sans-style=italic, nabla=upright, partial=upright, warnings-off={mathtools-colon,mathtools-overbracket}}{unicode-math}
\usepackage[sansdefault]{fontsetup}
\usepackage[sans]{dsfont}
\let\symbb\mathds
\let\mathbb\mathds
\renewcommand{\i}{\symup{i}}
\renewcommand*{\hbar}{\mathrm{^^^^0127}}

\begin{document}
    The position space Schrödinger equation for a single non-relativistic particle in one dimension is
    \[
        -\i \hbar \frac{\partial}{\partial t} \Psi (x, t) = \bigg[-\frac{\hbar^2}{2m} \frac{\partial^2}{\partial x^2} + V(x, t)\bigg]\Psi(x, t).
    \]
\end{document}

schrodinger equation in one dimension for a single particle newcm sans math font specimen with upright partial

1
  • Dunno why this question suddenly got so much action a decade after I asked it. But can you demonstrate how to use a mixture of serif and sans serif math in one document? This looks like it turns all math in the whole document sans serif, which was not what I was trying to do back then. Commented Dec 30, 2024 at 16:08
2

With Open Type math font Lete Sans Math:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{LeteSansMath.otf}[partial=upright]
\begin{document}

\[\frac{\partial f}{\partial x} = \frac{\partial f}{\partial y}\]

\end{document}

enter image description here

If you only want \partial to be in sans-serif style, you can use the range option provided by unicode-math:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfont{LeteSansMath.otf}[range={\partial}]
\begin{document}
$\frac{\partial f}{\partial x} = \frac{\partial f}{\partial y}$
\end{document}

enter image description here

3
  • Dunno why this question suddenly got so much action a decade after I asked it. But can you demonstrate how to use a mixture of serif and sans serif math in one document? This looks like it turns all math in the whole document sans serif, which was not what I was trying to do back then. Commented Dec 30, 2024 at 16:08
  • @thecommexokid Updated Commented Dec 31, 2024 at 3:47
  • Related link: tex.stackexchange.com/a/324207/241621 Commented Dec 31, 2024 at 4:04
0

A solution with sansmathfonts:

enter image description here

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{sansmathfonts}
\begin{document}
\begin{align}
    % Linear wave equation
    \frac{\partial u}{\partial t} + c \frac{\partial u}{\partial x} &= 0, \quad \text{(linear wave equation)} \\
    % Wave equation
    \frac{\partial^2 u}{\partial t^2} - c^2 \frac{\partial^2 u}{\partial x^2} &= 0, \quad \text{(wave equation)} \\
    % Gauss's law in differential form
    \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0}, \quad \text{(Gauss's law in differential form)} \\
    % Laplace's equation
    \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} &= 0, \quad \text{(Laplace's equation)}.
\end{align}
\end{document}
1
  • Dunno why this question suddenly got so much action a decade after I asked it. But can you demonstrate how to use a mixture of serif and sans serif math in one document? This looks like it turns all math in the whole document sans serif, which was not what I was trying to do back then. Commented Dec 30, 2024 at 16:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.