Jump to content
Science Forums

Recommended Posts

Posted

NOTE: I am in the process of reworking this, it is still a decent reference, but i will be working on it, so expect changes

 

Intro:

This has been a long coming, endless traps have been setting the math evolutionary progress back throughout time, and you, Physics and Math people have been forced to use simple text equation display techniques to show complex math. Well, be that no longer, as i am about to introduce you to the world that no longer follows the standard text rules, it defies the normal thought, depends only on how far you are willing to take it and has no rivals in the realm of

Microsoft
/forums/images/smilies/devilsign.gif
. I will attempt to teach you how to block the evil force from taking control of you, make you free as in freedom, to be what you want to be and know no limit. And when the forces of evil can no longer hold you down (and i am referring to M$ IE support for CSS 2 and 3), you will enter the new realm of Latex.

how's that for an intro?
/forums/images/smilies/banana_sign.gif

 

Actually, it is quite sad that this hasn't happened any earlier, we are a scientific community, so the need for something like this, has bound to be around from very early on in the game (back when Uncle AL, TeleMad, FreeThinker, Gahd and Tormod ran the "Math and Physics" show). But i do have this to say, the software really hasn't caught up with this until early last year, so i guess it's just been ignored or something. Latex itself is a language, similar to HTML, but with major differences; it is a typesetting language made to be able to generate files that will be printable on many different types of printers. Latex is actually a dialect of Tex that was created by D.E.Knuth, it includes many plugins to the original Tex, including the one that i will describe to you today, one created for math.

 

So what is the major difference between Math v1.0 and Math v2.0? Well its simply this, say you have an expression, and in Math v1.0 you would write it like such:

f(x)=integral from -infinity to x of (e^(-t^2))/(radical(pi^x))dt

uh, yeah, its kinda hard to follow, and some people would actually need to write it out to understand what is going on.... Wouldn't it be easier if you said just:

[math]f(x)=\int_{-\infty}^x \frac{(e^{-t^2})}{\sqrt{\pi^x}}dt[/math]

So, finally arching your attention? I sure hope so, because i am excited as well, and it is not that difficult to write this expression, in latex it looks like this:

f(x)=\int_{-\infty}^x\frac{(e^{-t^2})}{\sqrt{\pi^x}}dt

It may seem a bit much, but trust me, this will be a breeze once you get it.

Basics:

BB Tags Hypography uses a [math] tag to signify the beginning and [/math] tag to signify the end of a latex section of the post. Tags are surrounded by square brackets such as [tag] and respectively [/tag]. I strongly urge you to not forget to close the tags, it is not vital, but it is a good practice, even if you only plan to display an expression

 

Tex Characters:

Most characters in latex are rendered as the regular characters, such as a-z 0-9 () {} [] * $ % and so forth [math]a-z 0-9 () [] * \$ \%[/math]. Some need escaping, such is the case with $ and % in our previous case, escaping means putting a \ in front like \$. But latex introduces some characters that have a meaning and render things differently (for math purposes) such characters would include the underscore (_) and the carat(^). Those characters are used to identify sub and superscript, respectively; for example a_b renders as [math]a_b[/math], a^b renders as [math]a^b[/math]. Latex also has a load of characters that are not defined by regular keyboards, they are special characters and follow the following syntax: \name. Things like \alpha, \beta, \gamma, \delta, \pi and many many others are included ftp://tug.ctan.org/pub/tex-archive/info/symbols/comprehensive/SYMLIST

Those character commands are case sensitive, so \delta [math]\delta[/math]is different from \Delta [math]\Delta[/math].

 

to be continued...

 

Continued

 

Size:

Latex supports many size options, the new software lets us support all of it, but for simplification reasons, any text you type, enclose it in the \text{} tag, you can actually control color, font and size from within those, but to simplify the size for you:

\tiny [math]\text{\tiny{tiny}}[/math]

\small [math]\text{\small{small}}[/math]

\normalsize (default)[math]\text{\normalsize{normal}}[/math]

\Large [math]\text{\Large{large}}[/math]

\LARGE [math]\text{\LARGE{even larger}}[/math]

\huge [math]\text{\huge{huge}}[/math]

 

I highly recommend using the default size... its just text

 

You have probably noticed, but latex in math mode also removes spaces thus not making it ideal to write normal text. Another thing to notice is that it outputs an image, however it is partly so, this image is dynamically generated and actually does not get saved on our server; it only exists in your browser, hence linking to it from other websites may be a bit harder then you'd expect, and if the outside traffic picks up too much, i will have to block anyone from the outside domain to be able to use this program...

Spaces and Styling:

Spaces are not mandatory, however i encourage my readers to use them to avoid confusion, for example you can write \frac{2}{x} and it will render as [math]\frac{2}{x}[/math], however this is fine it still presents a problem, if the fraction is x over 2 then \frac{x}{2} will not work, latex will render the command as fracx and that is not a valid command and hence a problem is due. To avoid confusion i recommend sticking to a good syntax style, such as using popper curly braces and spaces, you can either write that fraction as \frac x2 or using the prototype you should really get used to writing \frac{x}{2} that way you will not have to remember the braces when a complex fraction is due and the fraction or any function for that matter will come out right the first time. On the topic of spaces, i can see that people will ask about newlines and things of that manner. You can actually write text and use newlines and things of that nature. A new line is represented by a \\ and if you needed to write text, you can use the \text{} mode to write it and spaces and such will be used. For example y=\left\lbrace\begin{array}{c c}{2x+5} & \text{if x is less then 1/2} \\ {\pi{x}}^e & \text{if x is more then 1}\end{array}\right. [math]y=\left\lbrace\begin{array}{c c}{2x+5} & \text{if x is less then 1/2} \\ {\pi{x}}^e & \text{if x is more then 1}\end{array}\right.[/math] Latex actually provides spacing commands \, \: \; \quad \qquad, those take no arguments and (a\,b\:c\;d\ e\quad f\qquad g) renders as [math](a\,b\:c\;d\ e\quad f\qquad g)[/math]

 

Latex has a couple of fonts, here's how to use them:

\mathnormal - default - [math]\mathnormal{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathrm - default without italic lower case - [math]\mathrm{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathit - italic -[math]\mathit{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathbf - bold - [math]\mathbf{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathsf - sans serif - [math]\mathsf{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathtt - mono space - [math]\mathtt{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathcal - caligraphy - [math]\mathcal{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathfrak - fraktur - [math]\mathfrak{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

\mathbb - blackboard bold - [math]\mathbb{A B C d e f 1 2 3 \delta \Delta \infty \lceil \rceil}[/math]

 

you can also choose to bold a symbol (such as a greek symbol)

\boldsymbol

[math]\boldsymbol{\Delta} \Delta[/math]

 

also there are times when latex does not render something quite to your personal spacing specifications, sometimes you need to add or subtract a small space to "nudge" things into place, for this they created a set of spaces for "nudging"

 

\, 3/18th of a quad

\: 4/18

\; 5/18

\! -3/18

 

the negative space is handy for places like this:

[math]\left(\begin{array}{c} n \\ r \end{array}\right) = \frac{n!}{r!(n-r)!}[/math]

it looks good, but it could look better :)

[math]\left(\!\!\!\begin{array}{c} n \\ r \end{array}\!\!\!\right) = \frac{n!}{r!(n-r)!}[/math]

 

Brackets, Braces and More:

Ofcourse latex supports every imaginable and unimaginable bracet and brace you can ever imagine, from the simple [] () to over and under braces, and more. The curly brackets have their own symbol, as they are used in the syntax, \lbrace and \rbrace will render as [math]\lbrace\rbrace[\math]. Also braces brackets and such render as their default size unless they are specified to do differently, so if you have a complex fraction that you need to be bracketed, say [\frac{(\frac{x+3}{7})+5}{3x+8}] will render as [math][\frac{(\frac{x+3}{7})+5}{3x+8}][/math] however to actually extend those brackets you can use \left and \right flags to do the job, so with the addition of them \left[\frac{\left(\frac{x+3}{7}\right)+5}{3x+8}\right] [math]\left[\frac{\left(\frac{x+3}{7}\right)+5}{3x+8}\right][/math].

 

Now as promissed the unimaginable stuff. These things are referred to as math accents, and they include vector signs and things of that nature. So tags like \vec{} \hat{} \tilde{} \dot{} \ddot{} will output as [math]\vec{x} \hat{x} \tilde{x} \dot{x} \ddot{x}[/math]. If you need an expression under the sign, the developers have also thought about you, the \widevec \widehat \widetilde do just that [math]\vec{xyz} \hat{xyz} \tilde{xyz}[/math]. Not done yet, also available are \underline{} \overline{} that underline and overline text, as well as \overbrace and \underbrace that make horizontal braces as such [math]\overbrace{x+2}[/math]. There's more to add though, as the sub and superscript come into play here, using it you can explain expressions such is that a1 a2 .. an are just referred to as ai in the matter, you can write that as \overbrace{a_1,a_2...a_n}^{a_i} [math]\overbrace{a_1,a_2...a_n}^{a_i}[/math] with the underbrace remember that you are trying to put stuff under the brace, so use the subscript sign (_) to accomplish the task. Also once again, notice that proper use of brackets is the key, it is easy to make a mistake in the expression, so use the advanced mode preview fearute.

Also available symbols:

\langle and \range [math]\left\langle xyz\right\rangle[/math]

\| [math]\left\| xyz\right\|[/math]

 

Common Math Needs:

Matixees, use the \begin{matrix} and \end{matrix} to display one

\left[\begin{matrix} a1,1 & a1,2 & ... & a1,n \\ a2,1 & a2,2 & ... & a2,n \\ ..... & ..... & ..... & ..... \\ am,1 & am,2 & ... & am,n \end{matrix}\right]

[math]\left[\begin{matrix} a1,1 & a1,2 & ... & a1,n \\ a2,1 & a2,2 & ... & a2,n \\ ..... & ..... & ..... & ..... \\ am,1 & am,2 & ... & am,n \end{matrix}\right][/math]

 

matrix uses no relimiters

pmatrix ()

bmatrix []

Bmatrix {}

vmatrix |

Vmatrix || ||

 

example:

A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix}

[math]

A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix}

[/math]

 

like matrices arrays allow you to space your content horizontally as well as vertically, they also allow you to define the lining for it:

 

\begin{array}{c|c}

1 & 2 \\

\hline

3 & 4

\end{array}

 

[math]

\begin{array}{c|c}

1 & 2 \\

\hline

3 & 4 \\

\end{array}

[/math]

 

similarly

 

[math]

\begin{array}{c|c||}

\hline

1 & 2 \\

\hline

3 & 4 \\

\hline

5 & 6 \\

\hline

\end{array}

[/math]

 

or if you get really creative with them:

 

[math]

\begin{array}{|r|l|}

\hline

7C0 & hexadecimal \\

3700 & octal \\ \cline{2-2}

11111000000 & binary \\

\hline \hline

1984 & decimal \\

\hline

\end{array}

[/math]

 

There is more then a dozen common math symbols recognized in latex:

\arccos [math]\arccos{\left ( \frac{\pi}{2} \right )}[/math]

\arcsin [math]\arcsin{\left ( \frac{\pi}{2} \right )}[/math]

\arctan [math]\arctan{(1)}[/math]

\arg [math]\arg{\left ( \frac{-1-i}{i} \right )}[/math]

\cos [math]\cos{(\pi)}[/math]

\cosh [math]\cosh{(x)}[/math]

\cot [math]\cot{\left( \frac{3\pi}{2} \right )}[/math]

\coth [math]\coth{(x)}=\frac{e^{2x}+1}{e^{2x}-1}[/math]

\csc [math]\csc{(y)}[/math]

\deg [math]f_m([X])=\deg{f[Y]}[/math]

\det_ [math]\Delta_{\overline{a}} \det(A)=\overline{a} \times \overline{c}[/math]

\dim [math]\dim{X}=-1[/math]

\exp [math]\exp{(x)}=e^x[/math]

\gcd_ [math]\gcd{(a,b)}=2 \sum_{k=1}^{a-1} \lfloor kb/a \rfloor +a+b-ab[/math]

\hom [math]\hom{(X, Y)}[/math]

\inf_ [math]\inf{\{1,2,3\}}=1[/math]

\ker [math]\ker{T}:=\{ v \in V: Tv=0_w\}[/math]

\lg [math]\lg{(2)}=\log_2{(2)}[/math]

\lim_ [math]\lim_{x \to \infty}{(2x+1)}[/math]

\liminf_ [math]\liminf_{n \to \infty}{(x_n)}[/math]

\limsup_ [math]\limsup_{n \to \infty}{(x_n)}[/math]

\ln [math]\ln{(2)}=\log_{e}{(2)}[/math]

\log [math]\log{(2)}=\log_{10}{(2)}[/math]

\max_ [math]\lim_{0 \to 1}\max{(x, 1-x)}dx=\frac{3}{4}[/math]

\min_ [math]\lim_{0 \to 1}\min{(x, 1-x)}dx=\frac{1}{4}[/math]

\Pr_ no clue when this is used, if someone figures it out, let me know, i will post example

\sec [math]\sec{(20)}[/math]

\sin [math]\sin{\theta} = \cos{\left( \frac{\pi}{2} - \theta \right )}[/math]

\sinh [math]\sinh{(x)}=-i \sin{(ix)}[/math]

\sup_ [math]\sup{(X_n)}[/math]

\tan [math]\tan{(x)}[/math]

\tanh [math]\tanh{(x)}=\frac{\sinh(x)}{\cosh(x)}[/math]

\infty [math]\infty[/math]

 

Stuff that didn't fit anywhere else

\not can be used with other symbols \not\in [math]\not\in[/math]

\cancel [math]\cancel{ABC}[/math]

\overset{a}{=} [math]\overset{a}{=}[/math]

\underset{a}{=} [math]\underset{a}{=}[/math]

\overrightarrow{abc} [math]\overrightarrow{abc}[/math]

\overleftarrow{abc} [math]\overleftarrow{abc}[/math]

\widetilde{abc} [math]\overwidetilde{abc}[/math]

\widehat{abc} [math]\overwidehat{abc}[/math]

\overline{abc} [math]\overline{abc}[/math]

\underline{abc} [math]\underline{abc}[/math]

 

\subtrack

[math]

\sum_{\substack{

0<i<m \\

0<j<n

}}

P(i,j)

[/math]

 

more math stuff:

roots:

\sqrt [math]\sqrt{2}[/math]

root of another power

\sqrt[#] [math]\sqrt[5]{2}[/math]

 

\exists - [math]\exists[/math]

\forall - [math]\forall[/math]

\neg - [math]\neg[/math]

 

brackets:

() \, [] \, \{\} \, || \, \|\| \, \langle\rangle \, \lfloor\rfloor \, \lceil\rceil

[math]() \, [] \, \{\} \, || \, \|\| \, \langle\rangle \, \lfloor\rfloor \, \lceil\rceil

[/math]

 

You are free to practice latex in this thread: http://hypography.com/forums/test-forum/6620-latex-practice-ground.html

PLEASE ASK ALL YOUR QUESTIONS HERE

I will try to answer them as well I can, and eventually others will be able to answer them as well as they can, but it will create only one thread to go to for answers about latex synthax.

 

Here is a good reference, and this is my reference for some of the things on this page: LaTeX/Mathematics - Wikibooks, collection of open-content textbooks

 

Thanks for your time, use math v2.0 wisely, and become free in your expression of math...

Peace
/forums/images/smilies/banana_sign.gif
Posted

You mean the alignment is better now?

testing, [math]X^5[/math] one two three...

now, how does that look?

 

Huge! How do we get sizes right?

Posted

you should use a small case x, that or use \norm before the expression, i will explain more later, when i write up another section of the tutorial, but you can set size with:

\Large [math]\Large large text[/math]

\normalsize [math]\normalsize normal text[/math]

\small [math]\small small text[/math]

Posted

Finally, finished, please post what you want to see in the tutorial and i will add it. Also, Math v2.0 was a catchy name for this stuff, but i guess you made it make more sense...

 

I just made a practice thread in testing section quick link:

Click here to enter the LaTeX test area

You can use it to practice latex if you would choose to do so, however, and i emphasize this, ASK YOUR QUESTIONS HERE PLEASE, so anyone looking for an answer will have only one thread to refer to.

Thank you for your attention...

  • 2 weeks later...
Posted

Yep, LaTeX is great thing. Btw., I found one interesting program few days ago on iosoftware.co.uk and tried its trial. It supports LaTeX and visual editing simultaneosely. Though it doesn't support all Latex features, I found it useful in learning LaTeX.

  • 1 month later...
Posted

nice,

 

v{a} for vector... hmm

 

[math]v{a}[/math]

 

 

times for cross product

 

[math]v{a} \times v{a}[/math]

 

 

hmm, bullet for dot product... nice

 

[math]\nabla \bullet v{E}=\frac{\rho}{\epsilon_0}[/math]

 

 

 

[math]H_2+I_2 \leftrightarrow 2HI[/math]

  • 4 months later...
  • 1 year later...
Posted

just testing as the testing ground is down

 

[math]

\setlength{\unitlength}{5cm}

\begin{picture}(1,1)

\put(0,0){\line(0,1){1}}

\put(0,0){\line(1,0){1}}

\put(0,0){\line(1,1){1}}

\put(0,0){\line(1,2){.5}}

\put(0,0){\line(1,3){.3333}}

\put(0,0){\line(1,4){.25}}

\put(0,0){\line(1,5){.2}}

\put(0,0){\line(1,6){.1667}}

\put(0,0){\line(2,1){1}}

\put(0,0){\line(2,3){.6667}}

\put(0,0){\line(2,5){.4}}

\put(0,0){\line(3,1){1}}

\put(0,0){\line(3,2){1}}

\put(0,0){\line(3,4){.75}}

\put(0,0){\line(3,5){.6}}

\put(0,0){\line(4,1){1}}

\put(0,0){\line(4,3){1}}

\end{picture}[/math]

 

 

 

hopefully this will work

Posted
Seems to me there is a lot of "font size" etc in your code, I don't think that's supposed to be there.

yeah it keeps adding that fontsize thing there is none in the code

and im enclosing in latex

like

 

[math]y= mx + c[/math]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...