The document structure and paragraphs
Tags: latex, codenewbie
Published: 2021-01-27 22:34:35

Hello hello, welcome again, in the last post we have talked about how to compile the document and set the language, today I am going to give you a brief introduction to the structure of the document, the special characters, and some instructions to create paragraphs 

# Types of documents

In the last posts, I told you: 
> There are many types of documents in the LaTeX world

Of course, we are not going to cover every single type of document

> The type of document must be in the `\documentclass` option

- If you have forgotten that, you can check it [here](https://dev.to/latexteada/a-primer-to-your-first-document-the-sheet-and-language-5b4n)

The **type of document** is the structure that your document will have, this also determines what kind of commands you could use to give it the desired structure, and I explain this in the body of this document. You could be asking: What does he mean with *the structure*? thanks for ask that.

- In LaTeX documents, like a normal book you can create an index, a table of contents, there are some commands, like `\chapter` or `\section` that when you put that LaTeX recognize them and then it classifies those in the table of contents

And I am going to tell you what you can use where

## Book

I think these are self-explanatory, but if not, these document structures are used to create books and reports, you can use `\part`, `\chapter`, `\section`, `\subsection`, `\subsubsection` 
![booktype](https://dev-to-uploads.s3.amazonaws.com/i/ubw8phu2c9c4hv090tg4.png)
 
- Remember that the name of the section must be in curly braces `\section{nameOfYourSection}`

## Article 

You use this when you want to create an article or a document simpler than a book, you just can use `\section`, `\subsection`, `\subsubsection` 
![arttype](https://dev-to-uploads.s3.amazonaws.com/i/7g93losvdvmi3olltjh9.png)
 

### Remember

Book and Article are common types of documents, of course, there are other differences between these types of documents, not just the commands. I encourage you to explore them, you do not need more commands, in both, those commands are enough to notice the differences

### A tip

If you do not want that your chapter or subsection or any type of label that I just wrote is numbered, you just need to add `*` before the curly brace, for example, `\section*{mySection}`

# The Paragraphs
You can create a new paragraph in many ways, 

## Paragraph and subparagraph 
These are useful commands, these create a new paragraph with bold text, 
- `\paragraph{textInBold}` is aligned according with your document
- `\subparagraph{textInBold}` has an extra space, like if it were inside the text 
![paragraphs](https://dev-to-uploads.s3.amazonaws.com/i/ji9qde7y927clzfzl049.png)
 
The output is 
![Screenshot from 2021-01-27 16-14-32](https://dev-to-uploads.s3.amazonaws.com/i/metjcaof5eu0ctri4xc7.png)
 

## Other commands

- We denote a paragraph ending with `\\`, we can put more than one to create more space
![difpara](https://dev-to-uploads.s3.amazonaws.com/i/0utvxv6axg4yy6t45mjf.png)
 The output is 
![Screenshot from 2021-01-27 16-22-41](https://dev-to-uploads.s3.amazonaws.com/i/eqy7ydh4dnta2rmmjtyw.png)
 Sometimes we can not create a line skip with `\\`, an alternative is `\par`
- We create a new indented paragraph with `\par`, to avoid it we must put `\par\noindent` or we can set the size of the space with `\par\parindent=Xmm`
![thepara](https://dev-to-uploads.s3.amazonaws.com/i/ioi3o44szmwe0mj44qa2.png)
The output is
![Screenshot from 2021-01-27 16-30-28](https://dev-to-uploads.s3.amazonaws.com/i/ao7ropss9x3tcq3is3b2.png)
  
Did you notice? the first and the second paragraph are at the same level, that is because the first paragraph always is indented, however, the third paragraph has not indentation and you can compare

Thanks, this is all for today, do not forget and follow me in `@latexteada` 

See you :)