0

I'm getting error messages in overleaf such as "Missing } inserted.", "Extra }, or forgotten \endgroup.", "Misplaced alignment tab character &.", "Misplaced alignment tab character &.", "Misplaced \omit.", "Misplaced \cr.", "Misplaced \noalign.", "Missing $ inserted." and "Missing \cr inserted."

It compiling when I use equation instead of align but doesnt otherwise. My code also compiles if I remove \bm{\varphi} and just write \varphi. It doesnt miss a { or } and no alignment is missplaced. I cant understand why it wouldn't compile and I really would like to use align instead of equation since it is much better looking. My code is as follows

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{bm,mathtools}
\usepackage{amsthm}
\usepackage{chemist}
\newcommand{\rd}[1] {\ensuremath{\mathrm{d}#1}} %creates operator ds that makes it more clear that \frac{d}{dt} is an math operator 
\newcommand{\ham}{\mathcal{H}} %hamiltonian


\begin{document}


\begin{align*}
    \frac{\rd }{\rd t} \left( \left( \frac{\partial \bm{\varphi}_{t}}{\partial 
    \bm{y}_{0}} \right)^{T} J \left( \frac{\partial \bm{\varphi}_{t}}{\partial 
    \bm{y}_{0}} \right) \right) 
    &= \left(\frac{\rd}{\rd t} \frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}}\right)^T J \left(\frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}}\right) + \left(\frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}} \right)^T J \left(\frac{\rd}{\rd t} \frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}}\right)\\
    &=\left(\frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}}\right)^T \nabla^2 \ham(\bm{\varphi}_t(\bm{y}_0)) J^T J \left(\frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}}\right) + \left(\frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}} \right)^T \nabla^2 \ham(\bm{\varphi}_t(\bm{y}_0)) \left( \frac{\partial \bm{\varphi}_{t} } {\partial \bm{y}_{0}}\right)\\
    &=0
\end{align*}

\end{document}

It seems that the code work if I put it into another blank overleaf document but doesn't work in my original document for some reason. So to be clear if you copy this it will work but my code is approximately 2000 lines of code so might be something else or some smaller error that stack up?

22
  • 1
    Did you load the package bm and mathtools? It compiles fine for me (but I have to guess the meaning of \rd as \mathrm{d}). Please consider adding a minimum working example (MWE), i.e. from \documentclass{article} to \end{document} and can be tested to show the problem. Apr 7, 2022 at 7:14
  • You'll need at least the amsmath and bm packages. As Teddy mentions, please always post full but minimal examples, not sniplets like this. Then we can see which class and packages you're loading and whether you're missing any.
    – daleif
    Apr 7, 2022 at 7:23
  • Those are not complete examples. Please provide something that has any chance of even compiling on overleaf or elsewhere. We need something we can copy and test as is. Again here is no document class, there is no marking of document body. You need to provide something we can test that generates the error you get. Yes, it is annoying to create such an example, but it is an important debugging tool, both for you (because you learn how to identify the course of an error) and for us as we need something we can test.
    – daleif
    Apr 7, 2022 at 7:44
  • I think my problem perhaps lies in some smaller problem that stack up. And thank you for your politeness. I just haven't used Stack Exchange TeX - LaTeX before. It is very useful for me to get to know the proper way of writing a question. If I had the reputation for it I would give you an upvote (and I know you shouldn't write stuff like thanks in here but you get it anyway since there isn't a proper way to show my appreciation and to not discourage you from correcting newbies in the future ;) ). Continue to correct me if I'm still unclear. Apr 7, 2022 at 8:16
  • That example does not compile because \ham is not defined. BTW you can address a comment to a person if you use @name. You can send be a link to your overleaf project to daleif at math.au.dk, then I can copy it and have a look.
    – daleif
    Apr 7, 2022 at 8:24

1 Answer 1

1

Having gotten access to the project in Overleaf, here are my observations.

The project cannot compile and the first error is

<inserted text> 
                }
l.439     \bm{\varphi}
                      _t (\bm{p}_0, \bm{q}_0) = (\bm{p}(t, \bm{p}_0, \bm{q}_...
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.439     \bm{\varphi}
                      _t (\bm{p}_0, \bm{q}_0) = (\bm{p}(t, \bm{p}_0, \bm{q}_..

That can be boiled down to

\documentclass[a4paper]{article}
\usepackage{bm,mathtools}
\usepackage{chemist}
\begin{document}
\begin{equation*}
    \bm{\varphi}
\end{equation*}
\end{document}

I don't think that chemist package is recommendable, one should probably use mhchem or chemmacros (I haven't looked into what chemist does other than it redefines \varphi and friends).

The next error was two labels in an equation. Lastly a missing comma in a .bib file. So in the end not too hard once I had access to the files.

The main take down here is: When Overleaf reports an error. Look at the first one. The rest can be accumulations that goes away once the first error is fixed.

Where the OP got the

Missing } inserted."...

error from I do not know, but it was not the first error listed when Overleaf compiled the project copy I had access to.

You must log in to answer this question.

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