Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

It was recommended that I include amsmath package to use \tag{} (which works). When I do this however, it somehow changes my predefined spacing; I would like everything to be left aligned, no left spacing for beginning of paragraphs, single line space between all equations, all paragraphs.

Sample code below; if you comment out amsmath line, you'll see the output I was aiming for. My question is what additional commands do I use for amsmath to this kind of output?

\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\setlength{\parindent}{0pt}
\usepackage{graphicx}
\usepackage{cancel}
\usepackage{listings}
\usepackage[latin5]{inputenc}
\usepackage{color}
\setlength{\parskip}{8pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\mathindent}{0cm}

\begin{document}

Some line 

\[ y = x^2 \]

Another line

\[ y = x^2  \]

\[ y = x^2 \]

One more line

\end{document}
share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

As others have mentioned you really should not be doing this. That being said, the code below provides a hack of the equation* environment which is what \[ ... \] construct becomes after you load amsmath. I am not able to see any difference in your MWE's output with amsmath loaded and this hack applied. No guarantee that there won't be other cases where the results with amsmath will vary though.

\usepackage{amsmath}
\makeatletter
\renewenvironment{equation*}{\vspace{\dimexpr -2\baselineskip+2.5pt\relax}\belowdisplayskip=0pt%
  \mathdisplay@push
  \st@rredtrue \global\@eqnswfalse
  \mathdisplay{equation*}%
}{%
  \endmathdisplay{equation*}%
  \mathdisplay@pop
  \ignorespacesafterend%
}
\makeatother
share|improve this answer
add comment

You must never have blank lines above a displayed equation (unless it really starts a paragraph, which is bad style anyway); a blank line below can be used, but only if the equation ends a paragraph.

For consecutive displayed equations use the gather* environment.

\documentclass[12pt,fleqn]{article}
\usepackage[latin5]{inputenc}
\usepackage{amsmath}

\setlength{\parindent}{0pt}
\usepackage{graphicx}
\usepackage{cancel}
\usepackage{listings}
\usepackage{color}
\setlength{\parskip}{8pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\mathindent}{0cm}

\begin{document}

Some line 
\[
y = x^2
\]
Another line
\begin{gather*}
y = x^2\\
y = x^2
\end{gather*}
One more line

\end{document}
share|improve this answer
    
No this wont work. I want to use \[ \] exactly the way I've shown you. These extra {gather*} statements are clouding up the text. –  user423805 Nov 30 '11 at 0:18
7  
Then you can't have what you want. That's it. –  egreg Nov 30 '11 at 0:20
2  
@user423805: If the eventual output is what you're after, then sometimes there may be a compromise in terms of the input. –  Werner Nov 30 '11 at 0:43
2  
@user423805: You can use % to comment out blank lines –  cmhughes Nov 30 '11 at 1:18
    
@cmhughes -- commenting out blank lines is a great idea, but it's still bad form to have multiple consecutive separate equations. it will result in really poor vertical spacing. –  barbara beeton Nov 30 '11 at 14:10
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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