Basics of LateX

In this post, we will explore more concepts about Latex the typesetting language.

Optional Commands

Optional commands appear in brackets [   ]  when you are using Latex. In the example below, we will set the font size to 20pt in the preamble of the document. The code is as follows.

\documentclass[4paper,12pt]{article} \begin{document} 
     Behold the power of \LaTeX
\end{document}

Here is what it looks like

Screenshot 2018-02-05 14:01:57.png

Inside the brackets, we set the paper size to A4 and the font size to 12pt. Many if not most commands have optional commands that can be used to customize the behavior of the document.

Comments

Like most coding languages Latex allows you to make comments. To do this you need to place a % sign in front of your comment. As shown below

\documentclass[4paper,12pt]{article} \begin{document} 
   Behold the power of \LaTeX
   %This will not print
\end{document}

Screenshot 2018-02-05 14:01:57

Everything after the % did not print. To stop this action simply press enter to move to the next line and you can continue with your document.

Fun with Fonts

There are many different ways to set the fonts. Generally, you can use the \text**{  } code. Where the asterisks are is where you can specify the behavior you want of the text. Below is a simple example of the use of several different formats to the font.

\documentclass[4paper,12pt]{article} 
\begin{document} 
   You can \textit{italicized} 
   Text can be \textsl{slanted} 
   Off course, you can \textbf{bold} text 
   You can also make text in \textsc{small caps} 
   It is also possible to use several commands at the same \textit{\textbf{time}} 
   Behold the power of \LaTeX  
\end{document}

Screenshot 2018-02-05 14:01:57.png

Notice how you put the command in front of the word that you want to format. This might seem cumbersome. However, once you get comfortable with this it is much faster to format documents then the point and click style of Word.

Environments

If you want a certain effect to last for awhile you can use an environment. An environment is a space you declare in your document in which a center behavior takes place. Generally, environments are used to improve the readability of your code. Below is an example.

\documentclass[4paper,12pt]{article} 
    \begin{document} 
        \begin{bfseries} 
            Everything is bold here 
        \end{bfseries} 
        \begin{itshape} 
            Everything is bold here 
        \end{itshape} 
        Behold the power of \LaTeX  
   \end{document}

Screenshot 2018-02-05 14:01:57

An environment always begins with the \begin command and ends with the \end command. In the curly braces, you type whatever is required for your formatting goals. There are scores of commands you can place inside the curly braces.

Conclusion

There is so much more to learn but this is just a beginning. One of the main benefits of learning Latex is the fixed nature of the formatting and the speed at which you can produce content once you are familiar with how to use this language.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.