0

I'm a newbie in LATEX. I like to eliminate any extra typing for syntax, partly because I'm not accustomed to LATEX syntax and partly because I'm lazy.

I know that my way is not a recommended way, but I prefer to write all the equations between ONE \begin{gather} and \end{gather}, so I don't need any & sign, $ sign, \begin{align}, etc. (And I don't like center-aligning. In this way I have to write space in text using \ instead of ' ', but usually most of the things I write is just equations, so that doesn't matter much.) so my code is like this:

\documentclass[a4paper,10pt,fleqn]{article}
\usepackage{amsmath,amssymb,graphicx}
\setlength{\mathindent}{0pt}
\usepackage[margin=.5in]{geometry}


\newcommand{\nl}{\\[10pt]}
\begin{document}
\large\textbf{Advanced Plasma Physics}
\\Homework2 \hfill heptacle
\section*{1.}
\begin{gather}
(1)\ \phi=-\frac{z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\frac{e^{-t^2}}{t-z}dt\\
\phi'=\frac{\phi}{z}-\frac{z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\frac{e^{-t^2}}{(t-z)^2}dt\\
=\frac{\phi}{z}+\frac{2z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\frac{te^{-t^2}}{t-z}dt\ (integration\ by\ part)\\
=\frac{\phi}{z}+\frac{2z}{\sqrt{\pi}}\int_{\infty}^{-\infty}(1+\frac{z}{t-z})e^{-t^2}dt\\
=\frac{\phi}{z}+2z-2z\phi\\
=\frac{\phi}{z}+2z(1-\phi)\\
\therefore\ \phi'=(\frac{1}{z}-2z)\phi+2z\\
\end{gather}
\end{document}

But the problem is that I wanna align equations on the equal sign so they would be more clear. But I coulnd't find any way for alinging in special position on gather environment. & sign doesn't work. Or is there a way to left align all the equations in the align environment without & sign?

  • 2
    gather is specifically for non-aligned equations so asking to align in gather can ot work, making = auto-align would be theoretically possible but many "equations" are not = they may be inequalities or just long expressions that need to be split so using a single & to mark the alignment point is far more robust – David Carlisle Feb 12 '18 at 8:38
  • 1
    Welcome to TeX SE! Your example didn't compile as it was, there was a blank line inside your gather environment. Also, each piece of coding, even inline should be enclosed between single quotation marks. As for your problem, I can't see any solution without using any align environment of its likes. – Franck Pastor Feb 12 '18 at 8:40
  • @FranckPastor Thank you for correcting my code. That is another annoying problem for my way, that my code should not include any blank line. OK maybe I should switch to align environment. This may sound as a too basic question, but I'm not quite sure how to left align eqn.s in align environment. fleqn alone doesn't work. Where should I plug in & signs? (forgetting about aligning on equal sign for a while) – Septacle Feb 12 '18 at 8:45
  • 1
    To left-align equations in an align environment, simply put the ampersand symbol at the very beginning of each equation. – Franck Pastor Feb 12 '18 at 8:51
  • 1
    shouldn't \large\textbf{Advanced Plasma Physics} be a heading such as \section{Advanced Plasma Physics} ? Using \large in that way makes the text in the entire document large. – David Carlisle Feb 12 '18 at 10:07
1

I propose you this layout:

\documentclass[a4paper,10pt,fleqn]{article}
\usepackage{amsmath, amssymb, graphicx}
\setlength{\mathindent}{0pt}
\usepackage[margin=.5in, showframe]{geometry}
\usepackage{titling}
\pretitle{\begin{center}\Large\bfseries}
\posttitle{\end{center}\vspace{2ex}}
\title{Advanced Plasma Physics}
\preauthor{\noindent\large Homework2\hfill}
\postauthor{}
\author{heptacle}
\date{}

\begin{document}

\maketitle
\section*{1.}
\begin{alignat*}{2}
\phi & =-\frac{z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\frac{e^{-t^2}}{t-z}\,dt\\
 \phi ' & =\frac{\phi}{z}-\frac{z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\!\frac{e^{-t^2}}{(t-z)^2}\,dt\\
 & =\frac{\phi}{z}+\frac{2z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\frac{te^{-t^2}}{t-z}\,dt & \quad & \text{\footnotesize(integration\ by\ parts)}\\
 & =\frac{\phi}{z}+\frac{2z}{\sqrt{\pi}}\int_{\infty}^{-\infty}\Bigl(1+\frac{z}{t-z}\Bigr)e^{-t^2} dt\\
 & =\frac{\phi}{z}+2z-2z\phi\\
 & =\frac{\phi}{z}+2z(1-\phi) \\
  &\boldsymbol{\therefore} & \phi' &=\Bigl(\frac{1}{z}-2z\Bigr)\phi+2z
\end{alignat*}

\end{document} 

enter image description here

  • Thanks! Can you explain the last line, &\boldsymbol{\therefore} & \phi' &=\Bigl(\frac{1}{z}-2z\Bigr)\phi+2z , please? I'm not sure what each & means. – Septacle Feb 13 '18 at 2:48
  • @Septacle. Oh! yes, naturally. An aligned environment, with several alignment points, is organised in columns. Inside each column, the alignment point is specified by a &, and each column (except the first, which doesn't need it) is introcuced by another &. So nalignment points requires 2n – 1 &. So the theredore (in its bod version) is aligned with the = signs, and in the final formula $\phi'=.\cdots$ (which is is in the 2nd column), the = i aligned with the beginning of the comment 4 lines above, so that it looks approximately centred and is more visible as a conclusion. – Bernard Feb 13 '18 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.