TeX formatting question

TeX formatting question

by James Ripps -
Number of replies: 15
I am trying to set up an equation where 11.15 g is placed over 120.0 g so their decimals line up with each other exactly.

I can't figure out the formatting that works in moodle, though. I've tried:

11.15 g \break \underline{ + \thinspace 120.0 g}

but the TeX filter doesn't recognize it. any suggestions?
Average of ratings: -
In reply to James Ripps

Re: TeX formatting question

by Marc Grober -
you could try to implement dcolumn....
or add space and zeros
$$\begin{align*}
7.15\\
8.30\\
\underline{+ 9.00}\\
24.45\\
\end{align*}$$


\begin{align*}
7.15\\
8.30\\
\underline{+ 9.00}\\
24.45\\
\end{align*}
In reply to Marc Grober

Re: TeX formatting question

by James Ripps -

the problem is that it has to have different # of figures before and after the decimal.

$$\begin{align*}
1.201 L\\
\underline{- 0.2543 L}\\
\end{align*}
$$


\begin{align*}
1.201 L\\
\underline{- 0.2543 L}\\
\end{align*}

needs to have the decimals line up exactly.

In reply to James Ripps

Re: TeX formatting question

by Marc Grober -
So add trailing zeros. That is a simple answer unless your lesson is addressed to elementary students you are trying to teach that 2.1=2.100
In reply to Marc Grober

Re: TeX formatting question

by James Ripps -
I can't alter the number of figures present, that would alter the number of signficiant figures given, and ruin the whole point of the question. I guess I'll just use html tables.
In reply to James Ripps

Re: TeX formatting question

by Mauno Korpelainen -
All distributions of latex do not support this but

\begin{tabular}{r@{.}l}11&15 g\\+120&0 g\\\hline131&15 g\\\end{tabular}

may render with tex live

\begin{tabular}{r@{.}l}11&15 g\\+120&0 g\\\hline131&15 g\\\end{tabular}

(does not work here in moodle.org anyway - probably some blacklisted command like \line breaks tex filter code here) Edit: works ok also here:

$$\begin{tabular}{r@{.}l}11&15 g\\+120&0 g\\\hline131&15 g\\\end{tabular}$$






In reply to Mauno Korpelainen

Re: TeX formatting question

by James Ripps -

Bah, we don't have that upto date on TeX apparently, because it gets to }{r@{.}l and freaks out.

this is what I see:

alt

In reply to James Ripps

Re: TeX formatting question

by Mauno Korpelainen -

Is it Mimetex?

You can get close to similar effect in Mimetex with normal array and syntax like

\begin{array}{rcl}11&.&15 g\\+\;120&.&0 g\\\hline131&.&15 g\\\end{array}

which looks like this rendered by mimetex:

Attachment mimetex.gif
In reply to James Ripps

Re: TeX formatting question

by Colin Fraser -
Picture of Documentation writers Picture of Testers
How about

$$ \begin{array}{rll} 11&.15 &g \\ +120&.0 &g \\ \hline 131&.15&g \end{array} $$

$$$ \begin{array}{rll} 11&.15 &g \\ +120&.0 &g \\ \hline 131&.15&g \end{array} $$$
hahahaaaaa!!!!! You are just too quick for me Mauno..smile

2nd Edit:
Well if nothing else works... just as Mauno has posted using the default TeX Notation works, not all that nicely, but it is aligned and tidier than the alternatives...
In reply to James Ripps

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: TeX formatting question

by Mauno Korpelainen -

Felicia,

the problem with {tabular}{r@{.}l} was that James has Mimetex and Mimetex does not support this expression - distros like Tex Live do support it

http://moodle.org/mod/forum/discuss.php?d=158627#p695316

In reply to Mauno Korpelainen

Re: TeX formatting question

by Colin Fraser -
Picture of Documentation writers Picture of Testers
Which leads on to the question Mauno, is it possible for a developer to tweak something like MimeTex to accept such symbols? Or create a MoodleTeX that is seriously adaptable? Rather than using external packages and adapting them to Moodle, or not, develop something that can be easily used in Moodle? Something easily adaptable specific for Moodle?

I know I could not do it, I do not have the knowledge of TeX nor the programming skills, but could it be done?
In reply to Colin Fraser

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Colin Fraser

Re: TeX formatting question

by Marc Grober -
Tex has extraordinary capacity to do most anything you wish ( as you can see from the range of options here: http://www.tug.org/interest.html), but the more abbreviated the solution, the less one gets. John Forkosh created mimetex and mathtex and you can find out more about them at john's site, forkosh.com. The same applies to MathTran, asciimath, and mathjax. They are all subsets designed to provide an economical solution to addressing math online.

IMHO, if you want and need all that Tex can do, do a full install of Tex Live and use CPAN via tl_mgr to pull whatever packages or macros you might need.

I continue to hope that with the work being done on STACK and MathJax that at some point we will see, as was targeted by the MathTran project, full correspondence between Tex and Mathml allowing us to go in both directions, but that is a mammoth task and while lots of educators in the US opine about the issues we have with Math education, we see record profits for companies like Pearson while we see little investment in basic tools to make Math education possible.

In the meantime, one could hack on ASCIIMathML (see e.g., http://asciimathml.com/ ) and you can play with DragMath as well (via the xml files) as far as displaying directly via MathML

MathJax may well be the future of Tex on the web, but there is a long way to go