3

I am using an amsmath split environment nested in a gather environment in order to obtain a three-lined equation with a single label aligned in center:

\documentclass[11pt, english, singlespacing]{MastersDoctoralThesis}    
\usepackage{palatino} % Use the Palatino font by default
\usepackage{amssymb,amsmath}

\begin{document}
\begin{gather}
\begin{split}
C_V = \left( \frac{\partial E}{\partial T} \right)_V\\
=\sum_{\boldsymbol{k},v}\hbar\omega (\boldsymbol{k},v) \frac{\partial n (\omega,T)}{\partial T}\\
=\sum_{\boldsymbol{k},v}k_B \left( \frac{\hbar\omega(\boldsymbol{k},v)}{k_B T} \right)^2 \frac{e^{\hbar\omega/k_B T}}{\left( e^{\hbar\omega/k_B T}-1 \right)^2 }
\label{eqn:heat_capacity}
\end{split}
\end{gather}
\end{document}

However when i compile the code above it results in the equations being aligned to the right. When i remove the nested split environment, equations are aligned to the center, correctly. Any ideas?

4
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Aug 24, 2017 at 11:51
  • The outer gather is here useless: you can replace it by equation. And if the equations are to be aligned at the equal signs you need &=.
    – campa
    Aug 24, 2017 at 12:00
  • @campa Problem persists even with equation. The equations are needed to be aligned to the center, and that is why i tried with gather at first.
    – gstefk
    Aug 24, 2017 at 12:08
  • @gstefk what exactly do you mean by center and that it does not. Where exactly does not get the MastersDoctoralThesis class? BTW: plesae update your MWE such that one can copy it and it should run as is. For example the \documentclass is placed in the wrong location. Please help us help you.
    – daleif
    Aug 24, 2017 at 12:14

2 Answers 2

4

You can use a gathered environment nested in equation. But I'd rather suggest an alignment with aligned nested in equation (two possibilities of alignment).

I took the opportunity to simplify typing the code for partial derivatives, using the \diff(*) commands from the esdiff package, and improved the placement of exponents after a big parenthesis with \mathclap from mathtools:

\documentclass{article}
\usepackage{mathtools}
\usepackage{esdiff} 

\begin{document}

\begin{equation}
    \label{eqn:heat_capacity}
    \begin{gathered}
    C_V = \diffp*{E}{T}{V} \\
    =\sum_{\boldsymbol{k},v}\hbar\omega (\boldsymbol{k},v) \diffp{n (\omega,T)}{ T}\\[-0.5ex]
    =\sum_{\boldsymbol{k},v}k_B \left( \frac{\hbar\omega(\boldsymbol{k},v)}{k_B T} \right)^{\mathclap{2}} \frac{e^{\hbar\omega/k_B T}}{\left( e^{\hbar\omega/k_B T}-1 \right)^2 }
    \end{gathered}
\end{equation}
\bigskip

\begin{equation}
    \label{eqn:heat_capacity1}
    \begin{aligned}
    C_V & = \diffp*{E}{T}{V} =\sum_{\boldsymbol{k},v}\hbar\omega (\boldsymbol{k},v) \diffp{n (\omega,T)}{ T}\\[-0.5ex]
     & =\sum_{\boldsymbol{k},v}k_B \left( \frac{\hbar\omega(\boldsymbol{k},v)}{k_B T} \right)^{\mathclap{2}} \frac{e^{\hbar\omega/k_B T}}{\left( e^{\hbar\omega/k_B T}-1 \right)^2 }
    \end{aligned}
\end{equation}
\bigskip

\begin{equation}
    \label{eqn:heat_capacity1}
    \begin{aligned}
    C_V = \diffp*{E}{T}{V}& =\sum_{\boldsymbol{k},v}\hbar\omega (\boldsymbol{k},v) \diffp{n (\omega,T)}{ T}\\[-0.5ex]
     & =\sum_{\boldsymbol{k},v}k_B \left( \frac{\hbar\omega(\boldsymbol{k},v)}{k_B T} \right)^{\mathclap{2}} \frac{e^{\hbar\omega/k_B T}}{\left( e^{\hbar\omega/k_B T}-1 \right)^2 }
    \end{aligned}
\end{equation}

\end{document} 

enter image description here

1
  • \gathered within \equation environment was exactly what i needed. Also \diff command was very useful, i was not aware of this package. Thank you a lot!
    – gstefk
    Sep 10, 2017 at 12:11
1

or this:

\documentclass{article}
\usepackage{palatino} % Use the Palatino font by default
\usepackage{amssymb,amsmath}
   \begin{document}
        \begin{equation}
        \begin{split}
        C_V &= \left( \frac{\partial E}{\partial T} \right)_V\\
        &=\sum_{\boldsymbol{k},v}\hbar\omega (\boldsymbol{k},v) \frac{\partial n (\omega,T)}{\partial T}\\
        &=\sum_{\boldsymbol{k},v}k_B \left( \frac{\hbar\omega(\boldsymbol{k},v)}{k_B T} \right)^2 \frac{e^{\hbar\omega/k_B T}}{\left( e^{\hbar\omega/k_B T}-1 \right)^2 }
        \label{eqn:heat_capacity}
        \end{split}
        \end{equation}
    \end{document}

enter image description here

You must log in to answer this question.

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