2

I used an aligned subequations environment, but for some reason my equations are aligned at the right side of the paper and falling off. I want them to be centered, and aligned at the = sign, with the equation number not below but at the right side of the equation. This is my code:

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz} %for simple drawings and diagram
\usetikzlibrary{fit,shapes.geometric}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usepackage{pgfplots}
\usepackage{caption}
\usepackage{subcaption}

%page numbering abstract
\usepackage{etoolbox}
\patchcmd{\abstract}{\titlepage}{\clearpage}{}{}
\patchcmd{\andabstract}{\endtitlepage}{\clearpage}{}{}

%for bibliography
\usepackage{natbib}
\bibliographystyle{apa}

%Includes "References" in the table of contents
\usepackage[nottoc]{tocbibind}

%to use subsections
\usepackage{titlesec}
  \titleformat{\chapter}[hang]
    {\normalfont\huge\bfseries}
    {\thechapter}{20pt}{\huge}

\begin{document}

\chapter{Results}

\section{Elasticity analysis}

\begin{subequations} \allowdisplaybreaks
\begin{align}
\frac{\partial \lambda}{\partial q_{T,1}}&=\frac{q_{T,2}n_Tf_T(1-v)\lambda^3-q_{T,2}n_Tf_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial q_{T,2}}&=\frac{q_{T,1}n_Tf_T(1-v)\lambda^3-q_{T,1}n_Tf_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial q_{L,1}}&=\frac{q_{L,2}n_Lf_L\lambda^3-q_{L,2}n_Lf_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})2\lambda}{denominator} \\
\frac{\partial \lambda}{\partial q_{L,2}}&=\frac{q_{L,1}n_Lf_L\lambda^3-q_{L,1}n_Lf_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})2\lambda}{denominator} \\
\frac{\partial \lambda}{\partial a_{T,1}}&=\frac{s_{T,2}\lambda^3-s_{T,2}(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial s_{T,2}}&=\frac{s_{T,1}\lambda^3-s_{T,1}(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial s_{L,1}}&=\frac{s_{L,2}\lambda^3-(s_{L,2}q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{L,2}s_{T,2}s_{T,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial s_{L,2}}&=\frac{s_{L,1}\lambda^3-(s_{L,1}q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{L,2}s_{T,2}s_{T,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial n_T}&=\frac{q_{T,2}q_{T,1}f_T(1-v)\lambda^3-q_{T,2}q_{T,1}f_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial f_T}&=\frac{q_{T,2}q_{T,1}n_T(1-v)\lambda^3-q_{T,2}q_{T,1}n_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial n_L}&=\frac{q_{L,2}q_{L,1}f_L\lambda^3-q_{L,2}q_{L,1}f_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial f_L}&=\frac{q_{L,2}q_{L,1}n_L\lambda^3-q_{L,2}q_{L,1}n_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})\lambda^2}{denominator} \\
\frac{\partial \lambda}{\partial v}&=\frac{-q_{T,2}q_{T,1}n_Tf_T\lambda^3+q_{T,2}q_{T,1}n_Tf_T(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}\lambda^2}{denominator} \\
\text{with } 
denominator=4\lambda^3-(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}+q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})3\lambda^2 \\
+(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})2\lambda
\end{align}
\end{subequations}
4
  • The widest line specifies the position of the =. In your case the last line (from \text{width } does not contain a & and therefore is at whole the left part of an align row. So you should at least add a & after denominator (which should be \mathrm{denominator} or \mathit{denominator} or even \text{denominator} and also before the * in the last line. Instead of \text{with } I would also suggest \intertext{with }. Alternatively use a separate environment, e.g., gather or split.
    – cabohah
    Mar 1, 2023 at 11:31
  • As an immediate fix, you need to (a) change \text{with} to \intertext{with} and (b) add suitable alignment points in the final two rows.
    – Mico
    Mar 1, 2023 at 11:40
  • Ah that fixed it, thank you!
    – Elaine
    Mar 1, 2023 at 14:19
  • Earlier today, this question got closed as a supposed duplicate of an earlier query. I've reopened this question as I disagree with this assessment: The OP's formatting issue was caused by an entirely different mechanism (identified in the comment I posted above).
    – Mico
    Mar 1, 2023 at 16:53

1 Answer 1

2

I'd avoid those fractions and move the denominators to the left-hand sides. The meaning of D can be in a separate display.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz} %for simple drawings and diagram
\usetikzlibrary{fit,shapes.geometric}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usepackage{pgfplots}
\usepackage{caption}
\usepackage{subcaption}

%page numbering abstract
\usepackage{etoolbox}
\patchcmd{\abstract}{\titlepage}{\clearpage}{}{}
\patchcmd{\andabstract}{\endtitlepage}{\clearpage}{}{}

%for bibliography
\usepackage{natbib}
\bibliographystyle{apa}

%Includes "References" in the table of contents
\usepackage[nottoc]{tocbibind}

%to use subsections
\usepackage{titlesec}

\titleformat{\chapter}[hang]
  {\normalfont\huge\bfseries}
  {\thechapter}
  {20pt}
  {}

\newcommand{\pder}[2]{\frac{\partial#1}{\partial#2}}

\begin{document}

\chapter{Results}

\section{Elasticity analysis}

\begin{subequations} \allowdisplaybreaks
\begin{align}
D\pder{\lambda}{q_{T,1}}&=
  q_{T,2}n_Tf_T(1-v)\lambda^3-q_{T,2}n_Tf_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2 \\
D\pder{\lambda}{q_{T,2}}&=
  q_{T,1}n_Tf_T(1-v)\lambda^3-q_{T,1}n_Tf_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2 \\
D\pder{\lambda}{q_{L,1}}&=
  q_{L,2}n_Lf_L\lambda^3-q_{L,2}n_Lf_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})2\lambda \\
D\pder{\lambda}{q_{L,2}}&=
  q_{L,1}n_Lf_L\lambda^3-q_{L,1}n_Lf_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})2\lambda \\
D\pder{\lambda}{a_{T,1}}&=
  s_{T,2}\lambda^3-s_{T,2}(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}\lambda^2 \\
D\pder{\lambda}{s_{T,2}}&=
  s_{T,1}\lambda^3-s_{T,1}(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}\lambda^2 \\
D\pder{\lambda}{s_{L,1}}&=
  s_{L,2}\lambda^3-(s_{L,2}q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{L,2}s_{T,2}s_{T,1})\lambda^2 \\
D\pder{\lambda}{s_{L,2}}&=
  s_{L,1}\lambda^3-(s_{L,1}q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{L,2}s_{T,2}s_{T,1})\lambda^2 \\
D\pder{\lambda}{n_T}&=
  q_{T,2}q_{T,1}f_T(1-v)\lambda^3-q_{T,2}q_{T,1}f_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2 \\
D\pder{\lambda}{f_T}&=
  q_{T,2}q_{T,1}n_T(1-v)\lambda^3-q_{T,2}q_{T,1}n_T(1-v)(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})\lambda^2 \\
D\pder{\lambda}{n_L}&=
  q_{L,2}q_{L,1}f_L\lambda^3-q_{L,2}q_{L,1}f_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})\lambda^2 \\
D\pder{\lambda}{f_L}&=
  q_{L,2}q_{L,1}n_L\lambda^3-q_{L,2}q_{L,1}n_L(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})\lambda^2 \\
D\pder{\lambda}{v}&=
  -q_{T,2}q_{T,1}n_Tf_T\lambda^3+q_{T,2}q_{T,1}n_Tf_T(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}\lambda^2
\end{align}
where
\begin{multline*}
D=4\lambda^3-(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1}+q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})3\lambda^2 \\
+(q_{L,2}q_{L,1}n_Lf_L+s_{L,2}s_{L,1})(q_{T,2}q_{T,1}n_Tf_T(1-v)+s_{T,2}s_{T,1})2\lambda
\end{multline*}
\end{subequations}

\end{document}

enter image description here

1
  • Very nice, will definitely use this! I was struggling myself with the large fractions and this solution is way better.
    – Elaine
    Mar 1, 2023 at 14:20

You must log in to answer this question.

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