Here in All About Circuits, users often have to communicate ideas through mathematical formulas.
An example is the diode equation.
Who would want to decipher this expression: I=Is(e^(Vd/(nVT))-1)?
On the other hand, the same expression is much more appealing in this form: \(I=I_s \cdot \left(e^{\small{\frac{V_d}{n \cdot V_T}}}-1 \right)\)
That formatting was possible thanks to the ability of the AAC forum to process LaTeX code. LaTeX is a document markup language and document preparation system. It allows us to prepare our text exactly how we want, both in font and paragraph formatting.
In this tutorial we will only examine mathematical formula formatting.
So let's learn how we can write mathematical formulas that are easy to read and understand.
First of all, the way to implement LaTeX code in your text is to include in the appropriate delimiters.
Any code inside those delimiters will be processed by the LaTeX compiler. Notice that any space characters are ignored, as they serve no other purpose than embellishing the look of your code.
LaTeX is based on commands that have objects as their arguments. By default, a single character is considered an object distinct by the next character. If, for some reason we want to group many characters into a single object we can include them in curly brackets:
Commands in LaTeX start with the backslash character "\". Anything that follows will be compared with the known commands and the appropriate action will be taken. It is good practice to enter a space right after the command identifier if it seems not to get compiled correctly.
Now that the theory is over, on to the fun stuff:
Subscript
\(T_s=44kHz\)
\(E_{total}=E_{kinetic}+E_{dynamic}\)
Notice the use of the curly brackets to define objects. If I had omitted the outcome would be this:
\(E_total=E_kinetic+E_dynamic\)
Superscript
This works exactly like subscript:
\(P=I^2R\)
\(f=a^{2n^2}\)
Fractions
Time for our first command:
\(f=\frac{1}{T}\)
The first argument is the nominator and the second is the denominator.
Parentheses
A simple parenthesis often looks out of place in certain expressions:
\(f=30(1+x^{\frac12})\)
We can fix this by entering the commands \left and \right before each delimiter:
\(f=30\left(1+x^{\frac12}\right)\)
That way the parentheses will be set as high as their contents.
Integrals
\(F(x)=\int f(x)dx\)
\(I=\int ^a_b f(x)dx\)
Notice that the same code without a space after the \int gives an error. When in doubt, add spaces (not C4).
\(F(x)=\intf(x)dx\)
Limits
In writing limits, we will introduce our first symbol. Symbols are special characters that can be entered by typing their codename after the backslash. The symbol we will use is the "approaches":
\(\to\)
\(\lim_{x \to 0}\frac{sin(x)}{x}=1\)
Roots
\(\sqrt{-1}=i\)
\(\sqrt[3]{8}=2\)
Symbols
Below is a list of useful symbols that are commonly used:
Operators:
\(\equiv \neq \simeq \propto \in \leq \geq\)
Arrows:
\(\leftarrow \Leftarrow \rightarrow \Rightarrow \leftrightarrow \Leftrightarrow\)
Greek Letters:
\(\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \mu \nu \xi \pi \rho \sigma \tau \phi \chi \psi \omega\)
You can capitalize, where applicable, the letter symbols by writing the first letter of the code in capital.
\(\sin \ \cos \ \tan \ \arccos \ \arcsin \ \arctan \ \log \ \ln\)
The use of the extra backslashes is to introduce spaces and will be explained soon.
Other symbols:
\(\sum \prod \oint \iint \infty \nabla \partial \Im \Re\)
Accents
All of the objects can have an accent. The most common ones are:
\(\dot x \ddot x \bar x \vec x \tilde x\)
Whitespaces and Newlines
Notice how the LaTeX editor interprets this code:
\(x_1+x_2=7 and
x_1-x_2=35\)
My intention was to insert a space before "and" and a double newline between the equations. However, the editor won't compile whitespaces and blank lines.
In order to do that, we must escape the whitespace and fill the blank line with a whitespace. Moreover, the character for the newline is also the double backslash:
\(x_1+x_2=7 \ and
\
x_1-x_2=35\)
\(first\ line\\second\ line\\third\ line\)
Text
It become obvious now that writing text inside the LaTeX code is somewhat cumbersome. To face that problem, we can use the \text command. This command also uses a Roman regular font for the text, instead of italics:
\(\text{first line
second line
third line}\)
An example is the diode equation.
Who would want to decipher this expression: I=Is(e^(Vd/(nVT))-1)?
On the other hand, the same expression is much more appealing in this form: \(I=I_s \cdot \left(e^{\small{\frac{V_d}{n \cdot V_T}}}-1 \right)\)
That formatting was possible thanks to the ability of the AAC forum to process LaTeX code. LaTeX is a document markup language and document preparation system. It allows us to prepare our text exactly how we want, both in font and paragraph formatting.
In this tutorial we will only examine mathematical formula formatting.
So let's learn how we can write mathematical formulas that are easy to read and understand.
First of all, the way to implement LaTeX code in your text is to include in the appropriate delimiters.
Rich (BB code):
[tex]yourcode[/tex]
LaTeX is based on commands that have objects as their arguments. By default, a single character is considered an object distinct by the next character. If, for some reason we want to group many characters into a single object we can include them in curly brackets:
Rich (BB code):
[tex]{single_object}[/tex]
Rich (BB code):
[tex]\command{obj1}{obj2}...[/tex]
Subscript
Rich (BB code):
[tex]T_S=44kHz[/tex]
Rich (BB code):
[tex]E_{total}=E_{kinetic}+E_{dynamic}[/tex]
Notice the use of the curly brackets to define objects. If I had omitted the outcome would be this:
\(E_total=E_kinetic+E_dynamic\)
Superscript
This works exactly like subscript:
Rich (BB code):
[tex]P=I^2R[/tex]
Rich (BB code):
[tex]f=a^{2n^2}[/tex]
Fractions
Time for our first command:
Rich (BB code):
[tex]f=\frac{1}{T}[/tex]
The first argument is the nominator and the second is the denominator.
Parentheses
A simple parenthesis often looks out of place in certain expressions:
Rich (BB code):
[tex]f=30(1+x^\frac12)[/tex]
We can fix this by entering the commands \left and \right before each delimiter:
Rich (BB code):
[tex]f=30\left(1+x^\frac12\right)[/tex]
That way the parentheses will be set as high as their contents.
Integrals
Rich (BB code):
[tex]F(x)=\int f(x)dx[/tex]
Rich (BB code):
[tex]I=\int ^a_b f(x)dx[/tex]
Notice that the same code without a space after the \int gives an error. When in doubt, add spaces (not C4).
Rich (BB code):
[tex]F(x)=\intf(x)dx[/tex]
Limits
In writing limits, we will introduce our first symbol. Symbols are special characters that can be entered by typing their codename after the backslash. The symbol we will use is the "approaches":
Rich (BB code):
[tex]\to[/tex]
Rich (BB code):
[tex]\lim_{x \to 0}\frac{sin(x)}{x}=1[/tex]
Roots
Rich (BB code):
[tex]\sqrt{-1}=i[/tex]
Rich (BB code):
[tex]\sqrt[3]{8}=2[/tex]
Symbols
Below is a list of useful symbols that are commonly used:
Operators:
Rich (BB code):
[tex]\cdot \times \div \pm \mp \cap \cup \wedge \vee[/tex]
\(\cdot \times \div \pm \mp \cap \cup \wedge \vee\)
[tex]\equiv \neq \simeq \propto \in \leq \geq[/tex]
Arrows:
Rich (BB code):
[tex]\leftarrow \Leftarrow \rightarrow \Rightarrow \leftrightarrow \Leftrightarrow[/tex]
Greek Letters:
Rich (BB code):
[/tex]\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \mu \nu \xi \pi \rho \sigma \tau \phi \chi \psi \omega[/tex]
You can capitalize, where applicable, the letter symbols by writing the first letter of the code in capital.
Rich (BB code):
[tex]\Omega[/tex][/code][tex]\Omega[/tex]
Functions:
Typically, common functions must be escaped, so as to display them in Roman font and not italic:
[CODE=rich][plain][tex]\sin \ \cos \ \tan \ \arccos \ \arcsin \ \arctan \ \log \ \ln[/tex]
The use of the extra backslashes is to introduce spaces and will be explained soon.
Other symbols:
Rich (BB code):
[tex]\sum \prod \oint \iint \infty \nabla \partial \Im \Re[/tex]
Accents
All of the objects can have an accent. The most common ones are:
Rich (BB code):
[tex]\dot x \ddot x \bar x \vec x \tilde x[/tex]
Whitespaces and Newlines
Notice how the LaTeX editor interprets this code:
Rich (BB code):
[tex]x_1+x_2=7 and
x_1-x_2=35[/tex]
x_1-x_2=35\)
My intention was to insert a space before "and" and a double newline between the equations. However, the editor won't compile whitespaces and blank lines.
In order to do that, we must escape the whitespace and fill the blank line with a whitespace. Moreover, the character for the newline is also the double backslash:
Rich (BB code):
[tex]x_1+x_2=7 \ and
\
x_1-x_2=35[/tex]
\
x_1-x_2=35\)
Rich (BB code):
[tex]first\ line\\second\ line\\third\ line[/tex]
Text
It become obvious now that writing text inside the LaTeX code is somewhat cumbersome. To face that problem, we can use the \text command. This command also uses a Roman regular font for the text, instead of italics:
Rich (BB code):
[tex]\text{first line
second line
third line}[/tex]
second line
third line}\)
Last edited: