\(\color{gold}{\star \ \star} \quad \large{ \mathbb{\text{Doing That } \LaTeX \text{Thing}} } % Because knowing is half the battle! % % I hope you enjoy the tutorial as much as I did writing it. It's been fun! % % - Written by: AccessDenied, master of using an excessive amount of work in things % \) LaTeX is a very powerful and versatile tool for writing Mathematics. The Equation Editor gives you only a small glimpse into the true power of the language. My goal is to give you the power to write this LaTeX on your own and tap into that potential! Prepare to delve into the wonderful world of LaTeX! \(\color{orange}{\cdot} \quad \small{ \text{Experience will best supplement this tutorial. Try things out!} } \) \(\color{goldenrod}{\star} \quad \mathbb{\LaTeX \text{ Syntax; Formatting, Commands, and Environments}}\) \(\color{orange}{\cdot} \quad \text{Adding LaTeX to your Posts}\) Creating fine posts that will coexist with the LaTeX content requires that you know how to declare it in the posts correctly and effectively. There are two ways to declare it: block content and in-line content (sometimes referred to as "displayed" and "text," respectively). \(\cdot \quad\) Block content is inserted into the post as its own stand-alone element. The LaTeX is put on its own line. This type of LaTeX is applied by wrapping the code between the delimiters: \( \backslash [ \cdots \backslash ] \). \(\cdot \quad\) In-line content is inserted into the post with respect to its surroundings. This allows LaTeX to be inserted directly into paragraph explanations. This type is applied by using the delimiters: \( \backslash ( \cdots \backslash ) \). Which method you use is largely based on your purposes. Just remember that in-line is treated a tad differently from block content in that, it is made smaller and more compact than the block content by nature. This often affects placement of things like the stuff usually under the limit \( \lim \) where the in-line method places it to the side, as so: \( \lim_{x \to 4} \). This is fixed using a command (If you're interested, it is called \(\textbf{\limits}\) -- I won't go over it here). Another note (it is a minor point), in-line text will not wrap around the text-space unless it is preceded by something. Block content will always wrap around, however. One of the staples for LaTeX is the backslash \( \backslash \) symbol. It comes in on the declaration and the commands. It is also used to start a new line (double-backslash). That should help conserving the need for many individual LaTeX spaces. Okay, we got that out of the way! So, what can we do? You can type some basic equations in the LaTeX for the pretty, italicized font, but you'll quickly notice the limitations -- no spaces and no fancy font things... where is the fancy?! Well, we're getting there. \(\color{orange}{\cdot} \quad \text{Commands -- Adding in that functionality} \) Commands are the masters of the functionality you really want in the posts. They're very simple, too. The basic syntax of a command is as follows: \( \quad \boxed{ \quad \color{green}{\star} \quad \backslash \underline {\textit{name}} \{ \textit{argument}_1 \} \{ \textit{argument}_2 \} \ ... \qquad } \) It is most common for the command to have from zero to two arguments. These arguments are usually either switches for how the command works or the target of the command. There are many, many commands for LaTeX, more than I can even discuss honestly. We'll touch on the important / awesome ones, though. I leave it to you to search for the rest as you please. \( % Just AccessDenied adding some random comments to make sure you can't reuse it! % \) The first commands we should learn is for inserting text into the LaTeX correctly. You could try writing a message like "I love LaTeX!" directly, but it doesn't turn out right, as I shall present: \( \quad \boxed{ \quad \color{green}{\Rightarrow} \quad \text{I love LaTeX!} \qquad } \) \( \quad \boxed{ \quad \color{lime}{\Leftarrow} \quad I love LaTeX! \qquad } \) I'll use this kind of representation a lot for this tutorial. Just internalize that this is "input =>" "output <=" and you'll be good. On a more relevant note, however, we can see there is a serious lack of spacing. It's nowhere near as pretty as just typing it out... well, let's try out a command. \( \textbf{\text} \{ ... \} \) Well, it sounds aptly named. Let's try it out. \( \quad \boxed{ \quad \color{green}{\Rightarrow} \quad \text{\text{I love LaTeX!}} \qquad } \) \( \quad \boxed{ \quad \color{lime}{\Leftarrow} \quad \text{I love LaTeX!} \qquad } \) We have our spaces in and everything! Just for novelty, let's also use the \LaTeX command, which adds a nice label for the LaTeX name. \( \quad \boxed{ \quad \color{green}{\Rightarrow} \quad \text{\text{I love } \LaTeX !} \qquad } \) \( \quad \boxed{ \quad \color{lime}{\Leftarrow} \quad \text{I love } \LaTeX !} \qquad \) Notice that some commands are written with specific capitalized letters. Command names are case-sensitive, so be wary that some functions will not work without addressing that capital letter. Also notice that we have an extra space after "love." That space carries even outside of the command. Just keep those things in mind! The text command creates an environment apart from the Math space, which omits the spaces. However, spacing is still possible even without the text command. In fact, there are a lot of commands for spacing in the Math space. I'll just list them here. \[ \quad \begin{array}{|c|c|} \hline \textbf{Command} & \textbf{Effect} \\ \hline \backslash & \text{ Single space equivalent } \\ \backslash quad & \text{ Creates large horizontal space } \\ \backslash qquad & \text{ Two \quad } \\ \backslash , & \text{ Equals 3/18 a \quad } \\ \backslash : & \text{ Equals 4/18 a \quad } \\ \backslash ; & \text{ Equals 5/18 a \quad } \\ \backslash ! & \text{ Equals -3/18 a \quad } \\ \hline \end{array} \] What? An antispace!? Well, I guess antispaces may have uses somewhere. I never particularly found one, though. I guess if you wanted to create a 1/18 a \quad space or even -36/18... oh nevermind, not important! There are also the Mathematical functions. You could type them normally, but they're usually better oriented with the command. \[ \quad \begin{array}{|c|c|c|} \hline \text{\frac} & \text{_} & \text{^} \\ \hline \text{\sqrt} & & \\ \hline \text{\sin} & \text{arcsin} & \text{sinh} \\ \hline \text{\log} & \text{\ln} & \text{\exp} \\ \hline \text{\lim} & \text{\int} & \\ \hline \text{\sum} & \text{\prod} & \\ \hline \text{\mod} & \text{\inf} & \text{\sup} \\ \hline \end{array} \] That frac function is probably one of the big secrets of the Equation Editor and LaTeX here. The syntax of the fraction function is \frac{numerator}{denominator}. In addition, the root's index actually is placed into a weird place in square brackets (\sqrt[index] {content}) The majority of the others do come up on Equation Editor, however, and should be familiar if you've played with it before. \( % AccessDenied, adding in some special comments here and there % \) Lastly, I want to go over some modifying commands. This should wrap up the (useful) commands section. These commands are for changing the size and style of your writing in LaTeX. \[ \quad \begin{array}{|c|c|} \hline \textbf{Name} & \textbf{Explained} \\ \hline \text{rm} & \mathrm{Roman} \\ \text{it} & \mathit{Italicized} \\ \text{bf} & \mathbf{Bold} \\ \text{frak} & \mathfrak{Fraktur} \\ \text{cal} & \mathcal{Calligraphy} \\ \text{sf} & \mathsf{\text{Sans-serif}} \\ \hline \text{tiny} & \text{Tiny font} \\ \text{scriptsize} & \text{Size of a sub/super script} \\ \text{small} & \text{Small font} \\ \text{normalsize} & \text{Normal} \\ \text{large} & \text{Larger font} \\ \text{Large} & \text{Even larger font} \\ \text{LARGE} & \text{LARGE font} \\ \hline \text{color} & \color{green}{\text{Makes colors!}} \\ \hline \end{array} \] The first set of commands can come in a few forms, although some are exclusive to one form. All of the above forms may be stand-alone. These will not have arguments and apply to all the content in the space. The first three may be used appended to \text (i.e. \textrm{}, \textbf{}) for the same effect as if you used the stand-alone version and then \text{}, and only apply to a target-argument. All of these are also applicable at the end of a function "\math__" and will also apply to a target-argument. The sizes can either be left stand-alone to apply to their respective line, or be fed a target-argument for what should be made bigger. There are even larger sizes, but I find them overkill. The names are intuitive, though. Anything as "huge" as LARGE is absurd. The color command takes a color argument in either hexadecimal or nominal format (\color{#FF0000}{text} and \color{red}{text} do the same thing). As a test of our newfound skills, let's try to make a (considerably fancy) display for the slope-intercept form of lines! We would expect this to fail miserably, typing it directly into LaTeX: \( \quad \boxed{ \quad \color{green}{\Rightarrow} \quad \text{Slope-intercept form: y = mx + b} \qquad } \) \( \quad \boxed{ \quad \color{lime}{\Leftarrow} \quad Slope-intercept form: y = mx + b \qquad } \) And it does. Now, let's surround the "Slope-intercept form: " in a \text{} command. \( \quad \boxed{ \quad \color{green}{\Rightarrow} \quad \text{\text{Slope-intercept form: } y = mx + b} \qquad } \) \( \quad \boxed{ \quad \color{lime}{\Leftarrow} \quad \text{Slope-intercept form: } y = mx + b \qquad } \) There we go! Finally, we'll make it bold by replacing \text with \textbf and add a \quad between the text and formula for horizontal spacing. \( \quad \boxed{ \quad \color{green}{\Rightarrow} \quad \text{\textbf{Slope-intercept form: } \quad y = mx + b} \qquad } \) \( \quad \boxed{ \quad \color{lime}{\Leftarrow} \quad \textbf{Slope-intercept form: } \quad y = mx + b \qquad } \) We're done! Looks a lot nicer than just writing it out, which would take way too little time! Well, let's end this section off and move onto the final part: Environments! \(\color{orange}{\cdot} \quad \text{Eco-friendly / Safe Environments} \) So, there's just one more thing to cover, called "environments." The name may sound a little funny, but I assure you that these are anything but lame! Environments allow for special conditions to be applied to the LaTeX space. There are two very useful ones. The first one is called "align." The alignment environment allows for the use of a special operator "&" that forces each line to line up at these points. Such an example for this environment could be a solution to the equation "2x + 3 = 9." \( \quad \boxed{ \begin{align} \quad & \color{green}{\Rightarrow}\quad \text{\begin{align}} \qquad \\ & \color{green}{\Rightarrow} \quad \ \text{ 2x + 3 &= 9} \qquad \\ & \color{green}{\Rightarrow} \quad \ \text{ 2x &= 6} \qquad \\ & \color{green}{\Rightarrow} \quad \ \text{ x &= 3} \qquad \\ & \color{green}{\Rightarrow} \quad \text{\end{align}} \qquad \end{align} } \) \( \quad \boxed{ \begin{align} \quad & \color{lime}{\Leftarrow} \quad & 2x + 3 &= 9 \qquad \\ & \color{lime}{\Leftarrow} & \quad 2x &= 6 \qquad \\ & \color{lime}{\Leftarrow} & \quad x &= 3 \qquad \end{align} } \) Notice that format. It starts with a "begin{align}" and ends with a "end{align}." This is how the environments will always be declared. It is mostly the same way with the array environment. Instead of "align", you just have the "array." However, the Array environment uses an extra parameter after the "begin{array}" part. We have to declare the alignment of each element in the table. We may optionally specify vertical separation. Also, the environment supports a command called \(\textbf{\hline}\) to make horizontal lines. The possibilities are: "l", "c", and "r." They stand for "left," "center," and "right alignment, respectively. So, to write the array header for a two-column array with all elements aligned to the right and no vertical bars, we'd use "begin{array}{rr} ... \end{array}." Similarly, if we wanted to add a vertical bar between the first and second item of each row, we'd use "begin{array}{r|r}." I will not create another example of arrays for the sake of making sure the post isn't going to explode. Instead, I want to give you the very plaintext version of my tutorial that includes a few uses of arrays already, so that you may see how it was all written as well! Enjoy! This will conclude the tutorial! I hope you have learned a thing or two on making LaTeX. Just remember that your creativity will drive the effectiveness of what you do with this. Personally, I thought the diagram of a rectangle I made with arrays was fairly nifty. \(% Disclaimer: I love you all very much for checking out the guide, and I apologize if I have missed any information. Fortunately, you may be able to Google and find things on LaTeX as well -- its a big subject! % \)