[Tex/LaTex] Need help correcting (deliberately faulty) equation code

equationsmath-mode

For a test, I need to edit and correct the following equation, which I understand to contain several syntax errors.

5\square{3X}+2X**2-\frac{3X/2}*

Unfortunately, I'm unfamiliar with LaTeX syntax.

Best Answer

Thanks for clarifying your (typesetting) objective.

I spottted (at least) six [6!!] mistakes in the code fragment you posted:

  • The macro \square is non-standard. Instead of \square{...}, just write (...)^2.

  • Use of { and } to denote the scope of the squaring operations. Use ( and ) instead.

  • Use of ** instead of ^ to denote exponentiation.

  • The \frac macro takes two arguments, not one. Thus, don't write \frac{3X/2}. Instead, write \frac{3X}{2}.

  • The final * (asterisk) symbol seems entirely misplaced.

  • Last but not least, one needs to initiate and terminate math mode explicitily, e.g., via $ directives.

With some misgivings -- after all, still further errors might be lurking somewhere -- I'd write

$5(3X)^2+2X^2-\frac{3X}{2}$

Maybe, just maybe, the \square macro was defined via an instruction such as \newcommand\square[1]{(#1)^2}. If that's the case -- you better verify that it is -- you could write

$5\square{3X}+2X^2-\frac{3X}{2}$

However, I can't see the point of bothering defining a macro called \square.

Related Question