9

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 07 '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 07 '14 at 20:51
  • 1
    One could use the schwa symbol with tipa, but it wouldn't be sans-serif. – Sverre Nov 07 '14 at 20:53
  • If the answer turns out to be that I can have only one wish at a time, sans-serif is more important than upright. – thecommexokid Nov 07 '14 at 20:57
  • 1
    Check the answers here. http://tex.stackexchange.com/q/27527/24974 – erik Nov 07 '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 07 '14 at 21:39
  • @barbarabeeton Yes, of course. I just thought of the schwa symbol from tipa as something approximating what the OP is after. And you'd be surprised, or horrified, by how often I've seen the mathematical partial symbol instead of the schwa in linguistics texts :) – Sverre Nov 07 '14 at 22:15
  • @Sverre -- partial instead of schwa?!? that is horrifying! (i hope i never have the dubious pleasure!) – barbara beeton Nov 07 '14 at 22:23
  • what do you mean by "sans-serif" partial? I don not see any serifs in this sign. – MaxNoe Nov 07 '14 at 22:37
  • @MaxNoe I added an image to the post to clarify. Notice the slant, the varying stroke thickness, and the ball at the tip of the LaTeX version. I would ideally prefer something like the Helvetica version, which is upright and a single thickness throughout, as typical of a sans-serif font. – thecommexokid Nov 07 '14 at 22:49

3 Answers3

12

Partial solution.

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

enter image description here

Manuel
  • 27,118
  • 5
    Pun ~ intended. – Manuel Nov 07 '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 09 '14 at 07: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 09 '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 09 '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 09 '14 at 20:50
  • Since I can't seem to make any of the more general solutions work for me, and since I personally don't foresee needing sans-serif versions of any other nonalphanumeric characters besides \partial in the future, I'm going to go ahead and accept your original thinking-outside-the-box answer and not spend any more time on the issue. – thecommexokid Nov 09 '14 at 21:45
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.

erik
  • 12,673
  • \usepackage{cmbright} will typeset the entire document in sans-serif, no? – thecommexokid Nov 09 '14 at 07: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 09 '14 at 08: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 09 '14 at 20:03
  • 1
    It doesn't use \displaystyle but \textstyle. You should take a look at \mathpalette and \mathchoice. – Manuel Nov 09 '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 09 '14 at 20:28
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 09 '14 at 08:04
  • I am using up-to-date TeXLive 2014 and version 3.31 of the kpfonts. –  Nov 09 '14 at 08:41