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.
  • #176
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
 
Physics news on Phys.org
  • #177
[tex]
\begin{array}{rcccl}
\ &\ &\mathrm{H}& \ & \
\\
\ &\ &\mid&\ &\
\\
\mathrm{H}& - &\mathrm{C}& - &\mathrm{OH}
\\
\ &\ &\mid&\ &\
\\
\mathrm{H}& - &\mathrm{C}& - &\mathrm{OH}
\\
\ &\ &\mid&\ &\
\\
\mathrm{H}& - &\mathrm{C}& - &\mathrm{OH}
\\
\ &\ &\mid&\ &\
\\
\ &\ &\mathrm{H}& \ & \

\end{array}
[/tex]

Glycerin

[tex]
\begin{array}{ccccccccc}
\ &\ &\mathrm{H}&\ &\mathrm{H}&\ &\mathrm{H}& \ & \
\\
\ &\ &\mid&\ &\mid&\ &\mid&\ &\
\\
\mathrm{H}& - &\mathrm{C}& -&\mathrm{C}& -&\mathrm{C}& - &\mathrm{H}
\\
\ &\ &\mid&\ &\mid&\ &\mid&\ &\
\\
\ &\ &\mathrm{H}&\ &\mid&\ &\mathrm{H}& \ & \
\\
\ &\ &\mathrm{H}&-&\mathrm{C}&-&\mathrm{H}&\ &\
\\
\ &\ &\ &\ &\mid&\ &\ &\ &\
\\
\ &\ &\ &\ &\mathrm{H}\ &\ &\ &\

\end{array}
[/tex]

Isobutane
 
  • #178
I was thinking about doing that.. a little too complicated for me though..
 
  • #179
[tex]
\begin{array}{ccccccc}

\ &\ &\ &\mathrm{H}&\ &\ &\ \\

\ &\ &\ &\mid&\ &\ &\ \\

\ &\ &\ &\mathrm{C}&\ &\ &\ \\

\ &\ &\ &/\!\!/\backslash &\ &\ &\ \\

\ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\

\ &\ &\ &\mid\ \|&\ &\ \\

\ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\

\ &\ &\ &\backslash\!\!\backslash / &\ &\ &\ \\

\ &\ &\ &\mathrm{C}&\ &\ &\ \\

\ &\ &\ &\mid&\ &\ &\ \\

\ &\ &\ &\mathrm{H}&\ &\ &\ \\
\end{array}

[/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.
 
  • #180
More tests...

[tex]
\begin{array}{cc}
\begin{picture}(10,10)(0,0)
\put(0,0){\line(1,1){10}}
\put(2,0){\line(1,1){10}}
\end{picture} &
\begin{picture}(10,10)(0,0)
\put(0,10){\line(1,-1){10}}
\end{picture} \\
\begin{picture}(10,10)(0,0)
\put(0,10){\line(1,-1){10}}
\end{picture} &
\begin{picture}(10,10)(0,0)
\put(0,0){\line(1,1){10}}
\put(2,0){\line(1,1){10}}
\end{picture}
\end{array}
[/tex]
 
  • #181
A better version?

[tex]
\newcommand{\lineUp}{
\begin{picture}(10,10)(0,0)
\put(0,0){\line(1,1){10}} \put(2,0){\line(1,1){10}}
\end{picture}
}
\newcommand{\lineDn}{
\begin{picture}(10,10)(0,0)
\put(0,10){\line(1,-1){10}}
\end{picture}
}

\begin{array}{cc}
\lineUp & \lineDn \\
\lineDn & \lineUp
\end{array}
[/tex]
 
  • #182
[tex]
\newcommand{\lineUp}{
\begin{picture}(10,10)(0,0)
\put(0,0){\line(1,1){10}} \put(2,0){\line(1,1){10}}
\end{picture}
}

\newcommand{\lineDn}{
\begin{picture}(10,10)(0,0)
\put(0,10){\line(1,-1){10}}
\end{picture}
}

\begin{array}{ccccccc}
\ &\ &\ &\mathrm{H}&\ &\ &\ \\
\ &\ &\ &\mid&\ &\ &\ \\
\ &\ &\ &\mathrm{C}&\ &\ &\ \\
\ &\ &\ &\lineUp \lineDn &\ &\ &\ \\
\ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\
\ &\ &\ &\mid\ \|&\ &\ \\
\ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\
\ &\ &\ & \lineDn \lineUp &\ &\ &\ \\
\ &\ &\ &\mathrm{C}&\ &\ &\ \\
\ &\ &\ &\mid&\ &\ &\ \\
\ &\ &\ &\mathrm{H}&\ &\ &\ \\
\end{array}
[/tex]

Oh well... not too bad. The good thing is that you can play with the "picture" command to make it nicer.
 
Last edited:
  • #183
Originally posted by ahrkron
[tex]
\newcommand{\lineUp}{
\begin{picture}(10,10)(0,0)
\put(0,0){\line(1,1){10}} \put(2,0){\line(1,1){10}}
\end{picture}
}

\newcommand{\lineDn}{
\begin{picture}(10,10)(0,0)
\put(0,10){\line(1,-1){10}}
\end{picture}
}

\begin{array}{ccccccc}
\ &\ &\ &\mathrm{H}&\ &\ &\ \\
\ &\ &\ &\mid&\ &\ &\ \\
\ &\ &\ &\mathrm{C}&\ &\ &\ \\
\ &\ &\ &\lineUp \lineDn &\ &\ &\ \\
\ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\
\ &\ &\ &\mid\ \|&\ &\ \\
\ &\mathrm{H}&-&\mathrm{C}\ \mathrm{C}&-&\mathrm{H}\\
\ &\ &\ & \lineDn \lineUp &\ &\ &\ \\
\ &\ &\ &\mathrm{C}&\ &\ &\ \\
\ &\ &\ &\mid&\ &\ &\ \\
\ &\ &\ &\mathrm{H}&\ &\ &\ \\
\end{array}
[/tex]

Oh well... not too bad. The good thing is that you can play with the "picture" command to make it nicer.

Yeah, I just started playing around with it last night.
 
  • #184
[tex]

\newcommand{\lineUp}{\put(-10,-4){\line(1,1){20}}}
\newcommand{\lineDn}{\put(-9,13){\line(1,-1){20}}}

\newcommand{\dlineup}{\put(-10,0){\line(1,1){15}}\put(-6,-6){\line(1,1){15}}}

\newcommand{\dlinedn}{\put(-9,9){\line(1,-1){15}}\put(-5,15){\line(1,-1){15}}}

\begin {array}{ccccccccc}
\ &&&\ \ &\mathrm{H}&\ \ &&&\\

\ &&&&\mid&&&&\\
\ &&&\ \ &\mathrm{C}&\ \ &&&\\

\ &&&\dlineup&&\lineDn&&&\\

\mathrm{H}&-&\mathrm{C}&&&&\mathrm{C}&-&\mathrm{H}\\

\ &&\mid&&&&\mid\mid&&\\

\mathrm{H}&-&\mathrm{C}&&&&\mathrm{C}&-&\mathrm{H}\\

\ &&&\dlinedn&&\lineUp&&&\\

\ &&&\ \ &\mathrm{C}&\ \ &&&\\

\ &&&&\mid&&&&\\

\ &&&\ \ &\mathrm{H}&\ \ &&&


\end{array}
[/tex]

Okay, this is more like it!
 
  • #185
Before you guys spend all your time reinventing the wheel, why don't you see if there's a LaTeX package to display chemical structures this way?

- Warren
 
  • #186
Maybe this one?

http://www.educat.hu-berlin.de/~voss/LaTeX/misc/chemistry.phtml

- Warren
 
Last edited by a moderator:
  • #187
Originally posted by chroot
Before you guys spend all your time reinventing the wheel, why don't you see if there's a LaTeX package to display chemical structures this way?

- Warren

But it's more FUN this way!
 
  • #188
This is a very long statement with some chemical formulas like [tex]
\inline{H_2 O}[/tex] stuck into gauge how the alignment tags are affecting the image placement. And I might as well include some methane here too, just for fun: [tex]\inline{C H_4}[/tex]. I might even consider [tex]\inline{y = mx + b}[/tex] or [tex]\inline{\frac{1}{\sqrt{1 - v^2/c^2}}}[/tex] or even [tex]\inline{G_\textrm{diffeo}}[/tex]. Don't worry about this text, since it's not relevant!

And just to make sure the display mode formulas still work:

[tex]
e^x = \sum_{n=0}^\infty \frac{x^n}{n!} = \lim_{n\rightarrow\infty} (1+x/n)^n
[/tex]

versus including inline, like this [tex]\inline{e^x = \sum_{n=0}^\infty \frac{x^n}{n!} = \lim_{n\rightarrow\infty} (1+x/n)^n
}[/tex].

- Warren
 
Last edited:
  • #189
Let's see how this looks, embedding a little inline math inside a very long sentence: [tex]\inline{\sum_i x^i}[/tex]. I think it should look okay! Let's find out. Some formulas for common chemicals are [tex]\inline{CH_4}[/tex] and [tex]\inline{H_2 O}[/tex]. They're more likely to put things like [tex]\inline{x^2}[/tex] and so on, and I think that should look great! How about [tex]\inline{x}[/tex] and [tex]\inline{x^2}[/tex] and [tex]\inline{x_i}[/tex]...

There, how's that Monique?

- Warren
 
  • #190
I think it looks very nicely inline! There is still a problem though with text subscripts, which seem to be lower than number subscripts, see the following example. I think the font might be done a tiny bit smaller too.

In grade school, we were taught that when a hydrogen atom shares its electron with a chlorine atom, a covalent bond is formed. It holds together the new molecule, hydrogen chloride. Since this compound exists as a gas at standard conditions, it is designated by the chemical formula [tex]\inline{HCl_{(g)} }[/tex]. We also learned that when hydrogen chloride gas is dissolved in water, it becomes aqueous hydrogen chloride [tex]\inline{HCl_{(aq)} }[/tex]. The proper name for this is hydrochloric acid.

Later on, we were informed that the molecule does not remain whole once in an aqueous solution. It ionizes to form [tex]\inline{H^+_{(aq)}}[/tex] ions and [tex]\inline{Cl^-_{(aq)}}[/tex] ions. We were left with this notion, relatively unaltered, until the Bronsted-Lowry unit, where we learned that the [tex]\inline{H^+_{(aq)}}[/tex] ion actually reacts with a water molecule to form the hydronium ion: [tex]\inline{H_3O^+_{(aq)}}[/tex]. Another way of looking at it is that the water molecule accepts a proton “donation” from [tex]\inline{\HCl_{(aq)} }[/tex]. A crucial point in this unit was that a strong acid is defined as one that nearly completely dissociates (or is it ionizes?) in this manner.

Whoa! That’s the kicker. This means that the final products in the process of dissolving hydrogen chloride are almost entirely hydronium ions and chloride ions. This is the final “acidic” solution. It is the one that displays all of the empirical properties of an acid (i.e. conducts electricity, turns blue litmus red, has a pH < 7.0, etc.). These empirical properties can be attributed entirely to the hydronium ion. Put another way, in the final acidic solution, the so-called strong acid, [tex]\inline{HCl_{(aq)} }[/tex], is present in negligible quantities. So what is an acid, and how can we call [tex]\inline{HCl_{(aq)} }[/tex] an acid? Again, I emphasize that for all “strong acids”, the aqueous acidic solution is composed almost entirely of hydronium ions (and the corresponding anions). If this is true, then does the term “hydrochloric acid” really have any meaning at all?
 
  • #191
I'm sorry Monique, I'm not sure what you're talking about. Are you suggesting that [tex]\inline{HCl_{(g)} }[/tex] and [tex]\inline{CH_{(4)}}[/tex] look different? They don't. Perhaps you're suggesting that [tex]\inline{HCl_{(g)} }[/tex] and [tex]\inline{CH_{4}}[/tex] look different? They ought to. One has parentheses in the subscript, which are "tall" symbols, while the other does not. Remember that TeX has to lay things out to leave room for superscripts! Putting parentheses around a subscript will necessary push it downwards.

Oh, and as far as the size... HCl and [tex]\inline{HCl}[/tex] look pretty close to me.

- Warren
 
  • #192
This is just a test: [tex]\sin(\theta)[/tex]. Does this work? I imagine it will work nicely: [itex]\sin(\theta)[/itex]

- Warren
 

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
  • 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
417
  • Sticky
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
64
Views
183K
Replies
7
Views
231
  • Feedback and Announcements
Replies
24
Views
4K
Back
Top