Skip to content

Commit

Permalink
Fixed many minor issues. Still need to get abstract and other things …
Browse files Browse the repository at this point in the history
…printing. Need to add more YAML parameters too.
  • Loading branch information
ismayc committed Oct 9, 2015
1 parent fd319ba commit 1499ede
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 30 deletions.
3 changes: 2 additions & 1 deletion CLEANUP.R
@@ -1,3 +1,4 @@
unlink("MyReedThesis", recursive = TRUE)
devtools::install_github("ismayc/rticles")
rmarkdown::draft("MyReedThesis.rmd", template = "reed_thesis", package = "rticles", edit = TRUE)
rmarkdown::draft("MyReedThesis.rmd", template = "reed_thesis", package = "rticles",
edit = TRUE)
4 changes: 3 additions & 1 deletion R/reed_thesis.R
Expand Up @@ -2,7 +2,9 @@
reed_thesis <- function() {
template <- find_resource("reed_thesis", "template.tex")

base <- rmarkdown::pdf_document(template = template, keep_tex = TRUE)
base <- rmarkdown::pdf_document(template = template,
toc = toc,
keep_tex = TRUE)

# Mostly copied from knitr::render_sweave
base$knitr$opts_knit$out.format <- "sweave"
Expand Down
26 changes: 5 additions & 21 deletions README.md
@@ -1,26 +1,12 @@
### Overview

The **rticles** package includes a set of [R Markdown](http://rmarkdown.rstudio.com) templates that enable authoring of R related journal and conference submissions, and creating e-books. Available templates include:

- [Tuftish e-book] e-books formatted based on the style of Edward R. Tufte and Richard Feynman

- [JSS](http://www.jstatsoft.org/) articles

- [R Journal](http://journal.r-project.org/) articles

- [useR](http://user2014.stat.ucla.edu/) conference abstracts

- [Public Library of Science (PLoS)](http://www.plos.org/) articles

- [CTeX](http://ctex.org) documents

- [ACS](http://pubs.acs.org) articles
The **rticles** package includes a set of [R Markdown](http://rmarkdown.rstudio.com) templates that enable authoring of R related journal and conference submissions, and creating e-books.

Under the hood, LaTeX templates are used to ensure that documents conform precisely to submission standards. At the same time, composition and formatting can be done using lightweight [markdown](http://rmarkdown.rstudio.com/authoring_basics.html) syntax, and R code and its output can be seamlessly included using [knitr](http://yihui.name/knitr/).

Using **rticles** has some prerequisites which are described below. You can get most of these pre-requisites automatically by installing the latest preview release of RStudio (instructions for using **rticles** without RStudio are also provided).

### Using rticles from RStudio
### Using rticles from Chester's GitHub

To use **rticles** from RStudio:

Expand All @@ -29,7 +15,7 @@ To use **rticles** from RStudio:
2) Install the **rticles** package:

```S
devtools::install_github("rstudio/rticles")
devtools::install_github("ismayc/rticles")
```

3) Use the **New R Markdown** dialog to create an article from one of the templates:
Expand All @@ -44,14 +30,12 @@ devtools::install_github("rstudio/rticles")
2) Install the **rmarkdown** and **rticles** packages:

```S
devtools::install_github(c("rstudio/rmarkdown", "rstudio/rticles"))
devtools::install_github(c("rstudio/rmarkdown", "ismayc/rticles"))
```

3) Use the `rmarkdown::draft` function to create articles:

```S
rmarkdown::draft("MyAbstract.Rmd", template = "use_r_abstract", package = "rticles")
rmarkdown::draft("MyJSSArticle.Rmd", template = "jss_article", package = "rticles")
rmarkdown::draft("MyRJournalArticle", template = "rjournal_article", package = "rticles")
rmarkdown::draft("MyAbstract.Rmd", template = "reed_thesis", package = "rticles")
```

44 changes: 38 additions & 6 deletions inst/rmarkdown/templates/reed_thesis/resources/template.tex
Expand Up @@ -35,7 +35,6 @@
\usepackage{longtable,booktabs,setspace}
\usepackage{chemarr} %% Useful for one reaction arrow, useless if you're not a chem major
\usepackage[hyphens]{url}
%%%%%%% Commented out by CII
\usepackage{rotating}
\usepackage{natbib}
% Comment out the natbib line above and uncomment the following two lines to use the new
Expand Down Expand Up @@ -72,9 +71,6 @@
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

\author{
$for(author)$$author.name$\\$author.affiliation$$sep$ \And $endfor$
}
\title{$title.formatted$}
$if(keywords.formatted)$
\Keywords{$for(keywords.formatted)$$keywords.formatted$$sep$, $endfor$}
Expand All @@ -84,6 +80,10 @@
$abstract$
}

\Acknowledgements{
$acknowledgements$
}

\Plainauthor{$for(author)$$author.name$$sep$, $endfor$}
$if(title.plain)$
\Plaintitle{$title.plain$}
Expand Down Expand Up @@ -117,11 +117,43 @@

% $preamble$

\begin{document}
$if(title)$
\maketitle
$endif$

\frontmatter % this stuff will be roman-numbered
\pagestyle{empty} % this removes page numbers from the frontmatter

\begin{document}
$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$

$for(include-before)$
$include-before$

$endfor$
$if(toc)$
{
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$if(lot)$
\listoftables
$endif$
$if(lof)$
\listoffigures
$endif$



% \chapter*{\Acknowledgements{$acknowledgements$}}
% \chapter*{\Abstract{$abstract$}}

\maketitle

%\input{body_thesis.tex}

Expand Down
13 changes: 13 additions & 0 deletions inst/rmarkdown/templates/reed_thesis/skeleton/chap0.Rmd
@@ -0,0 +1,13 @@
---
output: pdf_document
---

Welcome to the \LaTeX\ thesis template. If you've never used \TeX\ or \LaTeX\ before, you'll have an initial learning period to go through, but the results of a nicely formatted thesis are worth it for more than the aesthetic benefit: markup like \LaTeX\ is more consistent than the output of a word processor, much less prone to corruption or crashing and the resulting file is smaller than a Word file. While you may have never had problems using Word in the past, your thesis is going to be about twice as large and complex as anything you've written before, taxing Word's capabilities. If you're still on the fence about using \LaTeX, read the Introduction to LaTeX on the CUS site as well as skim the following template and give it a few weeks. Pretty soon all the markup gibberish will become second nature.

\section{Why use it?}

\LaTeX\ does a great job of formatting tables and paragraphs. Its line-breaking algorithm was the subject of a PhD.\thinspace thesis. It does a fine job of automatically inserting ligatures, and to top it all off it is the only way to typeset good-looking mathematics.

\section{Who should use it?}

Anyone who needs to use math, tables, a lot of figures, complex cross-references, IPA or who just cares about the final appearance of their document should use \LaTeX. At Reed, math majors are required to use it, most physics majors will want to use it, and many other science majors may want it also.
19 changes: 19 additions & 0 deletions inst/rmarkdown/templates/reed_thesis/skeleton/chap1.Rmd
@@ -0,0 +1,19 @@
---
output: pdf_document
---

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r}
summary(cars)
```

You can also embed plots, for example:

```{r, echo=FALSE}
plot(cars)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
30 changes: 30 additions & 0 deletions inst/rmarkdown/templates/reed_thesis/skeleton/reedthesis.cls
Expand Up @@ -28,6 +28,8 @@
\ProcessOptions\relax
\LoadClass{book}
\RequirePackage{fancyhdr}
% Added by CII to produce nice looking code in BeginVerbatimEnvironment
\RequirePackage{fancyvrb}

% This gives us rules below the headers
\AtBeginDocument{%
Expand Down Expand Up @@ -170,6 +172,22 @@
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%%% Added by CII
\newenvironment{acknowledgements}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter[Acknowledgements]{}
\begin{center}
{\fontsize{14}{16}\selectfont \bfseries Acknowledgements}
\end{center}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%%%


\ifx\@pdfoutput\@undefined
\newcommand{\RTpercent}{\@percentchar\space}
\AtBeginDvi{\special{!\RTpercent Reed College LaTeX Thesis Class 2001/12/04 SN}}
Expand Down Expand Up @@ -251,3 +269,15 @@
\newcommand{\Abstract}[1]{\def\@Abstract{#1}}
\newcommand{\Keywords}[1]{\def\@Keywords{#1}}
\newcommand{\Plainkeywords}[1]{\def\@Plainkeywords{#1}}
\newcommand{\Acknowledgements}[1]{\def\@Acknowledgements{#1}}

%% Sweave(-like)
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}
\newenvironment{Schunk}{}{}
\DefineVerbatimEnvironment{Code}{Verbatim}{}
\DefineVerbatimEnvironment{CodeInput}{Verbatim}{fontshape=sl}
\DefineVerbatimEnvironment{CodeOutput}{Verbatim}{}
\newenvironment{CodeChunk}{}{}
% \setkeys{Gin}{width=0.8\textwidth}
19 changes: 18 additions & 1 deletion inst/rmarkdown/templates/reed_thesis/skeleton/skeleton.Rmd
Expand Up @@ -9,7 +9,11 @@ title:
short: "Reed Senior Thesis"
abstract: >
The abstract of your thesis.
output: rticles::reed_thesis
acknowledgements: >
I want to thank a few people.
output:
rticles::reed_thesis
# toc: true
---


Expand All @@ -24,3 +28,16 @@ if(!require(rticles)){
library(rticles)
}
```

\tableofcontents

\chapter*{Introduction}

```{r child = 'chap0.Rmd'}
```

\chapter{R Markdown}

```{r child = 'chap1.Rmd'}
```

0 comments on commit 1499ede

Please sign in to comment.