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 want to put some limit equations in a table but all I get are errors such as "! Missing $ inserted." and "! You can't use `\eqno' in math mode.". Am I doing something wrong or is there another way to do this. This is what I have:

\begin{tabular}{| l |}  \hline
   Text is here\\
   \begin{equation}
        \lim_{n\to \infty} (x_n  + y_n) = a + b
   \end{equation}\\
   Text is here\\   \hline
   Text is here\\
   \begin{equation}
        \lim_{n\to \infty} (x_n  \cdot y_n) = a \cdot b
   \end{equation}\\  \hline
\end{tabular}
share|improve this question

3 Answers 3

up vote 10 down vote accepted

If you only want a left and a right vertical line to emphasize that text, you can use the mdframed package.

In this particular case, I've defined a new environment frametext to achieve that (it has also the advantage to go over page breaks)

\newmdenv[%
    leftmargin = -10pt,
    rightmargin = -10pt,
    topline = false,
    bottomline = false,
    linewidth = 0.4pt
]{frametext}

Full MWE

\documentclass{article}

\usepackage[framemethod=TikZ]{mdframed}

\usepackage{lipsum} % just for the example

\newmdenv[%
    leftmargin = -10pt,
    rightmargin = -10pt,
    topline = false,
    bottomline = false,
    linewidth = 0.4pt
]{frametext}

\begin{document}

\section{1st}

\lipsum[1]

\section{2nd}

\lipsum[1]

\begin{frametext}
\lipsum[2]
\begin{equation}
\lim_{n\to \infty} (x_n  + y_n) = a + b
\end{equation}
\lipsum[3]
\end{frametext}

\lipsum[1]

\end{document} 

Output:

enter image description here

If you instead want a complete box, remove the lines

topline = false,
bottomline = false,

from the definition of frametext.

enter image description here

share|improve this answer

If you want a box around some text you can use the following (of course, it is possible to make a more flexible code):

\documentclass{article}
\usepackage{lipsum} %% for dummy text
\usepackage{calc}
\begin{document}
\lipsum[1]

\noindent\fbox{%
\parbox[t]{\linewidth-2\fboxsep-2\fboxrule}{%
\lipsum[4]
\begin{equation}
\lim_{n\to \infty} (x_n  + y_n) = a + b
\end{equation}
\lipsum[6]
}}

\lipsum[2]
\end{document}

enter image description here

share|improve this answer
1  
Thank you, that is exactly what I needed! –  Skaiste Jan 4 at 15:03
3  
@Skaiste Note that page breaks can not occur within a \parbox, take a look at mdframed, e.g. tex.stackexchange.com/questions/36524/… for a solution that allows page breaks. –  Torbjørn T. Jan 4 at 15:22

equation is a display environment so has to be used in vertical (par) mode you can not use it in horizontal (LR) mode. using equation in an l column is like using it in an \mbox and you get the same error in either case. You need a p column which is a \parbox and equation will then work, just as in the other answer which uses an explicit parbox.

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.