# How to align text like math formula?

Code is here:

\noindent
\textit{Pf} Let $G(x)=\displaystyle\int_{a}^{x} f(t) d t$.

By (1), $G^{\prime}(x)=f(x)$, therefore $(G-F)^{\prime}(x)=0$ $\forall x \in[a, b]$.

$\Rightarrow$ $(G-F)(x)=const$.

Let $(G-F)(x)=c$ $\forall x \in[a, b]$, then $F(b)-F(a)=G(b)-G(a)=\int_{a}^{b} f(t) d t$.


I want to align "L" in "Let" in first line with "B" in "By" in second line. I've tried \hspace to generate some blank but didn't work well. (There is no function like "widthof" so I can't generate blank with proper width. ) I know in math environment I could use & to align, but I don't know how to do similar things with plain text.

You can set Pf inside a box that has the same width as \parindent:

\documentclass{article}

\begin{document}

\noindent
\makebox[\parindent][l]{\textit{Pf} }Let $G(x) = \int_a^x f(t) \mathrm{d}t$.

By (1), $G^\prime(x) = f(x)$, therefore $(G - F)^\prime(x) = 0 ~ \forall x \in[a, b]$.

$\Rightarrow$ $(G - F)(x) = \mathrm{const}$.

Let $(G - F)(x) = c ~ \forall x \in[a, b]$, then $F(b) - F(a) = G(b) - G(a) = \int_a^b f(t) \mathrm{d}t$.

\end{document}


You could instead use the proof environment from amsthm. I also suggest you to look at the amsmath package if you're typesetting mathematics.

\documentclass{article}

\usepackage{amsmath, amsthm}

\begin{document}

\begin{proof}
Let $G(x) =\int_{a}^{x} f(t) \, d t$.

By (1), $G'(x)=f(x)$, therefore $(G-F)'(x) = 0$
$\forall x \in[a, b]$.

$\implies (G-F)(x) = \text{const}$.

Let $(G-F)(x)=c$ $\forall x \in[a, b]$, then
$F(b)-F(a)=G(b)-G(a) = \int_{a}^{b} f(t) \, d t$.
\end{proof}

\end{document}


You could use a tabularenvironment:

\documentclass{article}
\begin{document}

\begin{tabular}{ll}
\textit{Pf}& Let $G(x)=\displaystyle\int_{a}^{x} f(t) d t$. \\
&   By (1), $G^{\prime}(x)=f(x)$, therefore $(G-F)^{\prime}(x)=0$ $\forall x \in[a, b]$.\\
&   $\Rightarrow$ $(G-F)(x)=const$.\\
&   Let $(G-F)(x)=c$ $\forall x \in[a, b]$, then $F(b)-F(a)=G(b)-G(a)=\int_{a}^{b} f(t) d t$.
\end{tabular}

\end{document}