| 
August 11th, 2009, 11:01 AM
| | Junior Member | | Join Date: Jul 2009
Posts: 31
Thanks: 12
Thanked 4 Times in 3 Posts
| | Importing LaTeX from Lyx? I've tried using Lyx to typeset a multiline formula; viewing a .pdf of the output within Lyx is absolutely fine - everything looks as desired without any problem.
However, when I paste the LaTeX code into the board here (with the appropriate math tags), I receive a LaTeX syntax error. Why should this be?
Here's the code I tried to paste:
\begin{eqnarray*} x & = & \frac{4}{100}e^{\frac{-1}{100}t}\sin(12t)\\
\: & = & {\rm Re}\left(ce^{\alpha+i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}e^{i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}\left[\cos\beta+i\sin\beta\right]\right)\\
\: & = & ce^{\alpha}\cos\beta\\
\frac{4}{100}e^{\frac{-1}{100}t}\sin(12t) & = & ce^{\alpha}\sin\left(\beta+\frac{\pi}{2}\right)\en d{eqnarray*} | 
August 11th, 2009, 11:33 AM
|  | Member | | Join Date: Jul 2009
Posts: 131
Country: Thanks: 0
Thanked 70 Times in 65 Posts
| | Quote:
Originally Posted by Harry1W I've tried using Lyx to typeset a multiline formula; viewing a .pdf of the output within Lyx is absolutely fine - everything looks as desired without any problem.
However, when I paste the LaTeX code into the board here (with the appropriate math tags), I receive a LaTeX syntax error. Why should this be?
Here's the code I tried to paste:
\begin{eqnarray*} x & = & \frac{4}{100}e^{\frac{-1}{100}t}\sin(12t)\\
\: & = & {\rm Re}\left(ce^{\alpha+i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}e^{i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}\left[\cos\beta+i\sin\beta\right]\right)\\
\: & = & ce^{\alpha}\cos\beta\\
\frac{4}{100}e^{\frac{-1}{100}t}\sin(12t) & = & ce^{\alpha}\sin\left(\beta+\frac{\pi}{2}\right)\en d{eqnarray*} | First, I see a space in the "end" of \end{eqnarray*}, but that seems to be a minor problem. Second, I don't know for sure what "environments" (like eqnarray here) are defined for LaTeX code that you insert between math-tags. One thing I can say from experience: even if perhaps eqnarray is not defined between math tags in this forum, array is defined and can be used for much the same purpose... | | The following users thank Failure for this useful post: | |  | 
August 11th, 2009, 11:36 AM
|  | Super Member | | Join Date: Apr 2008
Posts: 799
Thanks: 153
Thanked 437 Times in 366 Posts
| | Quote:
Originally Posted by Harry1W However, when I paste the LaTeX code into the board here (with the appropriate math tags), I receive a LaTeX syntax error. Why should this be? | I guess it is because of the "eqnarray" environment.
To have your equations correctly displayed you just have to modify the first and the last line : Code: \begin{array}{rcl}
x & = & \frac{4}{100}e^{\frac{-1}{100}t}\sin(12t)\\
\: & = & {\rm Re}\left(ce^{\alpha+i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}e^{i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}\left[\cos\beta+i\sin\beta\right]\right)\\
\: & = & ce^{\alpha}\cos\beta\\
\frac{4}{100}e^{\frac{-1}{100}t}\sin(12t) & = & ce^{\alpha}\sin\left(\beta+\frac{\pi}{2}\right)
\end{array}
Another solution would be to use the "aligned" environment : Code: \begin{aligned}
x & = \frac{4}{100}e^{\frac{-1}{100}t}\sin(12t)\\
& = {\rm Re}\left(ce^{\alpha+i\beta}\right)\\
& = {\rm Re}\left(ce^{\alpha}e^{i\beta}\right)\\
& = {\rm Re}\left(ce^{\alpha}\left[\cos\beta+i\sin\beta\right]\right)\\
& = ce^{\alpha}\cos\beta\\
\frac{4}{100}e^{\frac{-1}{100}t}\sin(12t) & = ce^{\alpha}\sin\left(\beta+\frac{\pi}{2}\right)
\end{aligned}
| | The following users thank flyingsquirrel for this useful post: | |  | 
August 11th, 2009, 11:47 AM
|  | Member | | Join Date: Jul 2009
Posts: 131
Country: Thanks: 0
Thanked 70 Times in 65 Posts
| | Quote:
Originally Posted by Harry1W I've tried using Lyx to typeset a multiline formula; viewing a .pdf of the output within Lyx is absolutely fine - everything looks as desired without any problem.
However, when I paste the LaTeX code into the board here (with the appropriate math tags), I receive a LaTeX syntax error. Why should this be?
Here's the code I tried to paste:
\begin{eqnarray*} x & = & \frac{4}{100}e^{\frac{-1}{100}t}\sin(12t)\\
\: & = & {\rm Re}\left(ce^{\alpha+i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}e^{i\beta}\right)\\
\: & = & {\rm Re}\left(ce^{\alpha}\left[\cos\beta+i\sin\beta\right]\right)\\
\: & = & ce^{\alpha}\cos\beta\\
\frac{4}{100}e^{\frac{-1}{100}t}\sin(12t) & = & ce^{\alpha}\sin\left(\beta+\frac{\pi}{2}\right)\en d{eqnarray*} | Maybe you need to instruct Lyx that is must not assume certain LaTeX packages to be available for the generated code... | | The following users thank Failure for this useful post: | |  | 
August 11th, 2009, 07:23 PM
| | Junior Member | | Join Date: Jul 2009
Posts: 31
Thanks: 12
Thanked 4 Times in 3 Posts
| | Thanks so much for your responses. I'll definitely investigate some more for myself; thanks for helping me to get off the ground!  Hopefully this will mean the end the inefficiency of multitudes of 'math' tags!
Other than the line spacing being noticeably different, are there any notable differences between the "aligned" and "eqnarray" environments? Also, what is the significance of the {rcl} after \begin{array}?
Last edited by Harry1W; August 11th, 2009 at 07:28 PM.
Reason: Extra questions!
| 
August 11th, 2009, 09:07 PM
|  | Member | | Join Date: Jul 2009
Posts: 131
Country: Thanks: 0
Thanked 70 Times in 65 Posts
| | Quote:
Originally Posted by Harry1W Thanks so much for your responses. I'll definitely investigate some more for myself; thanks for helping me to get off the ground!  Hopefully this will mean the end the inefficiency of multitudes of 'math' tags!
Other than the line spacing being noticeably different, are there any notable differences between the "aligned" and "eqnarray" environments? Also, what is the significance of the {rcl} after \begin{array}? | r says that the first column will be right aligned, c says that the next (second) column will be center aligned, and the final l says that the third column will be left aligned. | | The following users thank Failure for this useful post: | |  | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -7. The time now is 08:08 PM. | | |
 | |  |