Testing LaTeX (powered by MathJax)

  • Context: LaTeX 
  • Thread starter Thread starter Chris L T521
  • Start date Start date
  • Tags Tags
    Latex Mathjax Testing
Click For Summary

Discussion Overview

The discussion revolves around the use of LaTeX for rendering mathematical expressions in a forum setting, specifically focusing on the syntax and functionality provided by MathJax. Participants explore various methods for displaying inline and centered equations, as well as the challenges they face with formatting and rendering.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants demonstrate the use of different LaTeX delimiters for inline and displayed equations, noting the differences in rendering.
  • There is uncertainty regarding the effectiveness of dollar signs versus brackets for centering equations, with some participants reporting mixed results.
  • One participant mentions that MathJax does not check for mathematical mistakes, suggesting a limitation in the rendering process.
  • Concerns are raised about the whitespace added by MathJax around displayed equations, which some find undesirable.
  • Participants discuss the inability to use certain tags, like [noparse], effectively within the MathJax context.
  • Questions arise about how to output raw LaTeX code verbatim, with suggestions provided on using code tags.
  • There are discussions about the rendering of matrices and potential bugs related to specific browsers and configurations.

Areas of Agreement / Disagreement

Participants express various opinions on the best practices for using LaTeX in the forum, with no clear consensus on the most effective methods or the limitations of MathJax. Disagreements exist regarding the functionality of different delimiters and the rendering issues encountered.

Contextual Notes

Some participants note specific issues with rendering in certain browsers, particularly Firefox, and mention that these may not be related to MathJax itself. There are also references to upcoming features in MathType that may affect how LaTeX is handled.

Chris L T521
Gold Member
MHB
Messages
913
Reaction score
0
\[\int_0^{\infty}e^{-x^2}\,dx=\frac{\sqrt{\pi}}{2}\]

This is inline: \(\frac{\sqrt{b^2-4ac}}{2a}\)

Other centered equation

$$\Gamma(x)=\int_0^{\infty}e^{-t}t^{x-1}\,dt $$
 
Last edited:
Physics news on Phys.org
So LaTex in brackets is centered? Not sure I get the syntax, though I'm trying to scroll through it on the mobile...
 
So \ ( and \ ), with no spaces, gives you inline. \ [ and \ ], with no spaces, gives you displayed. \(x^{2}+4x-4=0\), but \[x^{2}+4x-4=0.\]

The first is inline, the second displayed.
 
How odd. I was able to do centred fine using the dollar signs, but the others wouldn't work...
 
Prove It said:
How odd. I was able to do centred fine using the dollar signs, but the others wouldn't work...

Yeah, it looks like the double-dollar signs are enabled for displayed equations, but the single are not enabled for inline, although MathJax is capable of doing those as well. Chris mentioned to me in an email that the reason for that is there are quite a few algebra problems concerning money, and newbies would have a hard time escaping those characters.
 
Chris L T521 said:
$$\Gamma(x)=\int_0^{\infty}e^{xt}t^{x-1}\,dt$$

Apparently LaTeX does not check for math mistakes. ;)
 
Ackbach said:
Yeah, it looks like the double-dollar signs are enabled for displayed equations, but the single are not enabled for inline, although MathJax is capable of doing those as well. Chris mentioned to me in an email that the reason for that is there are quite a few algebra problems concerning money, and newbies would have a hard time escaping those characters.

I actually meant starting with the square and round brackets didn't work. Maybe I wasn't doing it right...

Test: \( (a + b)^n = \sum_{r = 0}^n {n\choose{r}}a^{n-r}b^r \)

\[ \lim_{h \to 0}\frac{\sin{h}}{h} = 1 \]

Hmm, now it works ><
 
Test:

Some text then inline \(f(x)=\sin(x^2/23)\) OK

\[f(x)=\frac{1}{\sin(x)}\] OK

\( \displaystyle f(x)=\frac{1}{\sin(x)} \)...\( f(x)=\frac{1}{\sin(x)} \) - just messing with the inline form

more text.

The thing that I don't like about the MathJax \ [ ... \ ] delimiters is the amount of white space inserted before and after the LaTeX

Note the [ noparse] [ /noparse] taggs are not working

CB
 
CaptainBlack said:
Test:

Some text then inline \(f(x)=\sin(x^2/23)\) OK

\[f(x)=\frac{1}{\sin(x)}\] OK

\( \displaystyle f(x)=\frac{1}{\sin(x)} \)...\( f(x)=\frac{1}{\sin(x)} \) - just messing with the inline form

more text.

The thing that I don't like about the MathJax \ [ ... \ ] delimiters is the amount of white space inserted before and after the LaTeX

Note the [ noparse] [ /noparse] taggs are not working

CB

Since this being called from the MathJax js file, there was no need to create a BBcode for it. Hence, noparse will have no effect on it.
 
  • #10
Chris L T521 said:
Since this being called from the MathJax js file, there was no need to create a BBcode for it. Hence, noparse will have no effect on it.

So question: how do we output raw LaTeX code? Verbatim?
 
  • #11
Ackbach said:
So question: how do we output raw LaTeX code? Verbatim?

It turns out you can do that using the code tags. For example,

Code:
$\displaystyle\int_{\partial M} \omega$

would compile to \( \large{\displaystyle{\int_{\partial M} \omega}} \).
 
Last edited by a moderator:
  • #12
Writing Inline LaTeX

Add "\displaystyle" to the beginning of your inline latex code.

LaTeX without "\displaystyle"

Code:\int_{0}^{\infty}\frac{\ln(x)}{(x-a)(x-b)}dx

\( \int_{0}^{\infty}\frac{\ln(x)}{(x-a)(x-b)}dx \)

LaTeX with "\displaystyle"

Code:\displaystyle \int_{0}^{\infty}\frac{\ln(x)}{(x-a)(x-b)}dx

\( \displaystyle \int_{0}^{\infty}\frac{\ln(x)}{(x-a)(x-b)}dx \)
 
  • #13
Re: Writing Inline LaTeX

I just realized the LaTeX is showing itself nicely! That's good.

Perhaps a little suggestion: I love to render LaTeX by using the dollar sign, but, is there a way to render fractions, sums, integrals, etc by not using \displaystyle? It's annoying to write it everytime!
 
  • #14
Re: Writing Inline LaTeX

Try double-dollar signs (two to open, two to close).
 
  • #15
Re: Writing Inline LaTeX

Well it didn't work that well, because by using doble dollar sign, it will center the content, and I don't always need to center the content.
 
  • #16
Just thought I'd test out some things too. Here's an inline equation \(u = \phi \cdot \exp \left\{ {{\textstyle{1 \over 2}}\sigma \left( {x + y} \right)} \right\}\) and here's a display (centered) equation \[{\rm{Bond Value}} = {\rm{C}}\left[ {\frac{{1 - \frac{1}{{{{\left( {1 + {\rm{r}}} \right)}^{\rm{t}}}}}}}{{\rm{r}}}} \right] + \frac{{{\rm{FV}}}}{{{{\left( {1 + {\rm{r}}} \right)}^{\rm{t}}}}}\]
So, how'd that work out?
 
  • #17
afwings said:
Just thought I'd test out some things too. Here's an inline equation \(u = \phi \cdot \exp \left\{ {{\textstyle{1 \over 2}}\sigma \left( {x + y} \right)} \right\}\) and...

Ok, that's something I just noticed -- following the MathJax close delimiter -- \) -- even if I add a space, the space doesn't show up in the post. Wonder what happens if I add 2 spaces? Here's a shot at it: \({b^2} - 4ac
% MathType!MTEF!2!1!+-
% feaagGart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbdfgBPj
% MCPbqedmvETj2BSbqefm0B1jxALjhiov2DGCKCLv2AGW0B3bqefqvA
% Tv2CG4uz3bIuV1wyUbqee0evGueE0jxyaibaieYhf9irFfeu0dXdh9
% vqqj-hEeeu0xXdbba9frFj0-OqFfea0dXdd9vqai-hGuQ8kuc9pgc9
% q8qqaq-dir-f0-yqaiVgFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabe
% qaamaaeaqbaaGcbaGaamOyamaaCaaaleqabaGaaGOmaaaakiabgkHi
% TiaaisdacaWGHbGaam4yaaaa!4201!
\) ok, I added 2 spaces, and still one showed up. Nice to know. (If it's already been pointed out, sorry I missed it.)

Trying something else. Here's a simple matrix: \[\left[ {\begin{array}{*{20}{c}}{10}&{20}\\{30}&4\end{array}} \right]
% MathType!MTEF!2!1!+-
% feaagGart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbdfgBPj
% MCPbqedmvETj2BSbqefm0B1jxALjhiov2DGCKCLv2AGW0B3bqefqvA
% Tv2CG4uz3bIuV1wyUbqee0evGueE0jxyaibaieYhf9irFfeu0dXdh9
% vqqj-hEeeu0xXdbba9frFj0-OqFfea0dXdd9vqai-hGuQ8kuc9pgc9
% q8qqaq-dir-f0-yqaiVgFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabe
% qaamaaeaqbaaGcbaWaamWaaeaafaqabeGacaaabaGaaGymaiaaicda
% aeaacaaIYaGaaGimaaqaaiaaiodacaaIWaaabaGaaGinaaaaaiaawU
% facaGLDbaaaaa!43CF!
\]
 
  • #18
I'm not following what's going on in the matrix you made. Is that the intended output or did something go wrong?
 
  • #19
Jameson said:
I'm not following what's going on in the matrix you made. Is that the intended output or did something go wrong?

Jameson, thanks for following up on that. There are really 2 issues shown in my post, neither of which I believe to be MHB's error.

  1. When viewing the forum in FF16 for Windows (and only in that configuration), the character immediately following an inline equation rendered by MathJax overlaps the right edge of the equation. If a period follows the equation, the period ends up inside the equation, like this one (again, this effect only happens on Windows, only in Firefox, and only with Math Renderer > MathML): \(\left( {x,y} \right)
    % MathType!MTEF!2!1!+-
    % feaagGart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbdfgBPj
    % MCPbqedmvETj2BSbqefm0B1jxALjhiov2DGCKCLv2AGW0B3bqefqvA
    % Tv2CG4uz3bIuV1wyUbqee0evGueE0jxyaibaieYhf9irFfeu0dXdh9
    % vqqj-hEeeu0xXdbba9frFj0-OqFfea0dXdd9vqai-hGuQ8kuc9pgc9
    % q8qqaq-dir-f0-yqaiVgFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabe
    % qaamaaeaqbaaGcbaWaaeWaaeaacaWG4bGaaiilaiaadMhaaiaawIca
    % caGLPaaaaaa!40E2!
    \). I've filed this as a MathJax bug, but it may be a Firefox bug. There are other things going on in Firefox 16. (And it may already be corrected; hard to tell.)
  2. The second issue is related to how MathType codes matrices with the Math Help Boards translator, which will be added to Cut & Copy Preferences when MathType 6.9 is released (no projected release date yet). We've already corrected this.

Bob
 
  • #20
Hi Bob,

Glad it's all working then. I notice in your post how a long string of code renders a very short [math]\left( {x,y} \right) [/math]. I'm guessing this is part of the Math Type plugin?

Anyway, it sounds like you're more than on top of things so I won't ask you to explain it all to me. Just let me know if there's anything I can do and if any of the issues are on our end :)Jameson
 
  • #21
Ackbach said:
So question: how do we output raw LaTeX code? Verbatim?
You insert LaTeX code verbatim like this using CODE and /CODE tags enclosed within square brackets. Everything between the tags will be listed verbatim.
Code:
$$X = \sum_{n=0}^5\left(\left(\sum_{j=1}^k   A_{X,n,j}  \cdot  {cos(B_{X,n,j}   +   t \cdot C_{X,n,j})}\right) \cdot t^n\right)$$
which means:
$$X = \sum_{n=0}^5\left(\left(\sum_{j=1}^k A_{X,n,j} \cdot {cos(B_{X,n,j} + t \cdot C_{X,n,j})}\right) \cdot t^n\right)$$
 
Last edited:

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 4 ·
Replies
4
Views
10K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
8K
  • · Replies 15 ·
Replies
15
Views
25K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
889