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?

  • 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
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – jub0bs Dec 6 '14 at 20:06

Without PSTricks.

enter image description here

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

    We know that $f(x)\to f(a)$ as $x\to a$ but
    \lim_{x\to a}f(x) \not\to f(a)

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.

| 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):

        \text{We know $x^2 \to 4$ as $x \to 2$.} \notag\\
        \lim_{x\to2} x^2=4

enter image description here

| 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. – jub0bs 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


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:

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

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.

| improve this answer | |

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.