18
0

Compare commits

...

14 Commits

Author SHA1 Message Date
1c2bcf3929 Merge branch 'master' into knitr
Bring the knitr branch fully in sync with master: pulls in the memo
template, the article-class letter template, the README and script
updates (assignment -> memo), the embed-fonts pass on the poster
figure PDFs, and the wiki_page.wiki deletion.

Two small conflicts resolved by hand:

- paper_template/text.Rtex: git detected the rename text.tex ->
  text.Rtex and conflicted only around the knitr <<init>>= chunk,
  which is absent on master. Keep the chunk.
- paper_template/Makefile: whitespace-only conflict on the
  '%.pdf: %.tex' rule (master's version had a trailing space).
  Keep the trimmed version.

Built paper_template (with knitr) and letter_template; both are
UA-2 compliant under the merged state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 14:58:31 -07:00
a3e469ca3f paper_template (knitr): port to master's article + lualatex stack
Bring the knitr paper template up to date with the typography work
on master. The preamble now mirrors master's paper_template/text.tex:

- \DocumentMetadata{pdfstandard=ua-2} + tagpdf instead of the old
  memoir / pdfmanagement-only setup
- article class with cdsc-paper.sty (the article-class replacement
  for cdsc-memoir.sty added on master)
- fontspec with EB Garamond and TeX Gyre Heros, plus
  \defaultfontfeatures{Ligatures=TeX} so --, ---, ``, '' work
- Makefile builds with latexmk -lualatex instead of -pdf

The knitr-specific bits are preserved unchanged:

- <<init>>= chunk for knit_hooks and resources/preamble.R
- <<test_table>>= chunk demonstrating kable inside a table float
- %.tex: %.Rtex pattern rule for knit() in the Makefile

verapdf --flavour ua2: 0 failures, 1723 passed rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 09:47:22 -07:00
887dfdfa8b Merge branch 'master' into knitr 2026-03-29 10:31:59 -07:00
9b5ca55478 Merge branch 'master' into knitr 2026-03-23 12:49:32 +09:00
da76fb674e remove deprecated option to xcolor (usenames) 2026-03-23 12:47:39 +09:00
5af07a555f Merge branch 'master' into knitr
moving both versions from color to xcolor
2026-03-21 16:04:59 +09:00
d8e90cd7d3 Merge branch 'master' into knitr 2026-03-21 16:01:47 +09:00
c92fd3b8be Merge branch 'knitr' of ssh://gitea.communitydata.science:2200/collective/cdsc_tex into knitr 2026-03-21 16:01:09 +09:00
ec596703e2 fix color hook for newer knitr versions
Newer knitr injects \usepackage[]{xcolor} instead of \usepackage[]{color},
so the old hook never matched and dvipsnames colors (e.g. Blue) were undefined.
2026-03-21 15:55:24 +09:00
Jeremy Foote
ee4ba6c2b4 Changing to Rtex 2018-08-30 15:45:19 -05:00
54c07cb9f5 Merge branch 'master' into knitr
- copied over the new scripts
2018-08-04 11:22:33 -07:00
5526efbaee Merge branch 'master' into knitr
- merged in CDSC branding from the master branch
2018-08-04 11:12:16 -07:00
ce30e1ac61 hand-merged knitr material
- branch is now knitrified
- added material to the gitignore for tex files
2018-08-04 11:10:39 -07:00
c46fe4b78e rename tex to Rnw as part of knitr branch 2018-08-04 11:10:31 -07:00
5 changed files with 82 additions and 52 deletions

View File

@@ -13,3 +13,5 @@
/*.ttt
/*.bcf
/*.run.xml
/figures/*
/*.tex

View File

@@ -1,13 +1,11 @@
#!/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
%.pdf: %.tex
latexmk -f -lualatex $<
clean:
@@ -15,9 +13,9 @@ clean:
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

Binary file not shown.

View 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=""))
}
}

View File

@@ -13,6 +13,17 @@
\usepackage{tagpdf}
\tagpdfsetup{activate-all}
<<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{fontspec}
% fontspec disables the classic TeX input ligatures by default
% (-- => en-dash, --- => em-dash, `` and '' => curly quotes), so
@@ -54,7 +65,7 @@
\makeatother
\newcommand*\samethanks[1][\value{footnote}]{\footnotemark[#1]}
% add bibliographic stuff
% add bibliographic stuff
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[natbib=true, style=apa, backend=biber]{biblatex}
@@ -117,7 +128,7 @@ fox jumps over the lazy dog.
% between 45-90 characters and a rule of thumb for typesetting is that you
% should be able to fit between 2-3 alphabets on one line. Generally speaking,
% the shorter the line length, the better -- and the smaller the linespacing
% can become. The following line is 3 alphabets (73 characters).
% can become. The following line is 3 alphabets (73 characters).
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
@@ -137,45 +148,14 @@ 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}.
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
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 the lazy dog. The quick brown
fox jumps over the lazy dog \citep{989866}.
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
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 the lazy dog. The quick brown
fox jumps over the lazy dog \citep{989866}.
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
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 the lazy dog. The quick brown
fox jumps over the lazy dog \citep{989866}.
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
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 the lazy dog. The quick brown
fox jumps over the lazy dog \citep{989866}.
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
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 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
@@ -200,4 +180,4 @@ fox jumps over the lazy dog \citep{989866}.
\end{document}
% LocalWords:
% LocalWords: