GithubHelp home page GithubHelp logo

benmarwick / huskydown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ismayc/thesisdown

119.0 12.0 29.0 7.02 MB

An R Markdown template using the bookdown package for preparing a PhD thesis at the University of Washington

License: Other

R 15.30% TeX 82.82% Dockerfile 1.87%
rmarkdown rmarkdown-templates rmarkdown-template thesis-template latex-template latex-thesis-template

huskydown's Introduction

huskydown

Travis-CI Build Status

This project provides a template for writing a PhD thesis in R Markdown, and rendering those files into a PDF formatted according to the requirements of the University of Washington. It uses the University of Washington Thesis class to convert R Markdown files into a PDF formatted ready for submission at UW. This project was inspired by the thesisdown and bookdown packages.

Currently, the PDF and gitbook versions are fully-functional, and are the focus of this package. The word and epub versions are in development, have no templates behind them, and are essentially calls to the appropriate functions in bookdown.

If you are new to working with bookdown and rmarkdown, please read over the documentation available in huskydown PDF template (which you can create by following the simple instructions below) and the bookdown book.

Under the hood, the University of Washington Thesis LaTeX template is used to ensure that documents conform precisely to submission standards. At the same time, composition and formatting can be done using lightweight markdown syntax, and R code and its output can be seamlessly included using rmarkdown.

Using huskydown to write your PhD thesis

Initial setup

Using huskydown has some prerequisites, such as Pandoc, LaTeX and some fonts. To compile PDF documents using R, you need to have Pandoc, LaTeX and several related packages installed. If you have a recent version of RStudio, then you already have Pandoc and don't need to do anything more about that.

Next is LaTeX. By far the easiest way to install LaTeX on any platform is with the tinytex package:

install.packages(c('tinytex', 'rmarkdown'))
tinytex::install_tinytex()
# after restarting RStudio, confirm that you have LaTeX with 
tinytex:::is_tinytex()

Our PDF template requires some specific fonts, EB Garamond, Source Code Pro and Lato. These are included in this repository. You need to install these before proceeding, either by using your usual method of installing fonts, or following these instructions:

On a Linux system here's the simplest way to install the fonts:

git clone https://github.com/benmarwick/huskydown
cd huskydown && unzip inst/fonts.zip
cp inst/fonts -r ~/usr/local/share/fonts
sudo fc-cache -f -v

On an OSX system you can download a copy of the fonts in this repository with https://github.com/benmarwick/huskydown/raw/master/inst/fonts.zip, unzip and move them to your fonts directory, or, assuming homebrew is installed and updated, this will get you the fonts needed for this template:

brew update
brew tap caskroom/fonts
brew cask install font-eb-garamond font-source-code-pro font-lato

On Windows the usual pointing and clicking is required to install the fonts listed above. You can download a copy of the fonts in this repository at https://github.com/benmarwick/huskydown/raw/master/inst/fonts.zip, unzip and move them to your fonts directory.

Starting to write your thesis

To use huskydown from RStudio:

  1. Ensure that you have already installed LaTeX and the fonts described above, and are using the latest version of RStudio. You can use huskydown without RStudio. For example, you can write the Rmd files in your favourite text editor (e.g. Atom, Notepad++). But RStudio is probably the easiest tool for writing both R code and text in your thesis.

  2. Install the bookdown and huskydown packages:

if (!require("devtools")) install.packages("devtools", repos = "http://cran.rstudio.org")
devtools::install_github("rstudio/bookdown")
devtools::install_github("benmarwick/huskydown")
  1. Use the New R Markdown dialog to select Thesis, here are the steps, and a screenshot below:

File -> New File -> R Markdown... then choose 'From template', then choose 'UW-Thesis, and enter index as the Name. Note that this will currently only Knit if you name the directory index at this step.

Or if you're not using RStudio, run this line in your R console to create a new PhD thesis from the template:

rmarkdown::draft('index.Rmd', template = 'thesis', package = 'huskydown', create_dir = TRUE)

Day-to-day writing of your thesis

You need to edit the individual chapter R Markdown files to write your thesis.

You can write in the Rmd files without RStudio (in fact RStudio lacks some conveniences for writing, such as live spell-checking and live word count). So you may prefer to do some writing and editing your Rmd files in your favourite text editor. I frequently use Atom, Notepad++, and Emacs. But I come back to RStudio to create the PDF and work on the R code in my documents.

While writing, you should git commit your work frequently, after every major activity on your thesis. For example, every few paragraphs or section of text, and after major step of analysis development. You should git push at the end of each work session before you leave your computer or change task. For gentle novice-friendly guide to getting starting with using Git with R and RStudio, see http://happygitwithr.com/.

Rendering

To render your thesis into a PDF, open index.Rmd in RStudio and then click the "knit" button. To change the output formats between PDF, gitbook and Word , look at the output: field in index.Rmdand comment-out the formats you don't want.

Alternatively, if you're not using RStudio, you can use this from the R console, assuming your have set the 'index/ directory as your working directory:

bookdown::render_book('index.Rmd', huskydown::thesis_pdf(latex_engine = 'xelatex'))

The PDF file of your thesis will be deposited in the _book/ directory.

Components

The following components are ones you should edit to customize your thesis:

_bookdown.yml

This is the main configuration file for your thesis. It determines what Rmd files are included in the output, and in what order. Arrange the order of your chapters in this file and ensure that the names match the names in your folders.

index.Rmd

This file contains all the meta information that goes at the beginning of your document. You'll need to edit this to put your name on the first page, the title of your thesis, etc.

01-chap1.Rmd, 02-chap2.Rmd, etc.

These are the Rmd files for each chapter in your dissertation. Write your thesis in these. If you're writing in RStudio, you may find the wordcount addin useful for getting word counts and readability statistics in R markdown documents. You might also enjoy writing in these Rmd files with Atom, Notepad++, Sublime Text, and Emacs.

bib/

Store your bibliography (as bibtex files) here. We recommend using the citr addin and Zotero to efficiently manage and insert citations.

csl/

Specific style files for bibliographies should be stored here. A good source for citation styles is https://github.com/citation-style-language/styles#readme

figure/ and data/

Store your figures and data here and reference them in your R Markdown files. See the bookdown book for details on cross-referencing items using R Markdown.

Related projects

This project has drawn directly on code and ideas in the following:

Other relevant projects:

Contributing

If you would like to contribute to this project, please start by reading our Guide to Contributing. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

huskydown's People

Contributors

benmarwick avatar ismayc avatar nicksolomon avatar keurcien avatar rudeboybert avatar lchski avatar

Stargazers

June Yang avatar Wangqian (Will) Ju avatar  avatar Nathan Redon avatar Rick Scavetta avatar Ihsan Kahveci avatar Todd Nobles avatar Maia Sosa Kapur avatar Sayak Khatua avatar  avatar Tatako Felici avatar Tao Lin avatar Mark E. Madsen avatar sacha schutz avatar Roshan Paudel  avatar Cas Neyens avatar  avatar Elizabeth McBride avatar Wyatt Toure avatar Jessica Diallo avatar Raisul Islam avatar  avatar Alexandra Barroso avatar Guilherme C Brito avatar Malavika Rajeev avatar Xiangyun Huang avatar  avatar Wouter Van Rossem avatar Amelia Jade DuVall avatar Marie Zahn avatar  avatar AM avatar  avatar Arieda Muço avatar atanas avatar Francisco Maria Calisto avatar Diego Kozlowski avatar Hugo Quintero avatar Natalie Mastick avatar Abby Bratt avatar Özhan Fenerci avatar Andrei-WongE avatar  avatar Jiawei He avatar Spencer Pease avatar Marlena Bannick avatar J. Doris Dai avatar Emre Kesici, Ph.D avatar Ruby Marx avatar  avatar MH Manuel Haqiqatkhah avatar  avatar Maria Kamenetsky avatar  avatar HarryZhu avatar Brandon Kern avatar  avatar Nick Or avatar Luke Boelling avatar Leonardo Vida avatar Justin M. Shea avatar  avatar Chad Curtis avatar  avatar Yuri Dias avatar Eddie Kasner avatar Tyler Bradley avatar Taylor Hafley avatar Gerald Bauer avatar Iñaki avatar João Cascalheira avatar Tiernan Martin avatar John Blischak avatar  avatar Lu Han avatar Wei-Yang Tham avatar Paulo E. Cardoso avatar Jake Kaupp avatar Mirza Cengic avatar Andreas Angourakis avatar Francisco Rodriguez-Sanchez avatar Nicholas Tierney avatar Elizabeth Ng avatar Guilherme Pedrosa avatar TJ Mahr avatar Sean Anderson avatar Owen Parsons avatar  avatar Sigve Nakken avatar Ryan Peek avatar Sungpil Han avatar Grégoire Lurton avatar fuuuumin avatar Manuel Vogel avatar Tung N avatar Pierre-Guillaume Prigent avatar Gorka Navarrete avatar Dr. Yaamini R. Venkataraman avatar Sam May avatar Emil Tveden Bjerglund avatar

Watchers

James Cloos avatar  avatar  avatar Joseph Frostad avatar Christine avatar Chad Curtis avatar Gail Clement avatar Geoff LaFlair avatar Agnes Schneider avatar  avatar  avatar  avatar

huskydown's Issues

Failing to knit in times new roman font

Does anyone have any idea why it ends up knitting in an Arial type font, instead of times new roman (or equivalent?)

To Reproduce cls

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{glasgowthesis}[]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass{book}
\RequirePackage{fancyhdr}
\RequirePackage{fancyvrb}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
    \usepackage{xltxtra,xunicode}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  \newcommand{\euro}{b�,}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage{color}
%\newcommand{\VerbBar}{|}
%\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{verbatim}{Verbatim}{xleftmargin=-1em}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
% \newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
% \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}
% \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{{#1}}}
% \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
% \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
% \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
% \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\ImportTok}[1]{{#1}}
% \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{{#1}}}}
% \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{{#1}}}
% \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}
% \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{{#1}}}}
% \newcommand{\BuiltInTok}[1]{{#1}}
% \newcommand{\ExtensionTok}[1]{{#1}}
% \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{{#1}}}}
% \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{{#1}}}
% \newcommand{\RegionMarkerTok}[1]{{#1}}
% \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{{#1}}}
% \newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{{#1}}}}
% \newcommand{\NormalTok}[1]{{#1}}

\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% End of CII add

% This gives us rules below the headers
\AtBeginDocument{%
  \fancyhf{}
  \fancyhead[LE,RO]{\thepage}
	 \fancyhead[RE]{\slshape \nouppercase \leftmark} % This makes the headers on the RIGHT side pages be italic and use lowercase With Capitals When Specified. I dont think this works.
	\fancyhead[LO]{\slshape \nouppercase \rightmark} % This does the same thing to the LEFT side pages
  \pagestyle{fancy}

  \let\oldthebibliography=\thebibliography
  \let\endoldthebibliography=\endthebibliography
  \renewenvironment{thebibliography}[1]{
    \oldthebibliography{#1}
    \addcontentsline{toc}{chapter}{\bibname}
  }{\endoldthebibliography}

  \let\oldtheindex=\theindex
  \let\endoldtheindex=\endtheindex
  \renewenvironment{theindex}{
    \oldtheindex
    \addcontentsline{toc}{chapter}{\indexname}
  }{\endoldtheindex}
}

% Stolen from book.cls and modified
\let\RToldchapter\chapter
\renewcommand{\chapter}{\if@openright\RTcleardoublepage
		    \else\clearpage\fi
		    \thispagestyle{empty}%
		    \global\@topnum\z@
		    \@afterindentfalse
		    \secdef\@chapter\@schapter}

% Using this to actually show "Chapter 1" in TOC instead of "1"
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                         {\@chapapp\space\thechapter:\space#1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}

\newcommand{\RTcleardoublepage}{
	\clearpage\if@twoside \ifodd\c@page\else
	\thispagestyle{empty}\hbox{}\newpage
	\if@twocolumn\hbox{}\newpage\fi\fi\fi}

\let\RToldcleardoublepage\cleardoublepage
\renewcommand{\cleardoublepage}{\RTcleardoublepage}

%%% Margins
\usepackage[top=1.8cm, bottom=1.8cm,left=4.0cm,right=1.5cm]{geometry}
%\usepackage[margin=1in]{geometry} % 1 inch margin across all sides
% \oddsidemargin 0truemm % add for printing 
 \evensidemargin 15truemm % add for printing 
%%

%% Defined terms
\def\university#1{\gdef \@university{#1}}
\def\faculty#1{\gdef \@faculty{#1}}
\def\school#1{\gdef \@school{#1}}
\def\group#1{\gdef \@group{#1}}
\def\logo#1{\gdef \@logo{#1}}
\def\degree#1{\gdef \@degree{#1}}
\def\wordcount#1{\gdef \@wordcount{#1}}
%%


\renewcommand\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\normalfont
      \leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
      \nobreak\hb@xt@\@pnumwidth{\bfseries \hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}

%%% Preface pages
% in order

%% Title page
\renewcommand{\maketitle}{%
  {\pagestyle{empty}
  \fontsize{14}{25}\selectfont
  \begin{titlepage}
  \newpage
  \begin{center}
  \vspace*{1.5cm}
    \setcounter{page}{1}
    \includegraphics[scale=0.140] \@logo
    \\
    \vspace{1.5cm}
    {\bfseries\Huge \@title}\\
    \vspace{1.5cm}
    %\centerline{\hbox to \wd0 {\hbox{}\hrulefill\hbox{}}}
    \normalfont\large
    \@author \\
    \@group \\
    %\@school \\
    %Faculty of \@faculty \\
    %\@university
    \vspace{1.5cm}
    Submitted in partial fulfilment of the requirements of the degree of \\ Degree of \@degree \\
    \vspace{1.5cm}
    %{\fontsize{12}{14}\selectfont \lineskip .5em
    %\begin{tabular}[t]{c}%
    %\end{tabular}\par}
    %\vskip 1em
    \@school \\
    \@faculty \\
    \@university \\
    \vspace{1.5cm}
    \@date \\
  \end{center}\par
  \end{titlepage}
  }
}

%% Abstract
\newenvironment{abstract}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Abstract}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% COVID
\newenvironment{covid}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{COVID-19 statement}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% Acknowledgments
\newenvironment{acknowledgements}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Acknowledgements}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% Declaration
\newenvironment{declaration}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Declaration}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% Abbreviations/accronyms
\newenvironment{abbreviations}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Abbreviations}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% Publications
\newenvironment{publications}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Research Output}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% Outline
\newenvironment{outline}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Outline}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%

%% Contributions
\newenvironment{contributions}{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{Contributions}
  \fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%


%%% Other things
\renewcommand{\title}[1]{\def\@title{#1}}
\newcommand{\Abstract}[1]{\def\@Abstract{#1}}
\newcommand{\COVID}[1]{\def\@COVID{#1}}
\newcommand{\Acknowledgements}[1]{\def\@Acknowledgements{#1}}
\newcommand{\Publications}[1]{\def\@Publications{#1}}
\newcommand{\Contributions}[1]{\def\@Contributions{#1}}
\newcommand{\Declaration}[1]{\def\@Declaration{#1}}
\newcommand{\Abbreviations}[1]{\def\@Abbreviations{#1}}
\newcommand{\Outline}[1]{\def\@Outline{#1}}

Committee members not produced

Hello. The rest of my committee was not printed in the following line:

signature: ["committee member 1", "committee member 2", "committee member 3"]

I have a total of 3 additional committee members but only the chair is produced. Any ideas on how to fix this? I'm new to the Github universe so please let me know if there is any supporting information I can provide. Thank you.

change page numbering to start on first page and be centered at bottom?

Thanks for this amazing template! I'm trying to adapt to UC Davis requirements before I submit my dissertation in about a month, but my LaTeX knowledge is fairly rudimentary. I've gotten the cover page formatted as necessary, but one of the requirements (because every school wants to be different 👊 ) is that the page numbering needs to be centered on the bottom of every page, and it needs to start from the very first page (for us, this is the cover page where folks sign) through the table of contents (in roman numerals as you already have it set), then starting with numeric from the intro on.

I've played with a few things to shift the numbers to the bottom center of the page, but I fear I've tweaked too much and now I have no idea what I actually set. I was trying to give a better buffer between the number and the text, because the text often seems to go right up to the page number, or over.

Do you have any thoughts or suggestions? I've tried googling and playing with different templates, but largely haven't found a solution that works. And I like your template best. 👍

Thanks much.

Adapting to a new institution

Hi, I'm trying to adapt this package to my institution (University of South Florida). I've been trying to adapt this repository by creating an Rmarkdown template based on some unofficial USF Latex document class and template files which are available from http://shell.cas.usf.edu/~saito/grad/. After playing with that for a while I was able to get a package that has a custom template (https://github.com/ailich/bulldown) and can be installed with remotes::install_github("ailich/bulldown"). The document will knit, but if I add any headers to the child documents (e.g. # Chapter 1) I get the error "! Undefined control sequence. l.49 \hypertarget". Any chance you know what's going on here? I've included a text file which lists the steps I took to create this R package/template and the edits I had to make to various files. I'm not 100% sure what I'm doing in all the steps though (e.g. edits to template.tex and including the functions for knitting from thesisdown) so I might be making some mistakes in the setup. Any help would be greatly appreciated.

typo

lovely work ben. just saw a typo: "inot" should be "into"

Set depth of numbering of sections with secnumdepth in the main document alike tocdepth in the TOC

tocdepth controls the depth of numbering in the table of contents as follows:

\setcounter{tocdepth}{1}
		% i.e. which section levels are shown in the toc (-1 down to 6) from part to subparagraph
		% 0 = chapter => only chapters are numbered
		% 1 = section => chapters and sections are numbered
		% 2 = subsection  => chapters, sections and subsection are numbered

It would be nice to be able to control the depth of the numbering of sections in the main document just alike with secnumdepth, i.e.

\setcounter{secnumdepth}{3}

Interestingly, when raising tocdepth to 3 or 4 more headline levels are shown in the TOC, but yet they are still not numbered (neither in the TOC nor in the main document).
This would be very useful if available. Many thanks in advance for your consideration.

Including lists in tables in huskydown

Huskydown works well with standard Pandoc pipe tables. However, pipe tables do not permit to include lists of items. grid tables permit for this. However, when including footnotes in grid tables, their formatting gets messed up.

    ## Pipe table
    | Col A  | Col B                |
    | ------ | -------------------- |
    | Item 1 | - Foo^[Foo Footnote] |
    |        | - Bar                |
    | Item 2 | - Foo                |
    |        | - Bar                |
    
    
    ## Grid table
    +--------+------------+
    | Col A  | Col B      |
    +========+============+
    | Item 1 | - Foo[^1] |
    |        | - Bar     |
    +--------+------------+
    | Item 2 | - Foo     |
    |        | - Bar     |
    +--------+------------+
    
    [^1]: Foo Footnote

The figure below shows how these tables turn out if included in a huskydown document (with PDF output)

in huskydown thesis file

and if included in a simple Rmd document.

in Rmd file

Is there any way to include lists in standard pipe tables or otherwise a way to fix footnotes and the large line spacing in grid tables?

Incorrect Table of Contents page numbering for List of Figures and List of Tables

Describe the bug
In the generated PDF, the Lists of Figures and Lists of Tables page numbering is incorrect in the Table of Contents. Page numbers are ahead of where they should be (says page ii for LoF but the page is iv, iii for LoT but page is v).

To Reproduce
I followed the given instructions to produce the huskydown PDF.

I have been working on my own template adaptation of thesisdown (https://github.com/eugenesit/gaelsdown) and found that this issue applies to any section which follows the ToC and using the same page numbering (arabic), not just the LoF and LoT (PDF).

Efforts to Resolve
This issue might be corrected in LaTeX by compiling multiple times (https://tex.stackexchange.com/questions/41897/wrong-page-number-for-list-of-figures-within-table-of-contents). I don't understand the internal workings of pdf_book well enough to know if there's a way to pass along these instructions. I tried specifying global options for tinytex to compile multiple times tinytex.compile.min_times=3 and to leave files in place tinytex.clean=FALSE, but this didn't change the output.

I also tried using the LaTeX package tocbibind to pass LoT and LoF to the ToC but this doesn't fix the problem. I also encountered this issue in thesisdown variant dragondown, which you can see in their PDF preview as well. huwiwidown (https://github.com/phister/huwiwidown) had correct page numbers for LoF and LoT, which seems to be due to the fact that the LaTeX class for this template is article, not book.

If you have any ideas for how to solve this problem I'd love to hear them! Thanks!

Fonts missing from repository

Thank you for providing this package! In working on modifications for the University of Oregon specifications, I came across the issue that the fonts referenced in the readme are not in the inst directory.

Our PDF template requires some specific fonts, EB Garamond, Source Code Pro and Lato. These are included in this repository. You need to install these before proceeding, either by using your usual method of installing fonts, or following these instructions

Linebreaks in chapter titles not working with // as specified in uwthesis.cls

According to uwthesis.cls, linebreaks can be added simply via \\:

%  Complication is added here to allow line breaks
%  in the chapter titles (via \\).
%
\def\@chapter[#1]#2{
  \ifnum \c@secnumdepth >\m@ne
  \refstepcounter{chapter}
  \typeout{<<\thechapter>>}
  {\def\\{ }  % allow \\ in title
...

However, linebreaks do not appear when knitting to PDF (only a single \appears) for me.

I tried to seek advice at SO, see my post here. However the replies I received either only work with HTML output only, or they only work with simple markdown files and not with bookdown/huskydown.

The ultimate goal is to add linebreak to a long chapter title in the main document, whereby

  • the linebreak does not appear in the chapter name in the TOC

  • the label to reference the chapter works throughout the document i.e. is maintained despite the linebreak.

    sessionInfo()
    R version 3.6.3 (2020-02-29)
    Platform: x86_64-apple-darwin15.6.0 (64-bit)
    Running under: macOS High Sierra 10.13.6
    
    Matrix products: default
    BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
    LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
    
    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    
    attached base packages:
    [1] grid      stats     graphics  grDevices utils     datasets  methods  
    [8] base     
    
    other attached packages:
     [1] showtext_0.8-1          showtextdb_3.0          sysfonts_0.8.1         
     [4] latex2exp_0.4.0         ggpubr_0.3.0            GGally_1.5.0           
     [7] huxtable_4.7.1          vcd_1.4-7               tinytex_0.24           
    [10] forcats_0.5.0           stringr_1.4.0           dplyr_1.0.0            
    [13] readr_1.3.1             tidyr_1.1.0             tibble_3.0.1           
    [16] tidyverse_1.3.0         rmarkdown_2.3           rJava_0.9-12           
    [19] reshape2_1.4.4          qdap_2.4.1              RColorBrewer_1.1-2     
    [22] qdapTools_1.3.5         qdapRegex_0.7.2         qdapDictionaries_1.0.7 
    [25] psych_1.9.12.31         purrr_0.3.4             plyr_1.8.6             
    [28] packrat_0.5.0           markdown_1.1            magrittr_1.5           
    [31] lubridate_1.7.8         knitr_1.29              jtools_2.0.5           
    [34] Hmisc_4.4-0             Formula_1.2-3           survival_3.1-12        
    [37] lattice_0.20-41         ggthemes_4.2.0          DiagrammeR_1.0.6.1     
    [40] data.table_1.12.8       cowplot_1.0.0           broom_0.5.6            
    [43] bookdown_0.19           ProjectTemplate_0.9.2   ggplot2_3.3.2          
    [46] kableExtra_1.1.0        modelsummary_0.4.1.9000 tables_0.9.3           
    [49] remotes_2.1.1
    

Failed to Compile Thesis Error on Mac OSX

Hey!

##Description of Erorr
Was playing around with Huskydown, trying to get it work. Followed the instructions you provided for PDFs (naming index.Rmd), but keep getting the error below. As a note, I've tried deleting thesis.Rmd

In addition, I have ensured I'm running the full install of MacTex 2017 and have ensured all of the packages in TexLive are installed and updated. That said, I'm not sure why this error is occurring and was wondering if you had seen this error before:

Error Language from RStudio Console

Error: Failed to compile thesis.tex. See thesis.log for more info. Please delete thesis.Rmd after you finish debugging the error. Execution halted

Error Language From thesis.log File

.................................................

. fontspec info: "no-scripts"
.
. Font "EB Garamond" does not contain any OpenType `Script' information.
.................................................


  • fontspec warning: "aat-feature-not-exist-in-font"
  • AAT feature 'Numbers=Proportional' (6,1) not available in font 'EB
  • Garamond'.

\g__fontspec_family_EBGaramond_int=\count266
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font "EB Garamond/BI" (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font "EB Garamond/B" (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font "EB Garamond/I" (it probably doesn't exist).
.................................................


  • fontspec warning: "aat-feature-not-exist-in-font"
  • AAT feature 'Numbers=Proportional' (6,1) not available in font 'EB
  • Garamond'.

.................................................
. fontspec info: "defining-font"
.
. Font family 'EBGaramond(0)' created for font 'EB Garamond' with options
. [Numbers={Proportional}].
.
. This font family consists of the following NFSS series/shapes:
.
. - 'normal' (m/n) with NFSS spec.: <->"EB Garamond/AAT"
. - 'small caps' (m/sc) with NFSS spec.:
.................................................
\symDigits:m:n=\mathgroup6
.................................................
. fontspec info: "no-scripts"
.
. Font "EB Garamond" does not contain any OpenType `Script' information.
.................................................


  • fontspec warning: "aat-feature-not-exist-in-font"
  • AAT feature 'Numbers=Proportional' (6,1) not available in font 'EB
  • Garamond'.

\symLatin:m:n=\mathgroup7
\symLatin:m:it=\mathgroup8
.................................................
. fontspec info: "no-scripts"
.
. Font "EB Garamond" does not contain any OpenType `Script' information.
.................................................


  • fontspec warning: "aat-feature-not-exist-in-font"
  • AAT feature 'Numbers=Proportional' (6,1) not available in font 'EB
  • Garamond'.

\symGreek:m:n=\mathgroup9
\symGreek:m:it=\mathgroup10
.................................................
. fontspec info: "no-scripts"
.
. Font "EB Garamond" does not contain any OpenType Script' information. ................................................. ................................................. . fontspec info: "no-font-shape" . . Could not resolve font "EB Garamond/BI" (it probably doesn't exist). ................................................. ................................................. . fontspec info: "no-font-shape" . . Could not resolve font "EB Garamond/B" (it probably doesn't exist). ................................................. ................................................. . fontspec info: "no-font-shape" . . Could not resolve font "EB Garamond/I" (it probably doesn't exist). ................................................. ................................................. . fontspec info: "defining-font" . . Font family 'EBGaramond(1)' created for font 'EB Garamond' with options []. . . This font family consists of the following NFSS series/shapes: . . - 'normal' (m/n) with NFSS spec.: <->"EB Garamond/AAT" . - 'small caps' (m/sc) with NFSS spec.: ................................................. LaTeX Font Info: Redeclaring math alphabet \mathrm on input line 912. LaTeX Font Info: Overwriting math alphabet \mathrm' in version bold' (Font) TU/EBGaramond(1)/m/n --> TU/EBGaramond(1)/bx/n on input line 912. LaTeX Font Info: Redeclaring math alphabet \mathit on input line 912. LaTeX Font Info: Overwriting math alphabet \mathit' in version normal' (Font) OT1/cmr/m/it --> TU/EBGaramond(1)/m/it on input line 91 2. LaTeX Font Info: Overwriting math alphabet \mathit' in version bold' (Font) OT1/cmr/bx/it --> TU/EBGaramond(1)/m/it on input line 9 12. LaTeX Font Info: Redeclaring math alphabet \mathbf on input line 912. LaTeX Font Info: Overwriting math alphabet \mathbf' in version normal' (Font) OT1/cmr/bx/n --> TU/EBGaramond(1)/bx/n on input line 91 2. LaTeX Font Info: Overwriting math alphabet \mathbf' in version bold' (Font) OT1/cmr/bx/n --> TU/EBGaramond(1)/bx/n on input line 91 2. LaTeX Font Info: Overwriting math alphabet \mathit' in version bold' (Font) TU/EBGaramond(1)/m/it --> TU/EBGaramond(1)/bx/it on inp ut line 912. \symOperators:m:n=\mathgroup11 ................................................. . fontspec info: "no-scripts" . . Font "EB Garamond" does not contain any OpenType Script' information.
.................................................
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font "EB Garamond/BI" (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font "EB Garamond/B" (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "no-font-shape"
.
. Could not resolve font "EB Garamond/I" (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "defining-font"
.
. Font family 'EBGaramond(2)' created for font 'EB Garamond' with options
. [Mapping=tex-text,RawFeature={c2sc,scmp}].
.
. This font family consists of the following NFSS series/shapes:
.
. - 'normal' (m/n) with NFSS spec.: <->"EB
. Garamond/AAT:c2sc,scmp;mapping=tex-text;"
. - 'small caps' (m/sc) with NFSS spec.:
.................................................
.................................................
. fontspec info: "no-scripts"
.
. Font "EB Garamond" does not contain any OpenType `Script' information.
.................................................


  • fontspec warning: "aat-feature-not-exist-in-font"
  • AAT feature 'Numbers=OldStyle' (21,0) not available in font 'EB Garamond'.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/key-choice-unknown"
!
! Key 'fontspec-aat/Contextuals' accepts only a fixed set of choices.
!
! See the LaTeX3 documentation for further information.
!
! For immediate help type H .
!...............................................

l.919 ...ternate, Ligatures={Common}]{EB Garamond}

Here is how much of TeX's memory you used:
13009 strings out of 492998
274667 string characters out of 6134491
355323 words of memory out of 5000000
16909 multiletter control sequences out of 15000+600000
530312 words of font info for 27 fonts, out of 8000000 for 9000
1348 hyphenation exceptions out of 8191
47i,0n,82p,10522b,233s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.

Error when trying to render index.Rmd to PDF

Hi there, first of all, let me thank for providing this template :)
I am getting an error, after following your initial guidelines, when I try to render the thesis into a PDF, by opening the index.Rmd file in RStudio and clicking the "knit" button. I get the following error:

"output file: thesis.knit.md

! Undefined control sequence.
...}}\NormalTok { pkg[}\SpecialCharTok
{!}\NormalTok {(pkg }\Spec...
l.353 ...onTok{installed.packages}\NormalTok{())]}

Error: LaTeX failed to compile thesis.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See thesis.log for more info.
In addition: Warning messages:
1: replacing previous import ‘dplyr::pull’ by ‘git2r::pull’ when loading ‘huskydown’
2: In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
Execution halted"

I am doing this right after I choose to start a new document with the husky down template.
Hope you can help.
Best,
Ana

How to add more than 4 chapters in huskydown

Ben,

I need some guidance on adding more than 4 chapters to my dissertation, which is 8 chapters. I tried using the same naming convention "04-chap4.Rmd" but I get an error saying the file "04-conclusion.Rmd" could not be found and was not knitted. I decided to leave "04-conclusion.Rmd" as is and kept "04-chap4.Rmd" but the fourth chapter does not produce after successful knitting. Please advise. Thank you!

Change page margins for a single page within the thesis

To be able to include very large tables, figures, or prints of external PDF files, it would be very helpful to be able to change the page margins for a single page (or even several) within the document.
Thereafter, the page margins should return to their default values.
I tried to seek advice at SO, however without any success yet. Since the issue might be more related to huskydown/thesisdown than to R-markdown, I though it might be better to place the inquiry here.

What I tried:

In template.tex I added the following to be able to use landscape format:

  \usepackage{pdflscape} % to rotate pages, i.e switch to landscape format 
  \newcommand{\blandscape}{\begin{landscape}}
  \newcommand{\elandscape}{\end{landscape}}

And then tried the following within the main file, unfortunately without success

```{r echo=FALSE}
vec <- c("Properties A", "Properties B")
tab <- mtcars[1:3,1:4] %>% kable() %>% 
  kable_styling(latex_options = c("scale_down"))
```

\blandscape
## 1. With out.width='XXX%'
```{r echo=FALSE, out.width='140%'}
tab
```

## 2. "fullpage" as per uwthesis.cls
\begin{fullpage}
```{r echo=FALSE}
tab
```
\end{fullpage}

## 3. "xtrafullpage" as per uwthesis.cls
\begin{xtrafullpage} 
```{r echo=FALSE}
tab
```
\end{xtrafullpage}
\elandscape

## 4. newgeometry as per SO recommendation to my post
\newgeometry{left=1cm,right=1cm,top=1cm,bottom=1cm}
```{r echo=FALSE}
tab
```
\clearpage
\restoregeometry

The first three attempts do not make any difference to the generated table. Its size remains the same.
The fourth one yields the following error:

# ! Undefined control sequence.
# l.190 \newgeometry
#                   {left=1cm,right=1cm,top=1cm,bottom=1cm} 

Any advice/new feature on how to decrease the page margins/increase the area for tables, figures or PDFs temporarily within the document is greatly appreciated!

unicode?

Hi Ben,

do you take a view on whether to support "unicode" formatting in markdown? e.g. writing α rather than $\alpha$ in your markdown? I don't recall the details, but I think preferring unicode helped with .md to .docx conversions. But then you need to use an appropriate tex engine.

Section formatting for PDFs

The headers for sections and subsections are the same size and format when exporting the PDF version, making it hard to see a hierarchical structure beyond a single section. This seems to be true no matter how many "#'s" are used before each header (beyond 2). Here is a screenshot of an example: here I would like "Methods" to be a section and "Patients and Isolates" to be a subsection, but they look exactly the same.

screen shot 2018-05-08 at 3 19 04 pm

Would it be possible to tap into more of LaTeX's section capabilities by using different sizes/boldness for sections and subsections, and/or allowing the option for section and subsection numbers, perhaps in the YAML header?

Thanks!
Arianna

Errors out when attempting to add captions to tables.

I just started adapting my thesis using huskydown, and I ran into some (probably newbie) errors when trying to add in my tables.

First, would it be possible to read in a table as an image (.png) rather than compiling using knitr if I am happy with the formatting?

Second, if that doesn't work, I have loaded my data for a table into a csv file and tried reading it in as specified in the huskydown docs. However, it errors out whenever I try to add in a caption:

! Missing $ inserted.
<inserted text> 
                $
l.786 \caption{(\#tab:size_colloids)testing}
                                            \\ 

Try to find the following text in thesis.Rmd:
  \caption{(\#tab:size_colloids)testing} 

You may need to add $ $ around a certain inline R expression `r ` in thesis.Rmd (see the above hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: Failed to compile thesis.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See thesis.log for more info.
Please delete thesis.Rmd after you finish debugging the error.

This was generated using the following code block in an Rmd file:

{r size_colloids, echo=FALSE, results="asis"}
kable(size_colloids, format = 'latex', longtable = TRUE, booktabs = TRUE,
      caption = "test")

If I run it with the caption option, it works just fine.

Any help would be much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.