Skip to content

Commit

Permalink
update to DCR-like branding
Browse files Browse the repository at this point in the history
  • Loading branch information
aghaynes committed Sep 25, 2024
1 parent fe6c80e commit a5f67e4
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 48 deletions.
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.0
Version: 0.6.0
Description: Templates and functions for use in CTU Bern.
Depends:
R (>= 3.3.2)
Expand Down
4 changes: 4 additions & 0 deletions 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.0
---------------------
addition of template R code for saving data as CSV
Expand Down
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
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 a5f67e4

Please sign in to comment.