0

Code:

%\documentclass[12 pt,handout,notheorems]{beamer}
\documentclass[12 pt,handout,notheorems, serif]{beamer}
%\documentclass[12 pt]{article}
\usepackage{pgfpages}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usetheme{Boadilla}
\usefonttheme{professionalfonts} %To get the accents aligned correctly, albeit in Computer Modern Roman
\usepackage{cancel}
\usepackage{amsmath}
\usepackage{mleftright}
\usepackage{bm}
\mleftright
\begin{document}
    \setcounter{equation}{14}
    \begin{equation}
        \frac{d}{dt}\left(\mathcal{H}_u\right) = 0 = \frac{\partial \mathcal{H}_u}{\partial t} + \left(\frac{\partial \mathcal{H}_u}{\partial \mathbf{x}}\right)^{\textrm{T}}\underbrace{\dot{\mathbf{x}}}_{\mathcal{H}_\bm{\lambda}} + \left(\frac{\partial \mathcal{H}_u}{\partial \bm{\lambda}}\right)^{\textrm{T}}\dot{\bm{\lambda}} + \cancelto{0}{\frac{\partial \mathcal{H}_u}{\partial u}}\dot{u}
    \end{equation}
\end{document}

While the code above looks correct, here is the output:

enter image description here

While the braces are correctly placed, the output comes out incorrect; instead of \mathcal{H}_\bm{\lambda} only being placed in the underbrace (I only want \mathcal{H}_\bm{\lambda} to be under the underbrace), the latter half of the expression gets written under the underbrace. What could be the problem?

Superman
  • 1,615

1 Answers1

1

\mathcal{H}_\bm{\lambda} needs to go to \mathcal{H}_{\bm{\lambda}} as in (I skipped some of the packages)

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{bm}
\usepackage{cancel}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\begin{document}
\setcounter{equation}{14}
\begin{equation}
    \frac{\diff}{\diff t}\left(\mathcal{H}_u\right) = 0 = 
    \frac{\partial \mathcal{H}_u}{\partial t} + 
    \left(\frac{\partial \mathcal{H}_u}{\partial \mathbf{x}}\right)^{\textrm{T}}
    \underbrace{\dot{\mathbf{x}}}_{\mathcal{H}_{\bm{\lambda}}}
    + \left(\frac{\partial \mathcal{H}_u}{\partial
    \bm{\lambda}}\right)^{\textrm{T}}\dot{\bm{\lambda}}
     + \cancelto{0}{\frac{\partial \mathcal{H}_u}{\partial u}}\dot{u}
\end{equation}
\end{document}

enter image description here

I am not sure if the underbace is pretty, but there is no error.

  • Hmmmmm this is interesting. I wonder why there needs to be a brace surrounding the subscript... – Superman May 13 '20 at 17:13
  • Also, kind of off topic, but is the \diff command more commonly used than just a plain d in derivative? – Superman May 13 '20 at 17:14
  • 1
    @Superman Because otherwise you get an error. ;-) In more detail, this has to do with how \bm is defined (vs. \mathrm, say). And yes, differential ds are to be typeset upright and \diff takes care of the spacing in many standard situations. Why upright? Let $d$ be a distance, then its time derivative, $\drac{dd}{dt}$ ????. Math operators are upright, which is why you get upright symbols with \DeclareMathOperator. I know someone on the faculty in the computer science department somewhere will object, but this is a standard convention among many/most.) –  May 13 '20 at 17:18
  • Standard convention in pure and applied math and sciences? – Superman May 13 '20 at 17:19
  • 1
    @Superman There are different opinions but the above argument: Let $d$ be a distance, then its time derivative, $\drac{dd}{dt}$ ??? should be enough. Also a d-dimensional integral \int d^dx? \frac{\diff d}{\diff t} and \int \diff^dx with the above upright \diff are unambiguous. I follow the conventions used by most people I know who thought about this, including Ed Witten, a top-level physicist who also won the Fields medal. –  May 13 '20 at 17:22