76

I would like to make a partial differential equation by using the following notation:

dQ/dt

(without / but with a real numerator and denomenator). Earlier today I got help from this page on how to u_t, but now I also have to write it like dQ/dt. I understand how it can be done by using dollarsigns and fractions, but is it possible to do it using

\begin{equation}
....
\end{equation}

so that it can be on separate lines and using math-style?

  • See also cool: "The pack­age (COn­tent Ori­ented LaTeX) gives LaTeX the power to re­tain mathemat­i­cal mean­ing of its ex­pres­sions in ad­di­tion to the typsetting in­struc­tions; es­sen­tially sep­a­rat­ing style from the con­tent of the math." – Mike Renfro Jan 29 '15 at 14:20
110

You said partial differential equation:

\documentclass{article}
\begin{document}
\begin{equation}
\frac{\partial Q}{\partial t} = \frac{\partial s}{\partial t}
\end{equation}
\end{document}

enter image description here

now using physics package, extra goodies (bonus):

\documentclass{article}
\usepackage{physics}
\begin{document}
\[
\dv{Q}{t} = \dv{s}{t}  \quad
\dv[n]{Q}{t} = \dv[n]{s}{t}  \quad
\pdv{Q}{t} = \pdv{s}{t}  \quad
\pdv[n]{Q}{t} = \pdv[n]{s}{t}  \quad
\pdv{Q}{x}{t} = \pdv{s}{x}{t}  \quad
\]
\[
\fdv{F}{g}
\]
\end{document}

enter image description here

  • 1
    Thank you very much for both answers! Both of them worked perfect. – David Jan 29 '15 at 13:24
  • I also tried the second option you gave, but when I had written \usepackage{physics} at the top of the document, I got this as an output: ! LaTeX Error: File `physics.sty' not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: – David Jan 29 '15 at 13:43
  • What should I enter as file name? – David Jan 29 '15 at 13:43
  • 2
    @David It means you don't have physics package installed. Please install it. – user11232 Jan 29 '15 at 13:57
  • Note that we can italicize the d's using \usepackage[italicdiff]{physics}. – Mateen Ulhaq Apr 9 '17 at 5:23
6

I now recommend using the cool package:

\documentclass{article}
\usepackage{cool}
\begin{document}
Text:
\[
    \pderiv{u}{t}=\pderiv[2]{u}{x}
\]
More text.
\end{document}

I used to recommend defining a command to make a short form:

\documentclass{article}
% Partial derivative
\newcommand*{\pd}[3][]{\ensuremath{\frac{\partial^{#1} #2}{\partial #3}}}
\begin{document}
Text:
\[
    \pd{u}{t}=\pd[2]{u}{x^2}
\]
More text.
\end{document}

what it looks like

  • 1
    There is rarely a good use of \ensuremath. While there's nothing really wrong with it, it removes semantic meaning without adding much of anything else. See When not to use \ensuremath for math macro? – Paul Gessler Jan 29 '15 at 13:33
  • You do not have to make that square in denominator by hand... you can formulate it in this way: \newcommand{\pdv}[3][]{\frac{\partial^{#1}#2}{\partial {#3}^{#1}}} – Jozef Janočko Feb 19 '16 at 18:27
  • 1
    @JozefJanočko Note that \partial^{}u (the default in your solution) will give more spacing compared to \partial u. – sodd Feb 19 '16 at 21:18
1

Try this

\frac{\partial^2 u}{\partial x^2}
  • 3
    This doesn't add anything more than isn't already covered in the other answer(s). – Werner Feb 1 at 19:51
1

Another possibility to write classic derivates or partial derivates I suggest (IMHO), actually, to use derivative package. For my humble opinion it is very good and last release is v0.95b 2019/09/21. Here there are some examples take, some, from the guide:

enter image description here

\documentclass[12pt]{article}
\usepackage{derivative}
\begin{document}
\[
\pdv{f}{x}, \quad \odv{Q}{t}=\odv{s}{t}, \quad \pdv{f}{x,y}, \quad \derivset{\odv}[switch-*=false] \odv{y}{x}, \quad \odv[n]{y}{x}, \quad \derivset{\odv}[misc-add-delims=fun] \odv*{\odv{y}{x}}{x}, \quad \derivset{\pdv}[sort-method={sign,symbol,abs}] \pdv[c+kn,-b+2a]{f}{x,y}
\]
\end{document}

protected by Community Nov 8 at 21:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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