2

I want to generate the following mathematics: math image

The code I am using is this (I am using AMS Math):

$$
  \begin{alignedat}{2}
    &&           \sqrt{x^2+y^2} &= r \\
    &\implies&   x^2+y^2        &= r^2
  \end{alignedat}
$$

But I don't think that this is the correct way. Is there a better way?

Also, is the typesetting in the picture wrong? If it is so, then what should be the correct code?

1
  • Welcome to TeX.SE! From LaTeX side is nothing wrong (except that you use TeX math delimiters, LaTeX \[ ...\] is used. Regarding math side, this is mater of habits and taste ... And, please, provide complete document, not just code snippet.
    – Zarko
    Jun 5, 2017 at 5:34

1 Answer 1

1

Since it appears the equations should be aligned on the = symbols, I suggest you use an align* environment.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
    \sqrt{x^2+y^2} &= r \\
    \implies x^2+y^2 &= r^2
\end{align*}
\end{document}

Don't use $$ in a LaTeX document to start and end (unnumbered) display-math mode. For more on this topic, please see the postings Why is \[ ... \] preferable to $$ ... $$? and What are the differences between $$, \[, align, equation and displaymath?

5
  • Since the equations should be centered — says who? If you look at the screenshot in the question, the equal signs are aligned, while in the output from your code they are not. Jun 5, 2017 at 5:35
  • Just typeset your document and compare with the screenshot in the question :-) I think it's fine to say that the typesetting in the question is wrong or whatever (that would be useful with an explanation), but as it stands, this answer proposes something different from what was asked in the question, with no explanation for the difference, just an assertion. Jun 5, 2017 at 5:40
  • @ShreevatsaR I have edited the question.
    – user134751
    Jun 5, 2017 at 5:43
  • @ShreevatsaR - My apologies -- I had glanced at the OP's screenshot obliquely and not noticed that there was, in fact, an alignment on the = symbols. I've updated the code accordingly.
    – Mico
    Jun 5, 2017 at 5:44
  • Cool, upvoted :-) Jun 5, 2017 at 5:46

You must log in to answer this question.