Compare commits
12 Commits
a0674e7f87
...
knitr
| Author | SHA1 | Date | |
|---|---|---|---|
| 887dfdfa8b | |||
| 9b5ca55478 | |||
| da76fb674e | |||
| 5af07a555f | |||
| d8e90cd7d3 | |||
| c92fd3b8be | |||
| ec596703e2 | |||
|
|
ee4ba6c2b4 | ||
| 54c07cb9f5 | |||
| 5526efbaee | |||
| ce30e1ac61 | |||
| c46fe4b78e |
67
assignment_template/HW1.tex
Normal file
67
assignment_template/HW1.tex
Normal file
@@ -0,0 +1,67 @@
|
||||
\documentclass[12pt]{memoir}
|
||||
|
||||
% article-1 and article-2 styles were originally based on kieran healy's
|
||||
% templates
|
||||
\usepackage{mako-mem}
|
||||
\chapterstyle{article-2}
|
||||
|
||||
% with article-3 \chapterstyle, change to: \pagestyle{memo}
|
||||
\pagestyle{mako-mem}
|
||||
|
||||
\usepackage[utf8]{inputenc}
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{textcomp}
|
||||
\usepackage[garamond]{mathdesign}
|
||||
|
||||
\usepackage[letterpaper,left=1.65in,right=1.65in,top=1.3in,bottom=1.2in]{geometry}
|
||||
|
||||
% packages i use in essentially every document
|
||||
\usepackage{graphicx}
|
||||
\usepackage{enumerate}
|
||||
|
||||
% packages i use in many documents but leave off by default
|
||||
% \usepackage{amsmath, amsthm, amssymb}
|
||||
% \usepackage{dcolumn}
|
||||
% \usepackage{endfloat}
|
||||
|
||||
% import and customize urls
|
||||
\usepackage[usenames,dvipsnames]{color}
|
||||
\usepackage[breaklinks]{hyperref}
|
||||
|
||||
\hypersetup{colorlinks=true, linkcolor=Black, citecolor=Black, filecolor=Blue,
|
||||
urlcolor=Blue, unicode=true}
|
||||
|
||||
% add bibliographic stuff
|
||||
% memoir function to take out of the space out of the whitespace lists
|
||||
\firmlists
|
||||
|
||||
% LATEX NOTE: these lines will import vc stuff after running `make vc` which
|
||||
% will add version control information to the bottom of each page. This can be
|
||||
% useful for keeping track of which version of a document somebody has:
|
||||
% \input{vc}
|
||||
% \pagestyle{mako-mem-git}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\setlength{\parskip}{4.5pt}
|
||||
% LATEX NOTE: Ideal linespacing is usually said to be between 120-140% the
|
||||
% typeface size. So, for 12pt (default in this document, we're looking for
|
||||
% somewhere between a 14.4-17.4pt \baselineskip. Single; 1.5 lines; and Double
|
||||
% in MSWord are equivalent to ~117%, 175%, and 233%.
|
||||
|
||||
\baselineskip 16pt
|
||||
|
||||
\title{Title}
|
||||
\author{Nathan TeGrotenhuis\\
|
||||
\href{mailto:nathante@uw.edu}{nathante@uw.edu}}
|
||||
\date{\today}
|
||||
|
||||
\maketitle
|
||||
|
||||
\section{Section}
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
% LocalWords:
|
||||
@@ -8,7 +8,7 @@ all: $(patsubst %.tex,%.pdf,$(wildcard *.tex))
|
||||
# Rscript -e "library(knitr); knit('$<')"
|
||||
|
||||
%.pdf: %.tex
|
||||
latexmk -f -lualatex $<
|
||||
latexmk -f -pdf $<
|
||||
|
||||
clean:
|
||||
latexmk -C *.tex
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
% >> article-1 <<
|
||||
\makechapterstyle{article-1}{
|
||||
\renewcommand{\rmdefault}{ugm}
|
||||
\renewcommand{\sfdefault}{phv}
|
||||
|
||||
\setsecheadstyle{\large\scshape}
|
||||
\setsubsecheadstyle{\normalsize\itshape}
|
||||
\renewcommand{\printchaptername}{}
|
||||
@@ -57,6 +60,9 @@
|
||||
|
||||
% >> article-2 <<
|
||||
\makechapterstyle{article-2}{
|
||||
\renewcommand{\rmdefault}{ugm}
|
||||
\renewcommand{\sfdefault}{phv}
|
||||
|
||||
\setsecheadstyle{\large\scshape}
|
||||
\setsubsecheadstyle{\normalsize\itshape}
|
||||
\setaftersubsubsecskip{-1em}
|
||||
@@ -112,6 +118,9 @@
|
||||
|
||||
% >> article-3 <<
|
||||
\makechapterstyle{article-3}{
|
||||
\renewcommand{\rmdefault}{ugm}
|
||||
\renewcommand{\sfdefault}{phv}
|
||||
|
||||
\setsecheadstyle{\large\sffamily\bfseries\MakeUppercase}
|
||||
\setsubsecheadstyle{\normalsize\itshape}
|
||||
\setaftersubsubsecskip{-1em}
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
% with article-3 \chapterstyle, change to: \pagestyle{memo}
|
||||
\pagestyle{mako-mem}
|
||||
|
||||
\usepackage{fontspec}
|
||||
\setmainfont{EB Garamond}
|
||||
\setsansfont{TeX Gyre Heros}
|
||||
\usepackage[utf8]{inputenc}
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{textcomp}
|
||||
\usepackage[garamond]{mathdesign}
|
||||
|
||||
\usepackage[letterpaper,left=1.65in,right=1.65in,top=1.3in,bottom=1.2in]{geometry}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
all: $(patsubst %.tex,%.pdf,$(wildcard *.tex))
|
||||
|
||||
%.pdf: %.tex
|
||||
latexmk -f -lualatex $<
|
||||
latexmk -f -pdf $<
|
||||
|
||||
clean:
|
||||
latexmk -C *.tex
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
\documentclass[12pt]{letter}
|
||||
|
||||
\usepackage{fontspec}
|
||||
\setmainfont{EB Garamond}
|
||||
\setsansfont{TeX Gyre Heros}
|
||||
\usepackage{ucs}
|
||||
\usepackage[utf8x]{inputenc}
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{textcomp}
|
||||
\renewcommand{\rmdefault}{ugm}
|
||||
\renewcommand{\sfdefault}{phv}
|
||||
\usepackage[garamond]{mathdesign}
|
||||
|
||||
\usepackage[letterpaper,left=1.3in,right=1.3in,top=0.8in,bottom=0.8in]{geometry}
|
||||
|
||||
|
||||
2
paper_template/.gitignore
vendored
2
paper_template/.gitignore
vendored
@@ -13,3 +13,5 @@
|
||||
/*.ttt
|
||||
/*.bcf
|
||||
/*.run.xml
|
||||
/figures/*
|
||||
/*.tex
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
#!/usr/bin/make
|
||||
|
||||
all: $(patsubst %.tex,%.pdf,$(wildcard *.tex))
|
||||
all: $(patsubst %.Rtex,%.pdf,$(wildcard *.Rtex))
|
||||
|
||||
# use the following section for Rnw/knitr documents
|
||||
# all: $(patsubst %.Rnw,%.pdf,$(wildcard *.Rnw))
|
||||
# %.tex: %.Rnw
|
||||
# Rscript -e "library(knitr); knit('$<')"
|
||||
%.tex: %.Rtex
|
||||
Rscript -e "library(knitr); knit('$<')"
|
||||
|
||||
%.pdf: %.tex
|
||||
latexmk -f -lualatex $<
|
||||
latexmk -f -pdf $<
|
||||
|
||||
clean:
|
||||
latexmk -C *.tex
|
||||
rm -f *.tmp *.run.xml
|
||||
rm -f vc
|
||||
rm -f *.bbl
|
||||
# the following lines are useful for Rnw/knitr
|
||||
# rm -rf cache/ figure/
|
||||
# rm -f *.tex
|
||||
# the following lines are useful for Rtex/knitr
|
||||
rm -rf cache/ figure/
|
||||
rm -f *.tex
|
||||
|
||||
viewpdf: all
|
||||
evince *.pdf
|
||||
@@ -27,4 +25,4 @@ vc: resources/vc-git
|
||||
pdf: all
|
||||
|
||||
.PHONY: clean all
|
||||
# .PRECIOUS: %.tex
|
||||
.PRECIOUS: %.tex
|
||||
|
||||
@@ -103,6 +103,10 @@
|
||||
% put a period after the section numbers
|
||||
\setsecnumformat{\csname the#1\endcsname.\enspace}
|
||||
|
||||
% set fonts to garamond and helvetica
|
||||
\renewcommand{\rmdefault}{ugm}
|
||||
\renewcommand{\sfdefault}{phv}
|
||||
|
||||
% material shared between the two modes
|
||||
|
||||
\setsubsecheadstyle{\normalsize\itshape}
|
||||
|
||||
BIN
paper_template/knitr_rdata/knitr_data.RData
Normal file
BIN
paper_template/knitr_rdata/knitr_data.RData
Normal file
Binary file not shown.
50
paper_template/resources/preamble.R
Normal file
50
paper_template/resources/preamble.R
Normal file
@@ -0,0 +1,50 @@
|
||||
bold <- function(x) {paste('{\\textbf{',x,'}}', sep ='')}
|
||||
gray <- function(x) {paste('{\\textcolor{gray}{',x,'}}', sep ='')}
|
||||
wrapify <- function (x) {paste("{", x, "}", sep="")}
|
||||
|
||||
# load("knitr_data.RData"); now broken up into small files so we'll bring 'em all in together
|
||||
r <- do.call("c", lapply(paste("knitr_rdata/", list.files("knitr_rdata"), sep=""),
|
||||
function (x) {load(x); return(r)}))
|
||||
|
||||
attach(r)
|
||||
|
||||
f <- function (x) {formatC(x, format="d", big.mark=',')}
|
||||
|
||||
format.percent <- function(x) {paste(f(x*100),"\\%",sep='')}
|
||||
|
||||
format.day.ordinal <- function(x) {
|
||||
day <- format(x,format="%d")
|
||||
daylast <- substr(day,nchar(day),nchar(day))
|
||||
dayfirst <- substr(day,1,1)
|
||||
if(dayfirst == '0')
|
||||
day = daylast
|
||||
|
||||
if( daylast == "1")
|
||||
day <- paste0(day,"st")
|
||||
else if(daylast == "2")
|
||||
day <- paste0(day,"nd")
|
||||
else if (daylast == "3")
|
||||
day <- paste0(day,"rd")
|
||||
else
|
||||
day <- paste0(day,"th")
|
||||
|
||||
return(day)
|
||||
}
|
||||
|
||||
format.month <- function(x){
|
||||
return( format(x,format='%B %Y'))
|
||||
}
|
||||
|
||||
format.date <- function(x) {
|
||||
return(paste(format(x,format = '%B'),format.day.ordinal(x),format(x,format='%Y'),sep=' '))
|
||||
}
|
||||
|
||||
format.pvalue <- function (x, digits=3) {
|
||||
threshold <- 1*10^(-1*digits)
|
||||
x <- round(x, digits)
|
||||
if (x < threshold) {
|
||||
return(paste("p<", threshold, sep=""))
|
||||
} else {
|
||||
return(paste("p=", x, sep=""))
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,24 @@
|
||||
% \published tag
|
||||
\chapterstyle{cdsc-article}
|
||||
|
||||
\usepackage{fontspec}
|
||||
\setmainfont{EB Garamond}
|
||||
\setsansfont{TeX Gyre Heros}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{wrapfig}
|
||||
|
||||
<<init, echo=FALSE>>=
|
||||
knit_hooks$set(document = function(x) {
|
||||
x <- sub('\\usepackage[]{xcolor}',
|
||||
'\\usepackage[dvipsnames]{xcolor}', x, fixed = TRUE)
|
||||
x
|
||||
})
|
||||
opts_chunk$set(fig.path="figures/knitr-")
|
||||
|
||||
source("resources/preamble.R")
|
||||
@
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{textcomp}
|
||||
\usepackage[garamond]{mathdesign}
|
||||
|
||||
\usepackage[letterpaper,left=1.65in,right=1.65in,top=1.3in,bottom=1.2in]{geometry}
|
||||
|
||||
% packages i use in essentially every document
|
||||
@@ -26,7 +39,6 @@
|
||||
% import and customize urls
|
||||
\usepackage[dvipsnames]{xcolor}
|
||||
\usepackage[breaklinks]{hyperref}
|
||||
|
||||
\hypersetup{colorlinks=true, linkcolor=Black, citecolor=Black, filecolor=Blue,
|
||||
urlcolor=Blue, unicode=true}
|
||||
|
||||
@@ -133,6 +145,15 @@ brown fox jumps over the lazy dog. The quick brown fox jumps over the
|
||||
lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
|
||||
fox jumps over the lazy dog \citep{989866}.
|
||||
|
||||
\begin{table}
|
||||
\centering
|
||||
<<test_table, echo=FALSE>>=
|
||||
kable(form.copy, format="latex")
|
||||
@
|
||||
\caption{This is a test table. There are \Sexpr{f(nrow(form.copy))} rows in the table.}
|
||||
\label{tab:test}
|
||||
\end{table}
|
||||
|
||||
The quick brown fox jumps over the lazy dog. The quick brown fox jumps
|
||||
over the lazy dog. The quick brown fox jumps over the lazy dog. The
|
||||
quick brown fox jumps over the lazy dog. The quick brown fox jumps over
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -88,13 +88,13 @@
|
||||
\usepackage{url}
|
||||
% \usepackage{dcolumn}
|
||||
% \usepackage{booktabs}
|
||||
% bibliography stuff — uncomment these if you load biblatex
|
||||
% \DeclareLanguageMapping{american}{american-apa}
|
||||
% \defbibheading{secbib}[\bibname]{%
|
||||
% \section{#1}%
|
||||
% \markboth{#1}{#1}%
|
||||
% \baselineskip 14.2pt%
|
||||
% \prebibhook}
|
||||
% bibliography stuff
|
||||
\DeclareLanguageMapping{american}{american-apa}
|
||||
\defbibheading{secbib}[\bibname]{%
|
||||
\section{#1}%
|
||||
\markboth{#1}{#1}%
|
||||
\baselineskip 14.2pt%
|
||||
\prebibhook}
|
||||
|
||||
\def\citepos#1{\citeauthor{#1}'s (\citeyear{#1})}
|
||||
\def\citespos#1{\citeauthor{#1}' (\citeyear{#1})}
|
||||
|
||||
Reference in New Issue
Block a user