# Do not be afraid of TEX! Easy awesome looking posts HOWTO

Discussion in 'General Electronics Chat' started by thatoneguy, Mar 28, 2009.

1. ### thatoneguy Thread Starter AAC Fanatic!

Feb 19, 2009
6,357
718
In a few minutes of practice and knowing the common commands shortcuts, make your posts very readable! This forum has the TEX engine built in, using tex tags (use {tex} to start, and {/tex} to end, replace { with [ and } with ], just like using a URL!

In addition to the "Fast pick" symbols to the right of a reply box, there is MUCH more you can do!

There is a drop-down pre-format list when you click on the Ʃ button, to the right of the second button row in the Advanced Editor. This brings up the TeX/LaTeX quick button bar. BTW, it is pronounced "Tech".

If you are not familar with LaTeX, the menu is not intuitive, however, but will be once you see the basics outlined here.

If you refer to this quickref, and use the equations with posts as often as needed, there are only FIVE THINGS you need to remember! You can then type in "fancy" formulas without relying on a click and fill system. When you preview or submit a post, the "code" is automaticallly turned into an image and linked inline with your post, as seen all over below!

The basic concepts: Parameters are held in braces {}, symbols/operators are used with \ preceeding, A few examples are shown below:

• Subscript: Inside the tex and /tex tags, this is easy. The 'command' is _ . Examples: $RDS_{ON}, V_{RMS \sim }, I_1$ For the single subscript, such as '1', no braces are needed, i.e. I_1, for more than one character, braces are used, such as RDS_{ON}. Subscripts can be "cascaded" as well, e.g. $I_{R}_{\small 1}$ If the overall image is too large, use the \small operator right after the opening tex tag.
• Superscript: This is as easy, and follows the same rules as subscript, but with a different operator. Just like exponent in computer languages, that operator is ^. So to write $2^2$, Use 2^2 inside tex tags! Simple, eh?
• If you are squaring or cubing things, you need to "undo" them in formulas. This is done with \sqrt. \sqrt takes one parameter and one optional, the number for the square root, $\sqrt{192}$. Remember, the full operand needs to be in braces, If I put 192 in the above without braces, it turns out like this: $\sqrt 192$ That is probably not what you were trying to say. For cube root, the more generic is \sqrt[root]{operand} So for the 4th root of 196, it is written \sqrt[4]{196} which displays as $\sqrt[4]{196}$ when the tex tags are around that same text. Notice the brackets instead of braces around the root!
• Logic. This is one area I'd like to see more use. For active low/inverted, use \overline{Val}, \overline{A} produces $\overline{A}$ Add in \cdot, the standard + sign on keyboard, and you can write any logic in "Textbook Quality". \overline A \cdot \overline B \cdot C + D produces: $\overline A \cdot \overline B \cdot C + D$. Of course, dots for working with matrices or in formulas such as 2*pi*f or: $\omega = 2 \cdot \pi \cdot f$. That last part, was written as \omega = 2 \cdot \pi \cdot f. Most greek letters are simply their name with a backslash, such as \Theta - $\Theta$
• An intro wouldn't be complete without Fractions: Many get stuck working with fractions. Simply remember that all commands are "Nestable", and it works out great! Balancing the {} braces can get hairy with a Very complex equation, but it usually isn't that hard. Preview post tells you immediately where something is missing with a little practice.
Here's the hard part about fractions: \fra or \frac, followed by {over}{under}. \frac{1}{2} = $\frac{1}{2}$ Shocking! I know. With nesting rules, the parallel resistance equation is fairly straightfoarward: \frac{1}{\frac{1}{R_1}+\frac{1}{R_2}+{\dots}+{\frac{1}{R_N}}} Becomes: $\fra{1}{\fra{1}{R_1}+\fra{1}{R_2}+{\dots}+{\fra{1}{R_N}}$

I hope this of some use to you, there are Many More commands and fun formatting available, but the ones above cover most of what is spoken of!

Here's to no more ugly formula questions!

Last edited: Mar 28, 2009
Vorador, soulo_ho3, Shagas and 15 others like this.
2. ### hgmjr Moderator

Jan 28, 2005
9,030
214
As an adjunct to thatoneguy's presentation, I would recommend that those interested in taking advantage of the Latex scripting language download the quick reference sheet at this link.

hgmjr

sonic007 and RRITESH KAKKAR like this.
3. ### Dave Retired Moderator

Nov 17, 2003
6,960
144
Thanks for writing this introduction thatoneguy, this will surely help those who are wary of using TEX. I'll drop a link in the FAQ.

Dave

RRITESH KAKKAR and amgad like this.
4. ### KL7AJ Senior Member

Nov 4, 2008
2,013
273
If TEX did nothing for you but creating snappy-looking math formulas, it would be well worth the time to learn. I've been using LaTeX, the Unix version of TEX (actually the FIRST version) for ages.

Eric

RRITESH KAKKAR likes this.
5. ### Wendy Moderator

Mar 24, 2008
20,735
2,499
It also allows you to display pictures full size in a post, either from an attachment as in here, or from AAC build in albums.

RRITESH KAKKAR likes this.
6. ### studiot AAC Fanatic!

Nov 9, 2007
5,005
513
Thanks for these tips, very grateful here.

I've managed to do some simple stuff here with TEX, but had it bomb out several times when trying for something more complex.

There seems to be some line length limit for instance. Any idea what this might be?

The other thing I can't seem to get right is changing some of the characters (eg for super/ sub script) to a smaller size.
Again any ideas welcome.

RRITESH KAKKAR likes this.
7. ### thatoneguy Thread Starter AAC Fanatic!

Feb 19, 2009
6,357
718
To make a new line, close the tex tag, and start a tex tag on the next one. Put a \ before each space, since it is in math mode (TeX) rather than LaTeX (Text) mode - As KL7AJ stated, LaTeX was Very widespread and "Standard formatting" for books and newspapers before desktop publishing took over. Some publishers still use LaTeX in addition to postscript.

\large and \small adjust font sizes, as well as several others: \tiny, \footnotesize, \Large, \LARGE, \Huge, \HUGE, \normalsize

^ is superscript and _ is subscript, I usually use \small before RMS - $V_{\tiny{RMS}}^{\small2}$ - by V_{\tiny{RMS}}^{\small2} with tex tags around it.

$\mathsf \tiny{This\ is\ tiny}$
$\mathsf \footnotesize{This\ is\ footnotesize}$
$\small{This\ is\ small}$
$\mathsf {This\ is\ normalsize}$
$\mathsf \large{This\ is\ large}$
$\mathsf \Large{This\ is\ Large}$
$\mathsf \LARGE{This\ is\ LARGE}$
$\mathsf \huge{This\ is\ huge}$
$\mathsf \Huge{This\ is\ Huge}$
$\mathsf \HUGE{This\ is\ HUGE}$

Testing a big TeX block: Everything below is in one tag, works OK:

$f(z) = \left\{ \begin{array}{rcl}
\overline{\overline{z^2}+\cos z} & \mbox{for}
& |z|<3 \\ 0 & \mbox{for} & 3\leq|z|\leq5 \\
\sin\overline{z} & \mbox{for} & |z|>5
\end{array}\right
\
\left( \begin{array}{cc} 2\tau & 7\phi-32\theta \\
3\psi & \frac{\pi}8 \end{array} \right)
\left( \begin{array}{c} x \\ y \end{array} \right)
\mbox{~and~} \left[ \begin{array}{cc|r}
3 & 4 & 5 \\ 1 & 3 & 729 \end{array} \right]$

--ETA: Simply quote this post to see the formatting if it is confusing!
That last two equations in the length test are from the reference Symbols.pdf posted above.

Last edited: Apr 13, 2009
RRITESH KAKKAR likes this.
8. ### studiot AAC Fanatic!

Nov 9, 2007
5,005
513
I hope you like questions, 'cause I've aplenty more.

Managed to get your tip on Greek letters working a treat in another thread just now.

RRITESH KAKKAR likes this.
9. ### thatoneguy Thread Starter AAC Fanatic!

Feb 19, 2009
6,357
718
Remember: TeX is Case Sensitive. \ theta and \Theta are not the same! One is the capital greek letter $\Theta$ (Theta) and the other is the small $\theta$ (theta) Same for Omega/omega $\Omega\ \omega$, etc...

RRITESH KAKKAR likes this.
10. ### thingmaker3 Retired Moderator

May 16, 2005
5,072
6
I just found the $\stackrel{"stackrel"}{command}$ which lets me do double-negatives: $\stackrel{=}{b}$=b

I think I am beginning "$\stackrel{stand}{to}$" LaTex.

edwardholmes91 likes this.

Jul 7, 2009
1,585
141
I'm new to AAC and I think it's fabulous that it supports TeX in posts. The ability to get the Greek letters commonly used by clicking at the right of the editing window is super too.

I used LaTeX about 8 or 10 years ago and liked it. However, I always found it a bit of a pain to find and get the necessary things downloaded and installed to get things working, especially on Windows. Thus, I find I use Open Office Writer almost exclusively now and it allows me to easily include the math stuff I want. Its equation editor will seem a bit familiar if you're used to TeX or LaTeX, but not quite as powerful. However, it has been adequate for all my needs. Open Office also comes with a pretty good drawing program for making pictures, as well as a spreadsheet and presentation program that has always been able to open its Microsoft counterparts' files.

Here's a brief introduction to some of OO Writer's math capabilities and here's the updated cheatsheet I keep next to my computer to help me remember things I can't remember.

12. ### John Luciani Active Member

Apr 3, 2007
477
0
Have you tried MiKTeX? I haven't used Windows for six years but when I did MiKTeX
worked quite well.

On Linux I download the TeXLive distribution. I am not sure if that plays nice with
Windows.

(* jcl *)

13. ### Thav Member

Oct 13, 2009
82
0
Use a pair of double backslashes to create newlines in a single tag.

For example:

i_C = C \dot {v_C} \\
v_L = L \dot {i_L}

in tags gives...

$
i_C = C \dot {v_C} \\
v_L = L \dot {i_L}
$

Without the slashes you get...

$
i_C = C \dot {v_C}
v_L = L \dot {i_L}
$

14. ### Dave Retired Moderator

Nov 17, 2003
6,960
144
That's a good one, I wasn't aware of that. Thanks.

Dave

15. ### Thav Member

Oct 13, 2009
82
0
No problem! I use it when writing in LaTeX and it happened to work here. Now what we really need is some additional commands defined. I use these in my LaTeX documents.

\newcommand{\dx}[1]{\mathrm{d}#1}
\newcommand{\ddt}{\frac{\mathrm{d}}{\dx{t}}}
\newcommand{\dxdt}[1]{\frac{\dx{#1}}{\dx{t}}}
\newcommand{\dxdy}[2]{\frac{\dx{#1}}{\dx{#2}}}

These make the "d"s not italicized so it's more clear they are not variables, but the differentiation operator. That would allow us to write say...

\dx{v}
\ddt
\dxdt{v}
\dxdy{v}{l}

and end up with

$
\mathrm{d}v \\
\frac{\mathrm{d}}{\mathrm{d}t} \\
\frac{\mathrm{d}v}{\mathrm{d}t} \\
\frac{\mathrm{d}v}{\mathrm{d}l}$

16. ### studiot AAC Fanatic!

Nov 9, 2007
5,005
513
Someone really knows his Latex.

I'd really love to be able to do some of this, eg layout fractions, superscipt and subscript easily.

17. ### Thav Member

Oct 13, 2009
82
0
I probably can't do much better than these guys! This is my favorite reference. http://en.wikibooks.org/wiki/LaTeX/Mathematics#Symbols (skipped past the environments which don't matter here)

I'm happy to answer questions by PM, and then I can post the result here for more examples.

18. ### turki@ksu New Member

Oct 25, 2009
2
0
Thanks for the useful post.

Let me try this:

$

\sqrt{5^2}=5

$

Nov 6, 2009
2
0
can you help with the following logic expression:

Z=(WX)+X+Y

20. ### thatoneguy Thread Starter AAC Fanatic!

Feb 19, 2009
6,357
718
$Z=(W\cdot X)+X+Y$

It is written the same, only adding the \cdot operator between W and X, and {tex} tags around it.