I'm in the process of writing a book about data analysis. Currently using the R and the Bookdown package. I'm currently using your book "Authoring books and technical with R markdown" as a guide. Love it by the way!
I have some experience with LateX and Overleaf, but I'm starting to like R and the bookdown package more.
However, I encounter some problems related to formatting, especially the pdf document output.
I'm currently using the big example found in " bookdown: Authoring Books and Technical Documents with R Markdown" by Yihui as a default template.
Here are my questions:
How do I customize all the headings in the table of contents to the Danish language? Aswell as having the "Chapter 1" to render as "Kapitel 1, Kapitel 2 etc." in the pdf output.
How do I adjust pagenumbering. Running the output in pdf format shows that pagenumbering starts on the page with my table of contents. Basically I want to have the first pagenumber to show on the next page, where my abstract starts.
How do i configure the margins for the entire document? The function is called "equal margins" in Microsoft Word. It's doable with LateX and Overleaf engine. But for some reason I get an error in the console when I type the code in the Yaml.
Is it possible to create a full-sized book coverpage?
If you know the answers, please redirect me to some source code. I can't send you the code unfortunately because I had to reinstall R. Guess I played too much with all the different settings lol. Lets just say I managed to destroy the functionality of R lol.
probably something that would require some LaTeX command. If you know how to do that with LaTeX, you can then include inside the default template. I do not know how to do that in LaTeX unfortunately
I've solved the page numbering problem as follows:
I added the following to the end of my preamble.tex file:
\frontmatter
That starts the book with roman numeral numbering, including the TOC. Then, wherever you want your front matter to end, just insert the following line:
\mainmatter
You can either do that in your before_body.tex, or you can do it in the Rmd files wherever you want, if you have additional front matter content, like I do.
If you need to mess with page numbering directly, you can use latex commands like this right in your markdown:
I'm not sure exactly what you're looking for here, but I wanted an actual book cover. Here's the code I use:
% Insert book cover first and format title page after that
\usepackage{titling}
\usepackage{pdfpages}
\IfFileExists{./cover.pdf}{
\newcommand{\myCover}{./cover.pdf}}
{\IfFileExists{./cover.jpg}{
\newcommand{\myCover}{./cover.jpg}}
{\IfFileExists{./cover.png}{
\newcommand{\myCover}{./cover.png}}{}
}
}
\makeatletter
\@ifundefined{myCover}
{}
{
\pretitle{\begin{center}\includepdf{\myCover}}
\posttitle{\end{center}\setcounter{page}{0}}
\usepackage{atbegshi}% http://ctan.org/pkg/atbegshi
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
}
\makeatother
It checks for a few formats of supported cover images, then, if it found one, it puts it before the title page. Then makes the title page, and makes sure neither counts as a page (for page numbering purposes).