8

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

  • If it's sans-serif and upright, is it still the partial symbol? – Sverre Nov 7 '14 at 20:46
  • 1
    @Sverre: French traditional typography typesets partial symbol in upright shape. So I would say the answer is ‘yes’. – Bernard Nov 7 '14 at 20:51
  • 1
    One could use the schwa symbol with tipa, but it wouldn't be sans-serif. – Sverre Nov 7 '14 at 20:53
  • 1
    Check the answers here. tex.stackexchange.com/q/27527/24974 – erik Nov 7 '14 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. – barbara beeton Nov 7 '14 at 21:39
11

Partial solution.

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

enter image description here

  • 5
    Pun ~ intended. – Manuel Nov 7 '14 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. – thecommexokid Nov 9 '14 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. – Manuel Nov 9 '14 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? – thecommexokid Nov 9 '14 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). – Manuel Nov 9 '14 at 20:50
5
\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.

  • 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. – thecommexokid Nov 9 '14 at 8:04
  • I am using up-to-date TeXLive 2014 and version 3.31 of the kpfonts. – user2478 Nov 9 '14 at 8:41
5

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.

  • \usepackage{cmbright} will typeset the entire document in sans-serif, no? – thecommexokid Nov 9 '14 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? – thecommexokid Nov 9 '14 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. – erik Nov 9 '14 at 20:03
  • 1
    It doesn't use \displaystyle but \textstyle. You should take a look at \mathpalette and \mathchoice. – Manuel Nov 9 '14 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. – thecommexokid Nov 9 '14 at 20:28

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.