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.

I have one or two elementary questions on basic LaTeX typesetting:

  1. I know putting $$...$$ sign puts the mathematical expression in the middle (center), but what if I also want to center the mathematical expression as well as some (English) texts, say for example, I want to center the whole line

             We know $x^2\to 4$ as $x\to 2$. 
    

    How do I center the whole English plus mathematics expression together in the middle of the page?

  2. How do I write, using $$...$$, the following in LaTeX:

    (5) $lim_{x\to 2} x^2=4$
    

    Again I can center the part: $lim_{x\to 2} x^2=4$, but how do I number it together and the number does NOT get centered, but rather appears as I wrote above?

share|improve this question
1  
Please see tex.stackexchange.com/q/503/5001 (and the associated answers) for a discussion of various reasons for not using $$ in LaTeX documents. Incidentally, by using $$ ... $$ (or \[ ... \]!), not only will the material be centered on a separate line, but the material will also be typeset in \displaymath-math style rather than in \textstyle-math. –  Mico Mar 27 '13 at 23:26

3 Answers 3

Without PSTricks.

enter image description here

\documentclass[preview,border=12pt]{standalone}%please replace it with \documentclass{article}

\begin{document}
\begin{center}
    We know that $f(x)\to f(a)$ as $x\to a$ but
\end{center}
\begin{equation}
    \lim_{x\to a}f(x) \not\to f(a)
\end{equation}
\end{document}

Note: for left aligned equation number, use leqno (stands for left equation number) option passed to the class. I mean \documentclass[leqno]{article}, for example.

share|improve this answer
2  
-1 for not using TikZ. ;-) –  mafp Mar 27 '13 at 23:32

Using $$...$$ is considered bad practice, in LaTeX. You should use \[...\] for display math instead. See this for a discussion on which commands should be used for display math in LaTeX.

  1. You can use Karl's student solution, or mine. If the two equations meant to go together, it's best to put them in a common gather environment (see Barbara Beeton's comment on that below). \notag is used to suppress an equation number locally.

  2. Passing the class option leqno puts all equation numbers on the left-hand side, rather than on the right-hand side, of the equations.

EDIT (following barbara beeton's comment):

    \documentclass[leqno]{article}
    \usepackage{amsmath}
    \begin{document}
    \begin{gather}
        \text{We know $x^2 \to 4$ as $x \to 2$.} \notag\\
        \lim_{x\to2} x^2=4
    \end{gather}
    \end{document}

enter image description here

share|improve this answer
    
Where do people get this "bad practice" idea from? Knuth designed TeX with $ signs and it works just fine with $ signs. Some of us still use and like plain Tex. It's more flexible, easier to understand, and better documented (in the TeX Book). –  Thruston Mar 27 '13 at 22:59
    
For more insight on why \[...\] is preferable to $$...$$ in LaTeX, see this. –  Jubobs Mar 27 '13 at 23:05
1  
@Thruston Problem is amsmath and LaTeX not with Knuth:) $$..$$ environment leads to centred equations even with the global option fleqn (f orce left equations). texdoc onlyamsmath. So if one does not use this option can safely use it. –  Yiannis Lazarides Mar 27 '13 at 23:14
1  
@Thruston The question is dealing with LaTeX, where it is definitely bad practice using $$. Of course this has nothing to do with its usage in Plain TeX. –  egreg Mar 27 '13 at 23:28
1  
i won't comment on the use of \[...\] vs. $$, but it is bad practice to string separate one-line display equations together. instead, it's better to choose a "grouped" style; here, i'd use gather (from amsmath) since there's no need for alignment. equation numbers can be suppressed on lines where they're not needed with \notag, and extra space between lines added with the \\[<dimen>] option. –  barbara beeton Mar 28 '13 at 14:31

this answer requires

\usepackage[leqno]{amsmath}

since both lines are centered, without any need for alignment, i'd choose the gather environment, and suppress the number from the first line with \notag:

\begin{gather}
 \text{We know } x^2\to 4 \text{ as } x\to 2 \notag \\
 \lim_{x\to 2} x^2=4
\end{gather}

note that the spaces around the text inclusions need to be included explicitly within the \text{...} argument, or explicit math spaces used.

the amsmath users guide is highly recommended. texdoc amsldoc at a command line on a tex live system.

share|improve this answer

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.