0

This is my code.

\documentclass{article}
\begin{document}
take an example of $$3\sqrt{5}.$$

$$3\sqrt{5}$$ $$means$$ $$3\cdot {\sqrt{5}}$$

\centering To express that in the form of surds, I'm going to square the expressions.

$$(3\cdot\sqrt{5})^2$$

$$= 9\cdot5$$

\centering Take square root of both expression $$\sqrt{9}\cdot\sqrt{5}$$

Simplify that to

$$\sqrt{45}$$

Which is surds.\

Back to the questions, What is larger, $2\sqrt{2}$, or $1 + \sqrt{3}$? \end{document}

The Back to the questions line get in the center. Help :"

Screenshot:

screenshot

Stefan Pinnow
  • 29,535
  • 1
    Welcome to TSE. Please post a Minimal Working Example, instead of code snippets. – José Carlos Santos Aug 03 '21 at 13:36
  • To center just a part of the document, use \begin{center} ... \end{center} rather than \centering which centers the full remaining document. – Partha D. Aug 03 '21 at 13:53
  • Maybe in this particular case you could use \begin{gather*}...\end{gather*} with \intertext{} for many of the short lines of text between the equations. By the way you should not use $$...$$, is better to use \[...\] see https://tex.stackexchange.com/a/69854/140456 – Luis Turcio Aug 03 '21 at 14:00

1 Answers1

1

There is an awful lot you're doing wrong here.

First up: $$$$ is not correct LaTeX markup. You should use \[\] if you want display math and $$ or \(\) if you want inline math. I'm guessing that you really wanted in-line math for a lot of what you wrote. Not to mention that

$$3\sqrt{5}$$ $$means$$ $$3\cdot {\sqrt{5}}$$

will set three displayed equations with the middle one being

m e a n s

I'm guessing you really meant to write

$3\sqrt{5}$  $3\cdot {\sqrt{5}}$

Also, don't put blank lines before displayed math. Write:

Simplify that to
\[
  \sqrt{45}
\]

instead of

Simplify that to

$$\sqrt{45}$$

(The line breaks in my version aren't essential, but it helps offset the displayed math in your .tex file for easier source readability.)

The \\ is going to put a blank line there. I'm not sure you wanted that.

And for the main question of the post, to get a centered block of text,¹ rather than use \centering you should use a center environment` instead which will indicate where the centered text should appear.²

\begin{center}
Take square root fo both expressions
\[
  \sqrt{9}\cdot\sqrt{5}
\]
Simplify that to
\[
  \sqrt{45}
\]
which is surds.
\end{center}

  1. Although this should really be wrapped up in a new environment with some semantic meaning, but I'll let that slide for now.

  2. It also adds some vertical space before and after which is probably appropriate for this case.

Don Hosek
  • 14,078