Learn Mandatory LaTeX with PF: A Step-by-Step Guide

  • LaTeX
  • Thread starter Greg Bernhardt
  • Start date
In summary: WarrenIs it working now?- Warren\psilooks like it works; good job!- WarrenIn summary, PF is implementing LaTeX on PF with the use of a new bbcode [ tex][ /tex] or [ latex][ /latex], allowing members to use LaTeX code within the tags to display equations. Additional features include a popup window for displaying code, and the ability to use macros. However, there may be some issues with image generation and server speed.
  • #141
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
 
Physics news on Phys.org
  • #142
ALT tags

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)?
 
  • #143


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
 
  • #144
Wolfenstein parameterization:

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

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

- Warren
 
  • #146


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.

Some browsers do display ALT tags for images that are loading, and then replace them with the actual images after they have loaded.


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?

Yes.
 
  • #147


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
 
  • #148


Originally posted by chroot
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.

Oh. Heh. My browser at home does that, but I never actually checked to see if this one does (I just started using it).


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

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. (So the total load time is proportional to number of images, not size. It can take a number of seconds just to load a forum page with all the little icons.) I don't think there's anything you can do about that.
 
  • #149


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
 
  • #150
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!
 
  • #151


Originally posted by chroot

Are you using a proxy server? Do you just happen to have some very slow link in your traceroute to physicsforums.com?

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.
 
  • #152


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
 
  • #153
Tests...

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

[tex]
\newcommand{\colv}[2] {\left(\begin{array}{c} #1 \\ #2 \end{array}\right)}
Q_L &=& \left(
{\colv{u}{d}}_L,
{\colv{c}{s}}_L,
{\colv{t}{b}}_L\,
\right), \qquad\quad\ Y_Q = \frac{1}{6}
[/tex]
 
Last edited:
  • #154


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.

I hope not! That's so 1995.
 
  • #155
OK, my attempt to make a chemical equation::

[tex]^{33}_{17}Cl^16~\xrightarrow{n,n)~^{31}_{15}P^{16}~+~^4_2He^2[/tex]
 
  • #156
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:
  • #157
ok, I am probably putting the spaces or the + in in the wrong way?
 
  • #158
[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:
  • #159
COOLLLL!
 
  • #160
[tex]
\newcommand{\atom}[4]{{}^{#1}_{#2}#3^{#4}}

\atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}
[/tex]
 
  • #161
what happened there?
 
  • #162
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??
 
  • #163
Originally posted by Monique
what happened there?

I have no idea. The page looks really messed up, but when I edit my post, the code looks okay. I should try again ...
 
  • #164
Another attempt:

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

\atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}
[/tex]
 
  • #165
Post the code with [ tex] and [ /tex], with spaces instead, so I can see it.

- Warren
 
  • #166
This worked fine when I tried it in actual LaTeX, but it seems to choke here:

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

\atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}
[ /tex ]
 
  • #167
Originally posted by Monique
[ tex ]^{33}_{17}Cl^{16}~\xrightarrow{n,n}~^{31}_{15}P^{16}~+~^4_2He^2[ /tex ]

You don't need all the tilde (~) characters ... they force a non-breaking space to prevent word wrap, but that's not an issue for a single line.

It's also customary not to leave ^ or _ dangling after nothing ... put a {} before them.

[tex]{}^{33}_{17}{Cl}^{16} \xrightarrow{n,n} {}^{31}_{15}P^{16} + {}^4_2He^2[/tex]
 
  • #168
It seems not to like the [4] ... or rather, the [ 4 ] ...
 
  • #169
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
 
  • #170
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
 
  • #171
Originally posted by chroot
I can't even get your code to work properly in tex on my local machine...

Works fine on mine ... Are you using latex (not tex), and including amsmath? Did you enclose the second line (the actual equation, after the macro definition) in a displaymath environment like $$...$$? What's the error?


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}

You've got an extra x in there ... it's supposed to be {{}^{#1} ... and so on. Otherwise, that's what I have.
 
  • #172
[tex]\frac{[A^-]}{[HA]}[/tex]
 
  • #173
Originally posted by Ambitwistor
Another attempt:

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

\atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}
[/tex]
 
  • #174
Originally posted by Ambitwistor
Another attempt:

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

\atom{33}{17}{Cl}{16} \xrightarrow{n,n} \atom{31}{15}{P}{16} + \atom{4}{2}{He}{2}
[/tex]
 
  • #175
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
 

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
265
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • STEM Academic Advising
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Feedback and Announcements
Replies
1
Views
384
  • Sticky
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
64
Views
183K
Replies
7
Views
195
  • Feedback and Announcements
Replies
24
Views
4K
Back
Top