Skip to content

Commit

Permalink
Merge pull request #59 from aghaynes/master
Browse files Browse the repository at this point in the history
update to DCR-like branding
  • Loading branch information
aghaynes authored Sep 25, 2024
2 parents b93786f + 3152c9f commit d994969
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 58 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/R-CMD-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ jobs:

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
- uses: r-lib/actions/setup-r-dependencies@v2

- name: Install dependencies
run: |
remotes::install_cran("rcmdcheck")
install.packages("rcmdcheck")
install.packages('svn', repos = 'https://ctu-bern.r-universe.dev')
install.packages('testthat')
shell: Rscript {0}
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: CTUtemplate
Title: Example RStudio Project Templates
Author: Alan G. Haynes
Maintainer: Alan G. Haynes <[email protected]>
Version: 0.5.1
Version: 0.6.0
Description: Templates and functions for use in CTU Bern.
Depends:
R (>= 3.3.2)
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
CTUtemplate 0.6.0
---------------------
update templates to use DCR-like branding

CTUtemplate 0.5.1
---------------------
correct use_qmd_htmlrecruitment (it had previously downloaded the sample size report template)
Expand Down Expand Up @@ -104,4 +108,3 @@ CTUtemplate 0.0.4
---------------------
Addition of OneStageSS for sample size for an exact binomial test
Addition of redcap code for stata

6 changes: 5 additions & 1 deletion R/report_pdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ report_pdf <- function(report_template = find_resource("report", "report.tex"),

if(report_template == "default") report_template <- find_resource("report", "report.tex")

# copy cls and logo to new dir
# copy cls and logos to new dir
file.copy(find_resource("report", "ubreport.cls"),
file.path(getwd(), "ubreport.cls"))
file.copy(find_resource("report", "ub_16pt-cmyk.pdf"),
file.path(getwd(), "ub_16pt-cmyk.pdf"))
file.copy(find_resource("report", "dcr_cmyk.pdf"),
file.path(getwd(), "dcr_cmyk.pdf"))


base <- bookdown::pdf_document2(template = report_template,
Expand Down Expand Up @@ -66,6 +68,8 @@ report_pdf2 <- function(report_template = find_resource("report", "report.tex"),
file.path(getwd(), "ubreport.cls"))
file.copy(find_resource("report", "ub_16pt-cmyk.pdf"),
file.path(getwd(), "ub_16pt-cmyk.pdf"))
file.copy(find_resource("report", "dcr_cmyk.pdf"),
file.path(getwd(), "dcr_cmyk.pdf"))


base <- bookdown::pdf_document2(template = report_template,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# `CTUtemplate` <img src='man/figures/sticker.png' align="right" width="200">

[![](https://img.shields.io/badge/dev%20version-0.5.1-blue.svg)](https://github.com/CTU-Bern/CTUtemplate)
[![](https://img.shields.io/badge/dev%20version-0.6.0-blue.svg)](https://github.com/CTU-Bern/CTUtemplate)

`CTUtemplate` is a package to create a template directory structure (and
files) and also includes the CTUs annual safety report function.
Expand Down
Binary file not shown.
Binary file not shown.
38 changes: 19 additions & 19 deletions inst/rmarkdown/templates/report/resources/ubreport.clo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%%%%%%%%%%%%%%%%
%Project
%%%%%%%%%%%%%

\newcommand{\project}{
\def\projectnumber{xxx}
\def\projectname{Project name}
Expand All @@ -21,14 +21,14 @@
%Author
%%%%%%%%%%%%%%%%%%

\newcommand{\personalreport}{
\newcommand{\personalreport}{
\def\sign{Dr. Lukas B{\"u}tikofer}
\def\mystreet{Mittelstrasse 43}
\def\telnum{+41 31 631 35 10}
\def\faxnum{}
\def\email{lukas.buetikofer@ctu.unibe.ch}
\def\web{www.ctu.unibe.ch}
\def\job{Senior statistician}
\def\mystreet{Mittelstrasse 43}
\def\telnum{+41 31 631 35 10}
\def\faxnum{}
\def\email{[email protected]}
\def\web{www.dcr.unibe.ch}
\def\job{Senior statistician}
}


Expand All @@ -38,16 +38,16 @@

\newcommand{\reportenglish}{
\selectlanguage{USenglish}
\def\uni{University of Bern}
\def\faculty{Faculty of Medicine}
\def\dept{}
\def\institute{CTU Bern}
\def\addressline{CTU Bern, Mittelstrasse 43, CH-3012 Bern}
\def\zip{CH-3012}
\def\location{Bern}
\def\phone{Phone~}
\def\fax{Fax~}
\def\uni{University of Bern}
\def\faculty{Faculty of Medicine}
\def\dept{Department of Clinical Research}
\def\institute{}
\def\addressline{DCR, Mittelstrasse 43, CH-3012 Bern}
\def\zip{CH-3012}
\def\location{Bern}
\def\phone{Phone~}
\def\fax{Fax~}
\def\subjectname{\textsl{}}
}


115 changes: 92 additions & 23 deletions inst/rmarkdown/templates/report/resources/ubreport.cls
Original file line number Diff line number Diff line change
Expand Up @@ -139,42 +139,76 @@
\projectname: \reporttype \\
}
}

%footer on title page
\begin{picture}(-2,0)
\put(0,-200){
%\hspace{-3mm}
\parbox[t][24mm][t]{\fullwidthopen}{%
\raggedleft
\parbox[t][24mm][t]{\rightfield}{%
\fontfamily{phv}\fontsize{7.7}{9.43}\selectfont
\sign\\
\ifx\job\@empty \else \job\\ \fi
\institute\\
\mystreet\\
\zip\ \location\\
\ifx\telnum\@empty \else \telnum\\ \fi
\ifx\email\@empty \else \email\\ \fi
\ifx\web\@empty \else \web \fi
%\hspace{-3mm}
\parbox[t][24mm][t]{\fullwidthopen}{%
\raggedleft
\parbox[t][24mm][t]{\rightfield}{%
\fontfamily{phv}\fontsize{7.7}{9.43}\selectfont
\sign\\
\ifx\job\@empty \else \job\\ \fi
\dept\\
\mystreet\\
\zip\ \location\\
\ifx\telnum\@empty \else \telnum\\ \fi
\ifx\email\@empty \else \email\\ \fi
\ifx\web\@empty \else \web \fi
}
}
}
%unibe in footer
\put(-2,-240){
\parbox[b][44mm][t]{\fullwidthopen}{%
\ifthenelse{\boolean{@color}}
{\includegraphics[width=35mm]{ub_16pt-cmyk.pdf}}
{\includegraphics[width=35mm]{ub_16pt-bl.pdf}}
}
}
}
\end{picture}

%logo
%only DCR in header
\hspace{123mm}
\parbox[b][44mm][t]{\fullwidthopen}{%
\parbox[t][39mm][t]{\rightfield}{%
\parbox[t][20mm][t]{\rightfield}{%
\ifthenelse{\boolean{@color}}
{\includegraphics[width=45mm]{ub_16pt-cmyk.pdf}}
{\includegraphics[width=45mm]{ub_16pt-bl.pdf}}
{\includegraphics[width=50mm]{dcr_cmyk.pdf}}
{\includegraphics[width=50mm]{dcr_bw.pdf}}
}
\par
\fontfamily{phv}\fontsize{8.0}{10.0}\selectfont
\faculty\par\vspace{+6pt}
\ifx\dept\@empty \else \dept\par\vspace{+5pt} \fi
\raggedright\bfseries\institute\par
\fontfamily{phv}\fontsize{8.0}{11.0}\selectfont
\textbf{\faculty}\par\vspace{+1pt}
\ifx\dept\@empty \else \dept\par\vspace{+1pt} \fi
%\raggedright\bfseries\institute\par
}



%DCR and unibe in header
%\parbox[b][44mm][t]{\fullwidthopen}{%
% \parbox{0.3\fullwidthopen}{%
% \hspace{0.3\fullwidthopen}
% }
% \parbox{0.4\fullwidthopen}{%
% \centering
% \ifthenelse{\boolean{@color}}
% {\includegraphics[width=45mm]{logo/dcr_cmyk.pdf}}
% {\includegraphics[width=45mm]{logo/dcr_bw.pdf}}
%
% }
% \parbox{0.3\fullwidthopen}{%
% \raggedleft
% \ifthenelse{\boolean{@color}}
% {\includegraphics[width=40mm]{logo/ub_16pt-cmyk.pdf}}
% {\includegraphics[width=40mm]{logo/ub_16pt-bl.pdf}}
% }
%}
}


\def\mainfoot{}


Expand All @@ -189,13 +223,48 @@
\projectname: \reporttype \\
}
}

%only DCR
\hspace{10mm}
\parbox[b][32mm][t]{\fullwidthcont}{
\raggedleft{%
\ifthenelse{\boolean{@color}}
{\includegraphics[width=27.4mm]{ub_16pt-cmyk.pdf}}
{\includegraphics[width=27.4mm]{ub_16pt-bl.pdf}}
{\includegraphics[width=45mm]{dcr_cmyk.pdf}}
{\includegraphics[width=45mm]{dcr_bw.pdf}}
}
}

%DCR and unibe
%\parbox[b][32mm][t]{\fullwidthopen}{
% \parbox{0.3\fullwidthopen}{%
% \hspace{0.3\fullwidthopen}
% }
% \parbox{0.4\fullwidthopen}{%
% \centering
% \ifthenelse{\boolean{@color}}
% {\includegraphics[width=34.25mm]{logo/dcr_cmyk.pdf}}
% {\includegraphics[width=34.25mm]{logo/dcr_bw.pdf}}
%
% }
% \parbox{0.3\fullwidthopen}{%
% \raggedleft
% \ifthenelse{\boolean{@color}}
% {\includegraphics[width=27.4mm]{logo/ub_16pt-cmyk.pdf}}
% {\includegraphics[width=27.4mm]{logo/ub_16pt-bl.pdf}}
% }
%}

%footer
\begin{picture}(-2,0)
%unibe in footer
\put(-490,-745){
\parbox[b][44mm][t]{\fullwidthopen}{%
\ifthenelse{\boolean{@color}}
{\includegraphics[width=25mm]{ub_16pt-cmyk.pdf}}
{\includegraphics[width=25mm]{ub_16pt-bl.pdf}}
}
}
\end{picture}
}

%right aligned page number
Expand Down
8 changes: 4 additions & 4 deletions inst/templates/ubreport.clo
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
\def\telnum{+41 31 631 35 10}
\def\faxnum{}
\def\email{{{email}}}
\def\web{www.ctu.unibe.ch}
\def\web{www.dcr.unibe.ch}
\def\job{{{job}}}
}

Expand All @@ -40,9 +40,9 @@
\selectlanguage{USenglish}
\def\uni{University of Bern}
\def\faculty{Faculty of Medicine}
\def\dept{}
\def\institute{CTU Bern}
\def\addressline{CTU Bern, Mittelstrasse 43, CH-3012 Bern}
\def\dept{Department of Clinical Research}
\def\institute{}
\def\addressline{DCR, Mittelstrasse 43, CH-3012 Bern}
\def\zip{CH-3012}
\def\location{Bern}
\def\phone{Phone~}
Expand Down

0 comments on commit d994969

Please sign in to comment.