Chapter 1 Get Started 1.1
Why use PDFLaTeX?
PDFLaTeX in a programming language, patent-free, derived from LaTeX, which is used to create pdf of articles, reports, books and even letters or slides with professional layout. I first heard about LaTeX at the university, when I was about to give my Word based Master dissertation i.e. three months too late. Indeed, I met a classmate who had used LaTeX for her dissertation. At first sight, the difference between the two dissertations was huge. I could only faced it. If only I would have knew about it before, I would have saved time and energy when dealing with images, table and text. LaTeX is frequently used in the scientific world especially by academics, scientists and PhD students because it includes functionalities to deal with math formulaes, bibliographies and a clean layout for publication and theses. PDFLaTeX came up later on. Among the benefits of PDFLaTeX over LaTeX, we can insert hyperlinks easily and are alowed to insert images in png, jpeg, jpg, etc. PDFLaTeX has three pros which will save you time and help you gain in productivity. hardandsoftskills.com
4 sur 88
• You can define commands to apply a given rule to a specific function e.g. all important sections (function) should be in bold (rule) or each time I use \pdflatex I want it to be spelled PDFLaTeX. • You can write once a content common to several documents. That’s what I used to write the section presenting my products in my series of guides on the HTML language for WordPress users • You can insert a pdf file in your main document. • Once you have split your text into several tex files, it becomes easy to create variations of your pdf without having to write a second time all over again. You may need this if you plan to create an excerpt of your pdf to encourage your reader to download the document. • It is a text based document. It means that in 10, 20, 50 years, you’ll still be able to access to the source code without technical constraint. It is important in the professionnal world where some documents must be kept for several decades. It is also convenient for programmers who can read the content easily and use it for other activities.
Do you want to broadcast products with a professional touch and automate the creation process? PDFLaTeX is the right tool for you. It’s actually the solution I use to develop all my training products including this pdf . Have you already noticed that this guide was created with PDFLaTeX.
1.2
What is Not Covered in this Document?
Possibilities offered by PDFLaTeX are large. As this guide is an introduction to PDFLaTeX and not specifically designed for scientist, I’ve decided to not covered the syntax specific to math formulaes. I explains you how to insert a table of content. I don’t in details to create a table of content for graphics or tables. Those topics would be more
hardandsoftskills.com
5 sur 88
appropriate in an advanced course. For the same reason, we won’t see how to create a flowchart or mind map. Sometimes several syntaxes are available for a given result. But here, the idea is to focus on core components for you to get quick result. So, I’m only covering one possible syntax each time.
1.3
Create your first program in PDFLaTeX using ShareLaTeX
1.3.1
ShareLaTeX: a Free Online Tool
To start quickly, I would recommand you to use sharelatex.com. It will save you time to install the software on your computer. You can create a free account to start with. Later on, you’ll always be able to register for the pro version to use the share functionalities for projects involving several persons or to install it locally on your computer or server.
1.3.2
A Template Project in ShareLaTeX
When you create a project, you have several options. You can create an empty document or use a template. By default, the name of the file created in this projet is main.tex.
hardandsoftskills.com
6 sur 88
Template \documentclass{article} \usepackage[utf8]{inputenc}
\title{Test} \author{veronique.bourcier } \date{September 2017}
\usepackage{natbib} \usepackage{graphicx}
hardandsoftskills.com
7 sur 88
\begin{document}
\maketitle
\section{Introduction} There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable. There is another theory which states that this has already happened.
\begin{figure}[h!] \centering \includegraphics[scale=1.7]{universe.jpg} \caption{The Universe} \label{fig:univerise} \end{figure}
\section{Conclusion} ‘‘I always thought something was fundamentally wrong with the universe’’ \citep{adams1995hitchhiker}
\bibliographystyle{plain} \bibliography{references} \end{document}
hardandsoftskills.com
8 sur 88
1.3.3
What Code must Always be Present in a tex File?
The PDFLaTeX program must have at least three lines of code. The template provided by sharelatex.com also includes them: a \documentclass{} command (one line) and a document environment (two lines). command vs. environment You need to understand the concepts of command and environment to be able to use them properly in your document. A command is defined by a single line of code. An environment is defined by the \begin{} command and the \end{} command. The name of the environement is added in the curly brackets. Your text is added between these two commands.
Minimum (1/2) \documentclass{article} \begin{document} \end{document}
Between the first command, \documentclass{} and the document environment, we can add packages to have additional functionalities. The content of the pdf will be written in the document environment i.e. between \begin{document} and \end{document}. The template available in sharelatex.com creates an article (article). You can also create a report (report), a letter (letter), some slides (beamer) or a book (book) by changing the option. In the remaining of this document, we are working with the report option.
hardandsoftskills.com
9 sur 88
Minimum (2/2) \documentclass{report} \begin{document} \end{document} Note: Download minimum.tex
1.3.4
Compile the Program
As it it quite intuitive, you may already have noticed that you only need to select the program to compile and click on the Compile button of ShareLaTeX to generate the pdf . You can also use a shortcut on your keyboard: if you’re working with a Mac, use cmd + enter ; otherwise if you’re using a PC, use ctrl + enter.
1.3.5
Add an Abstract
You can add an abstract in your document! Add an Abstract \documentclass{report} \begin{document} \begin{abstract}
\end{abstract} \end{document} Note: Download abstract.tex
hardandsoftskills.com
10 sur 88
1.3.6
Create Chapters, Sections,...
Within your document environment, you can organise your text. Here is the hierarchy: Hierarchy \documentclass{report} \begin{document} \part{}
% uniquement avec "report" et "book"
\chapter{} % uniquement avec "report" et "book" \section{} \subsection{} \subsubsection{} \paragraphe{} \subparagraphe{} \end{document} Note: Download section.tex
Note that, adding an asterisk just before the curly brackets will remove the number of the chapter, section...
1.3.7
Add a Table of Contents
You can also add a table of contents and decide to include only numbered sections! By default, sections... with no number are not included in the table of contents. To add a given section not numbered in your table of contents, you’ll need \addcontentsline{} command.
hardandsoftskills.com
11 sur 88
Add a Table of Content \documentclass{report} \begin{document} \tableofcontents
\chapter{Exemple} \section{Section 1} \addcontentsline{toc}{section}{Section 2222} \section*{Section 2} \section*{Section 3} \section{Section 4} \end{document} Note: Download toc.tex
1.3.8
Add Comments
Comments belong to the B.A.BA of programming. A program with no comment becomes unreable by its author a few weeks after being written. In addition, comment syntax can be used to desactivate lines of code quickly and easily. Therefore it is important to know this syntax. In PDFLaTeX, the character used to create a comment is the percentage % . Anything on the line from this % character onward is a comment. Add Comments \documentclass{report} \begin{document} Bonjour % Voici un commentaire %----------------------------------%\href{https://...}{En savoir plus} \end{document} Note: Download comment.tex
hardandsoftskills.com
12 sur 88
1.3.9
For more information on ShareLaTeX...
...check the Facebook page of ShareLaTeX: facebook.com/ShareLaTeX. Now we have an overview, let me introduce you to all basics syntax you’ll need to create your first document.
hardandsoftskills.com
13 sur 88
General Information The Author After graduating at the University of Kent in a Master degree in Statistics and 10 years experiences as a SAS programmer in the pharmaceutical industry, I’m now sharing with you my IT skills on the plateforme hardandsoftskills.com for both individuals and businesses. I also run consulting activities to help structure programming divisions. I especially enjoy processes automation. I focus on clarity and simplification. PDFLaTeX is a good solution to go to the next level when it comes to documentation management. Thanks to my experience in SAS, PDFLaTeX et HTML, I’ve been able to select the most relevant syntaxes for you to be able to quickly implement your new skills and get professional visual outputs. You can insure greater consistency across documents and save time from working on page layout. Do you know about the other courses (HTML, SAS,...) available on hardandsoftskills.com? Can you think of any classmate, colleague, teacher or relative who could benefit from any of these course? Make sure you send them the link if the answer is yes.
Véronique Bourcier
[email protected]
hardandsoftskills.com
87 sur 88
Feedback Would you consider sending me your testimony for people to understand why this guide was useful to you and therefore potential for them too? If so, you can email me to
[email protected] with your name, your website (if you have one) and any other contact details you might want to appear on your testimony (linkedin, twitter, email address...) with a picture of you. If you have comments for improvement, feedback on spelling, unclarity, feel free to get in touch per email.
Copyright © xxformat GmbH. All rights reserved.
hardandsoftskills.com
88 sur 88