In this practical we will be looking at using the Texevier package, and how you can write good looking academic pdfs.

First, I assume you’ve downloaded the Tinytex (back-end LaTeX engine) and Texevier packages (talks between R and LaTeX to make your writing experience flawless).

Now, let’s get set up with a simple Texevier pdf example.

  1. Create an empty folder.

  2. Copy the address in the address bar - and save it.

  3. Run the following code:

# Notice you have to replace backspaces with forward spaces...

Texevier::create_template(directory = "C:/Temp/Data_Science/Tex_Ex/",
                          template_name = "Project_Example",
                          build_project = T, open_project = T)

# you'll see the project built in: C:\Temp\Data_Science\Tex_Ex\Project_Example

If you open up the Rmd file now (that will produce your pdf), this is what you will see:

The yaml is the top part between the —’s on lines 1 and 96

This part is extremely sensitive to spacing and what you input, hence why I’ve commented out many parts that you can use to edit your layout.

Play around with this, seeing if you can e.g. add a cover page to your project (set Thesis_FP to TRUE) and add your name and the uni logo, e.g.

Other useful entries here are the abstract. Please limit spaces and certainly don’t use bullets here.

Also see if you can change the csl (referencing template as discussed on line 67 - 68)

For the remainder, play around with the formatting and make sure you understand how to use it.

References

To add a reference, e.g. Fama & French’s ’92 paper on factors, follow these steps:

  1. Go to googlescholar

  2. Search the paper (e.g. type ‘fama french 1992’) and click on the Cite button:

  1. Click on BibTex at the bottom:

  1. Copy this information as is - and save it in the Tex/ref.bib file in your folder:

  1. You can change the first part to what you like (e.g. it is now fama1992cross, but this can be fama1992paper), as long as it is unique.

  2. If you now add it in text (e.g. according to @fama1992cross) - this will be cited correctly and added into your bibliography. Easy.

See if you can build a generic write-up in this, and if you break it let me know.

Few other notables are:

  • to drop the numbering on a title (#) or subtitle (##) use the {-} after the name

  • For equations, you can align your equation with \[\begin{align} \end{align}\], and placing a & for where you want to align! See equation from 102 - 109

    • I typically type my equations as:
$$ 

\beta = \gamma

$$

This allows me to see the equation in Rmd! Only after I am happy, do I wrap it between begin{align} and end{align}. Please test this…

  • Notice that you can add R calcs / output in text using ‘r print(x)’ as done on line 144 (but with the skew tick below ~ on your keyboard). Cool right?

  • Adding label{Meth} (line 229) after section means you can reference it in text. See also that I label the equation in line 239 and plots and tables as well. In text, simply using references it.

 _italic_, __bold__ , 

Pdf HTML

Texevier can also create nice looking HTML ‘pdfs’ (htmls that read and print like a pdf).

As before, create an empty folder and run:

Texevier::create_template_html(directory = "C:/Temp/Data_Science/Tex_html/",
                          template_name = "html_ex",
                          build_project = T, open_project = T)

Notice that the yaml is now much simpler - so is the layout (intentionally so). Sprucing this up with css and html coding is trivial if you know these languages, but I don’t like to be fancy just for the sake of it.

Play around with this format too, and see if you can become comfortable with the formatting.

Conclusion

In the practical, I will ask you to do short formal write-up using Texevier’s pdf output as well as an informal html pdf output to questions asked.

Be sure you are comfortable with both templates please.

Remember too - your README is vital to explaining your thinking and functional processes to me in the practical.

Enjoy!