LaTeX implementation ready for testing on Physics Forums

  • Context: LaTeX 
  • Thread starter Thread starter Greg Bernhardt
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
161 replies · 8K views
BTW, if you guys would like to post some examples in the General Physics intro thread, go right ahead! If it's something really complex, a little discussion about how it works might even be in order. :smile:

- Warren
 
Physics news on Phys.org
Greg, Warren,

I think that the intro thread which Warren posted should be made into a general announcement to all forums.
 
Originally posted by enigma
Greg, Warren,

I think that the intro thread which Warren posted should be made into a general announcement to all forums.

Most likely -- I can't do that though.

(except I currently have access to the entire site's code... supermegalomentor, here I come! )

- Warren
 


Originally posted by Ambitwistor
Sometimes the equation images take a while to load. Perhaps the TeX source could be squished into an ALT tag for the browser to display while it's loading the images (for those browsers that do that)?
The browser does not display alt tags for images that are loading, it displays them for images that are unloadable -- in other words, images that don't exist on the server.

Are you saying it takes a long time to view a page that has TeX equations on it, because the image files take time to download? Or do you mean it takes time for a newreply (or editpost) operation to complete for a post with images in it?

- Warren
 
Wolfenstein parameterization:

[tex] V = \left( \begin{array}{ccc}<br /> 1-\frac{1}{2}\lambda^2 & \lambda & A\lambda^3(\rho-i\eta) \\<br /> -\lambda & 1-\frac{1}{2}\lambda^2 & A\lambda^2 \\<br /> A\lambda^3(1-\rho-i\eta) & -A\lambda^2 & 1<br /> \end{array} \right) + {\cal O}(\lambda^4)[/tex]
 
ahrkron,

Post your examples in the general physics thread. :) Looks very pretty! I thought Wolfenstein was a video game.

- Warren
 


Originally posted by Ambitwistor
Some browsers do display ALT tags for images that are loading, and then replace them with the actual images after they have loaded.
Okay -- well, the images already have an alt tag -- so if your browser is not displaying it, I don't know what to tell you.
Yes.
That's surprising. I chose the converters and formatting specifically to limit file sizes. In fact, the largest equation png file generated so far is just a hair over two kilobytes -- files of this size shouldn't be a problem on even an ancient phone modem. (Each image would take about half a second to download.)

As far as I can tell, the images haven't slowed my page loads noticeably at all.

What browser, OS, and internet access medium are you using?

- Warren
 


Originally posted by Ambitwistor
Oh. Heh. My browser at home does that, but I never actually checked to see if this one does (I just started using it).
:wink:
Well, my page loads are always slow, even over broadband ... I don't think it's due to image size, but due to the fact that each HTTP request stalls briefly while connecting. I don't think there's anything you can do about that.
Are you using a proxy server? Do you just happen to have some very slow link in your traceroute to physicsforums.com?

- Warren
 
Originally posted by chroot
Post your examples in the general physics thread. :) Looks very pretty! I thought Wolfenstein was a video game.

I knew the game too. I should have brought it up with him sometime.:smile:

Ok, General Physics, here it goes!
 


Originally posted by Ambitwistor
No, I'm not using a proxy. My traceroute isn't bad, and I get 85 ms pings. It's probably the browser (Konqueror). I was using Mozilla, but I mangled some of my libraries beyond the current limits of my patience to fix them, so it doesn't work right for now.
Yeah, it's entirely possible your browser is opening new connections for each and every HTTP request -- and only opening one connection at a time. Ack!

- Warren
 
Tests...

[tex] \newcommand{\colv}[2] {\left(\begin{array}{c} #1 \\ #2 \end{array}\right)}<br /> L_L &=& \left(<br /> {\colv{\nu_e}{e}}_L,<br /> {\colv{\nu_\mu}{\mu}}_L,<br /> {\colv{\nu_\tau}{\tau}}_L\,<br /> \right), \qquad Y_L = -\frac{1}{2}[/tex]

[tex] \newcommand{\colv}[2] {\left(\begin{array}{c} #1 \\ #2 \end{array}\right)}<br /> Q_L &=& \left(<br /> {\colv{u}{d}}_L,<br /> {\colv{c}{s}}_L,<br /> {\colv{t}{b}}_L\,<br /> \right), \qquad\quad\ Y_Q = \frac{1}{6}[/tex]
 
Last edited:
OK, my attempt to make a chemical equation::

[tex]^{33}_{17}Cl^16~\xrightarrow{n,n)~^{31}_{15}P^{16}~+~^4_2He^2[/tex]
 
ahhh! why!?

breaking it down::


[tex]^{33}_{17}Cl^{16}[/tex]

[tex]\xrightarrow{n,n}[/tex]

[tex]^{31}_{15}P^{16}[/tex]

[tex]^4_2He^2[/tex]

[tex]^{33}_{17}Cl^{16} ~ \xrightarrow{n,n) ~ ^{31}_{15}P^{16} ~ + ~ ^4_2He^2[/tex]
 
Last edited:
ok, I am probably putting the spaces or the + in in the wrong way?
 
[tex]^{33}_{17}Cl^{16}\xrightarrow{n,n)^{31}_{15}P^{16}+^4_2He^2[/tex]


..wtf! :P ?

I don't see what's wrong with this.. it worked individually?

[tex]^{33}_{17}Cl^{16}~\xrightarrow{n,n}~^{31}_{15}P^{16}~+~^4_2He^2[/tex]

ah, a wrong bracket..
 
Last edited:
what happened there?
 
I also made a sticky in Chemistry, since it is very usefull to be used there too, maybe I should lock it an provide a link to the General Physics thread??
 
Post the code with [ tex] and [ /tex], with spaces instead, so I can see it.

- Warren
 
I can't even get your code to work properly in tex on my local machine...

I'm trying

\newcommand{\atom}[4]{{x}^{#1}_{#2} {#3}^{#4}}

\atom{33}{17}{Cl}{16}
\xrightarrow{n,n}
\atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}

I'll have to look into what's making it fail.

- Warren
 
I never consider people putting "smilie" code inside [ tex ] brackets -- I may need to change the precedence of the parsing code to prevent this. I'll let you know -- right now I don't have access to the site's code.

- Warren
 
[tex]\frac{[A^-]}{[HA]}[/tex]
 
Originally posted by Ambitwistor
Another attempt:

[tex] \newcommand{\atom}[4]{{}^{#1}_{#2}#3^{#4}}<br /> <br /> \atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}[/tex]
 
Originally posted by Ambitwistor
Another attempt:

[tex] \newcommand{\atom}[ 4 ]{{}^{#1}_{#2}#3^{#4}}<br /> <br /> \atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}[/tex]
 
Okay Ambi

It's the [ 4 ] that's causing problems, since it's being parsed by the smilie parser before being sent to latex. Here are two solutions:

1) Write [ 4 ] with spaces inside the tag, so the smilie parser won't touch it. LaTeX doesn't care about spaces.

2) Disable smilies in the post to stop the smilie parser from messing with it.

I'll update the code to put the smilie parser AFTER the latex parser when I get a chance.

- Warren
 
Could the font be made slightly smaller? A longer formula will be cut off it seems.

How about automatic spaces? Do I always have to put in spacers, or will it be automatically done with some characters?

[tex]{one}+{one}={one}~+~{one}[/tex]

ah, apparently it already does that :P
 
[tex] \begin{array}{rcccl}<br /> \ &\ &\mathrm{H}& \ & \ <br /> \\<br /> \ &\ &\mid&\ &\ <br /> \\<br /> \mathrm{H}& - &\mathrm{C}& - &\mathrm{OH}<br /> \\<br /> \ &\ &\mid&\ &\ <br /> \\<br /> \mathrm{H}& - &\mathrm{C}& - &\mathrm{OH}<br /> \\<br /> \ &\ &\mid&\ &\ <br /> \\<br /> \mathrm{H}& - &\mathrm{C}& - &\mathrm{OH}<br /> \\<br /> \ &\ &\mid&\ &\ <br /> \\<br /> \ &\ &\mathrm{H}& \ & \ <br /> <br /> \end{array}[/tex]

Glycerin

[tex] \begin{array}{ccccccccc}<br /> \ &\ &\mathrm{H}&\ &\mathrm{H}&\ &\mathrm{H}& \ & \ <br /> \\<br /> \ &\ &\mid&\ &\mid&\ &\mid&\ &\ <br /> \\<br /> \mathrm{H}& - &\mathrm{C}& -&\mathrm{C}& -&\mathrm{C}& - &\mathrm{H}<br /> \\<br /> \ &\ &\mid&\ &\mid&\ &\mid&\ &\ <br /> \\<br /> \ &\ &\mathrm{H}&\ &\mid&\ &\mathrm{H}& \ & \ <br /> \\<br /> \ &\ &\mathrm{H}&-&\mathrm{C}&-&\mathrm{H}&\ &\ <br /> \\<br /> \ &\ &\ &\ &\mid&\ &\ &\ &\ <br /> \\<br /> \ &\ &\ &\ &\mathrm{H}\ &\ &\ &\ <br /> <br /> \end{array}[/tex]

Isobutane
 
I was thinking about doing that.. a little too complicated for me though..
 
[tex] \begin{array}{ccccccc}<br /> <br /> \ &\ &\ &\mathrm{H}&\ &\ &\ \\<br /> <br /> \ &\ &\ &\mid&\ &\ &\ \\<br /> <br /> \ &\ &\ &\mathrm{C}&\ &\ &\ \\<br /> <br /> \ &\ &\ &/\!\!/\backslash &\ &\ &\ \\<br /> <br /> \ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\<br /> <br /> \ &\ &\ &\mid\ \|&\ &\ \\<br /> <br /> \ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\<br /> <br /> \ &\ &\ &\backslash\!\!\backslash / &\ &\ &\ \\<br /> <br /> \ &\ &\ &\mathrm{C}&\ &\ &\ \\<br /> <br /> \ &\ &\ &\mid&\ &\ &\ \\<br /> <br /> \ &\ &\ &\mathrm{H}&\ &\ &\ \\<br /> \end{array}<br /> [/tex]

Benzene
[tex]\mathrm{C}_{\mathrm{6}}\mathrm{H}_{\mathrm{6}}[/tex]

This could look better if I had actual diagonal lines to work with rather than slashs; something like[tex]\nwarrow[/tex] and [tex]\swarrow[/tex] without the arrow tips.
 
More tests...

[tex] \begin{array}{cc}<br /> \begin{picture}(10,10)(0,0)<br /> \put(0,0){\line(1,1){10}}<br /> \put(2,0){\line(1,1){10}}<br /> \end{picture} &<br /> \begin{picture}(10,10)(0,0)<br /> \put(0,10){\line(1,-1){10}}<br /> \end{picture} \\<br /> \begin{picture}(10,10)(0,0)<br /> \put(0,10){\line(1,-1){10}}<br /> \end{picture} &<br /> \begin{picture}(10,10)(0,0)<br /> \put(0,0){\line(1,1){10}}<br /> \put(2,0){\line(1,1){10}}<br /> \end{picture}<br /> \end{array}[/tex]