Giter VIP home page Giter VIP logo

latex's Introduction

Course

This is material for a small tutorial on LaTeX and reproducible document generation.

Install

For full productivity, install LaTeX and an editor, for which I suggest TexMaker.

To avoid installations, sign up at sharelatex or overleaf. Sharelatex seems to be slightly better and is open source.

R

For reprodicible research, automated report generation and syntax-higlighted code inclusion, use rmarkdown. To couple that with the power of LaTeX, you do have to install LaTeX locally.

Install a recent version of R and Rstudio.

In R, run install.packages("rmarkdown"), which will also install knitr.

In Rstudio, go to tools -> global options -> Sweave and set "weave Rnw files using" to knitr.

Test

To check whether everything is running, download and unzip the example presentation.

Open rdwd_pres.Rnw and click "compile PDF" (CTRL+SHIFT+K).

If LaTeX produces errors because no figures are created, try the following:

  • install the rdwd package manually with install.packages("rdwd") in R
  • remove the cache folder
  • compile again

Template

For my presentations, I am now using a template:

install.packages("berryFunctions")
berryFunctions::instGit("brry/berryFunctions") # createPres is not on CRAN yet
library(berryFunctions)
?createPres

Schedule

Part 1 (Berry, 1 hour)

  • 05 min: general LaTeX intro
  • 10: doc structure, document class beamer
  • 10: compiling
  • 05: sectioning
  • 10: including figures
  • 05: onslide, pause, <+->
  • 05: knitr intro
  • 10: real life example

10 min break

Part 2 (Irene, 45 min)

  • 05: document class
  • 10: subsections, Table of contents (TOC)
  • 10: tables (Website tex table generator)
  • 10: equations
  • 10: templates

Literature

For literature management, I recommend to use zotero as a Firefox addon. On journal article pages, simply save references into zotero, then export as BibLaTex file, e.g. myreferences.bib.

If (instead of just bibtex) you want to use the modern biblatex with biber, set the following:

  • In TexMaker - Options - configure TexMaker - Commands change the Bibtex entry from "bibtex %.aux" to "biber %" or "biber %.bcf".
  • In TexMaker - Options - configure TexMaker - Quick build select "PdfLaTeX + Bib(la)tex + PdfLaTeX (x2) + View pdf"
  • In the document itself, use \usepackage[backend=biber]{biblatex}, \bibliography{myreferences} and \printbibliography{}.

Here is a complete example (included as tex file along with myreferences.bib in the example folder):

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage[backend=biber,
  citestyle=authoryear,
  natbib=true,              % for \citet etc
  maxcitenames=2]{biblatex}
\bibliography{myreferences} % filename without file extension!

\begin{document}
This is random sample text, so go ahead and read our paper \citet{boessenkool_effects_2016} and  maybe also
\citet{allan_anticipated_2010}.

\printbibliography{}

\end{document}

latex's People

Contributors

brry avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.