I use LaTeX to type up programming homeworks for classes. I need to do this:
my line of text blah blah blah new line of text with blank line between
I know I can use double slash to break lines \\, but LaTeX will only take the first line break (complains about more) and starts a new line, it produces this :
my line of text blah blah blah new line of text with blank line between
How can I get that extra line break in there so I can have space between my lines of text?
There are three commands here that work the same in the example: \\ (two backslashes) \newline. \hfill \break.
\newpage \begin{center} \vspace*{1in} ABSTRACT \\ \vfill \singlespacing TITLE SINGLE-SPACED IN ALL CAPS, SAME SIZE AS THE REST OF THE TEXT \vfill %Should be 3 blank lines here. \doublespacing My name \\ My department \\ My degree \end{center} \vfill %Should be 3 blank lines here. Put text of the abstract here.
Latex has come up with another way to add a line break or skip a line within the data. Therefore, we will be using the \break command in the code to do so. Before that, we have added new text data as a paragraph within the \begin and \end command as below. Execute and run this code file by using both arrow icons.
The \\ command tells LaTeX to start a new line. It has an optional argument, extra-space , that specifies how much extra vertical space is to be inserted before the next line. This can be a negative amount.
Line break accepts an optional argument in brackets, a vertical length:
line 1 \\[4in] line 2
To make this more scalable with respect to font size, you can use other lengths, such as \\[3\baselineskip]
, or \\[3ex]
.
Do you want more space between paragraphs? Then you can change the parameter \parskip
.
For example, try
\setlength{\parskip}{10pt plus 1pt minus 1pt}
This means that the space between paragraphs is usually 10pt, but can grow or shrink by up to 1pt. This means you give LaTeX the ability to change it up to one 1pt in order to achieve a better page layout. You can remove the plus and minus parts to make it always your specified length.
If you are trying to display source code, try the listings
package or use verbatim
. If you are trying to typeset pseudocode, try the algorithm
package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With