Printable View

- December 6th 2009, 02:15 AMxavier9977
- December 6th 2009, 03:50 AMPaul46Just testing
- December 6th 2009, 10:31 AMOpalgDebugging LaTeX
The LaTeX compiler used by this Forum is very unforgiving and very uncommunicative. So, what do you do when after entering an impressive formula like

[tex]10\:log\:\left[\frac{\left(2\times10^{-1}}\right)^3{\left(2\times10^{-5}}\right)^3\right]\:=30\:log\left(\frac{2\times10^{-1}}{2\times10^{-5}}\:120\:[/tex]

in LaTeX, you hit the Preview button and all that happens is that you get the message*[LaTeX Error: Syntax error]*?

Here are a few hints on how to debug your LaTeX. The first and most important one is to narrow down where the errors are occurring. Split the formula into two at some convenient break point like an = sign, so that it becomes two separate formulas:

[tex]10\:log\:\left[\frac{\left(2\times10^{-1}}\right)^3{\left(2\times10^{-5}}\right)^3\right]\:[/tex] [tex]=30\:log\left(\frac{2\times10^{-1}}{2\times10^{-5}}\:120\:[/tex].

Now hit the Preview button and you see*[LaTeX Error: Syntax error]**[LaTeX Error: Syntax error]*.

Bad news. That means there is at least one error on both sides of the equation. But at least we are narrowing down where the errors might lie. Take the second of the two parts of the equation:

[tex]=30\:log\left(\frac{2\times10^{-1}}{2\times10^{-5}}\:120\:[/tex].Can we subdivide it further? Not easily, because one thing that the LaTeX compiler is very picky about is that a command like "\left(" must always be matched by a "\right)". So we can't just split this formula down the middle. What we can do is to replace everything between the "\left(" and the "\right)" by something simple, like an X. That will tell us whether the error comes inside or outside the brackets (or maybe in both places if we're unlucky). In this example, you'll have noticed by now that there is a "\left(" without any matching "\right)". So there's one error tracked down, and the second of the two halves of the formula now compiles correctly:

[tex]=30\:log\left(\frac{2\times10^{-1}}{2\times10^{-5}}\right)\:120\:[/tex]

yields " ". (There may still be things there that you want to change, but at least it's producing something.

Now let's look at the first part of the equation:

[tex]10\:log\:\left[\frac{\left(2\times10^{-1}}\right)^3{\left(2\times10^{-5}}\right)^3\right]\:[/tex].

The commonest error in writing LaTeX code (for me at any rate) is forgetting to close braces. Here again, the compiler is unforgiving. If you write a "{" that's not followed in the appropriate place by a matching "}" then you'll get the*LateX Error*message. You need to be particularly careful about this when writing complex fractions, and even more so if there are pairs of braces nested inside other pairs of braces. To see if you have gone wrong here, replace the whole of a "\frac{<numerator>}{<denominator>}" expression by a single X, and see if the formula still compiles. I'll leave you to figure out how to track down the error(s) in that part of the formula.

To sum up, the main technique in debugging LaTeX is to narrow down where the errors may be occurring, and then to use the Preview feature to see if you are making progress.

- December 14th 2009, 08:47 AM1LISTENtesting

- December 17th 2009, 12:25 PMKrahl
- December 23rd 2009, 02:30 PMjames121515
- January 22nd 2010, 09:15 AMhciR
testing

Find and

for

I got - January 31st 2010, 01:39 AMnikk

" alt="\frac{1}{2}mv^2

" /> - January 31st 2010, 01:39 AMnikk

" alt="1+2

" /> - February 4th 2010, 12:10 PMQuacky
Rather than make a new thread for such a tiny problem, how would I make text such as bigger? I try to use the command suggested in the sticky but it doesn't seem to work.

Also, is there a way to combine the [tex][\math]commands with colours or bold text? I can't seem to get it to work. So for example, in

, If I wanted to make the red, it would come out as:

\sqrt8+3}{-2x} " alt="\frac{\sqrt8+3}{-2x} " /> - February 4th 2010, 12:29 PMPlato
[tex]\frac {\displaystyle\frac{2x}{1.8}}{\displaystyle\frac {4}{7}}[/tex]

[tex]\frac{{\color{red}\sqrt8}+3}{-2x} [/tex]

- February 4th 2010, 02:09 PMQuacky
Oh. That simple. I'd never have worked it out. Thanks for the help.(Wink)

- February 8th 2010, 07:45 AMSoroban
Hello, Quacky!

Quote:

How would I make text such as bigger?

Another method . . .

. . \frac{\dfrac{2}{1/8}}{\dfrac{4}{7}} . .

- February 8th 2010, 11:48 AMOpalg
There is a device (explained in The TeXbook) for making compound fractions like this look clearer by thickening the main division line.

[tex]{\dfrac{2x}{1.8} \above1pt \dfrac{4}{7}}[/tex] gives .

If you*really*want to emphasise that line, you can make it as thick as you want:

[tex]{\dfrac{2x}{1.8} \above2pt \dfrac{4}{7}}[/tex] gives . - February 16th 2010, 06:46 PMDrexel28
Ok, so once again we are looking for a linear function to describe our data. And, as before we only need two points . So for the sake of convenience I will choose the first two . So once again let be our linear function. Remember that the is the same thing as (like in Alg. II when they started saying instead of ). So really our two points are saying that and . Try solving it yourself.

Solution:

__Spoiler__: