<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>bookdown | B101nfo</title>
    <link>https://llrs.dev/tags/bookdown/</link>
      <atom:link href="https://llrs.dev/tags/bookdown/index.xml" rel="self" type="application/rss+xml" />
    <description>bookdown</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>If it is code you can copy and reuse (MIT) if it is text, please cite and reuse CC-BY 2024.</copyright><lastBuildDate>Mon, 09 May 2022 00:00:00 +0000</lastBuildDate>
    <image>
      <url>img/map[gravatar:%!s(bool=false) shape:circle]</url>
      <title>bookdown</title>
      <link>https://llrs.dev/tags/bookdown/</link>
    </image>
    
    <item>
      <title>Writing a thesis with bookdown</title>
      <link>https://llrs.dev/post/2022/05/09/writing-thesis-bookdown/</link>
      <pubDate>Mon, 09 May 2022 00:00:00 +0000</pubDate>
      <guid>https://llrs.dev/post/2022/05/09/writing-thesis-bookdown/</guid>
      <description>


&lt;p&gt;On this post I am documenting the experiences I had writing my &lt;a href=&#34;https://thesis.llrs.dev&#34;&gt;PhD thesis&lt;/a&gt; with bookdown.
I made the thesis in web and pdf format (and epub) to make more available the thesis.
Most of the experiences and advise I’ll share here are based on my experiences to improve the pdf format.
It is the most important format as ultimately is what I’m going to use for printing.&lt;/p&gt;
&lt;p&gt;First of all you should know there is a package &lt;a href=&#34;https://github.com/ismayc/thesisdown&#34;&gt;thesisdown&lt;/a&gt; with a few templates for some universities.
If yours is there, or if you want to learn how are they you can have a look at the files.&lt;br /&gt;
On my case I didn’t have any template and the university guidelines are not long, (have two compulsory pages at the beginning and have 5 sections).
That’s why I tweaked the default format inspired by the recent thesis defended on my group.&lt;/p&gt;
&lt;p&gt;Well, without further delay let’s dive in things I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#captions&#34;&gt;Captions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#chapter-thumb&#34;&gt;Chapter thumb&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#placing-options&#34;&gt;Placing options&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#index&#34;&gt;Indexes&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#toft&#34;&gt;Table of figures and tables&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#acronyms&#34;&gt;Acronyms&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#placing-floats&#34;&gt;Placing floats&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#github-actions&#34;&gt;Github actions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#empty-pages&#34;&gt;Empty pages&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#title-pages&#34;&gt;Title pages&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#page-numbers&#34;&gt;Page numbers&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#include-pdfs&#34;&gt;Include pdfs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#running-titles&#34;&gt;Running titles&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#merging-pdfs&#34;&gt;Merging pdfs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;#reducing-pdf-size&#34;&gt;Reducing pdf size&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;important&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Important&lt;/h2&gt;
&lt;div id=&#34;captions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Captions&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;knitr::kable&lt;/code&gt; places the captions on tables at the top (by design, see &lt;a href=&#34;https://github.com/yihui/knitr/issues/1189&#34;&gt;issue #1189&lt;/a&gt;), while knitr places the captions on the bottom of figures.
So if you want to have all the captions below the element you’ll need to use a different package for it (&lt;code&gt;booktable&lt;/code&gt;, or others).&lt;/p&gt;
&lt;p&gt;If you want to have short captions for an easy readable table of figures and table of tables you’ll need to use &lt;code&gt;kable(short.caption = &#34;TOC&#34;, caption = &#34;Long caption below the table&#34;).&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In addition, on &lt;code&gt;kable&lt;/code&gt; if you use something like Häsler you’ll need to convert this “ä” to “\u00E4”.&lt;/p&gt;
&lt;p&gt;I also wanted to highlight and differentiate the captions.
I ended up using the &lt;code&gt;caption&lt;/code&gt; package:&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{caption}
% Set in bold the numbering of tables and chapters
\captionsetup{labelfont=bf,width=\textwidth}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;\textwidh&lt;/code&gt; is to make more with the captions otherwise they just spans the size of the table or figure.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;repeating-text&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Repeating text&lt;/h3&gt;
&lt;p&gt;If you find yourself repeating some text to explain some figures, legends or tables you can use &lt;a href=&#34;https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#text-references&#34;&gt;text references&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ref:foo) Define a text reference **here**. &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can use &lt;code&gt;(ref:foo)&lt;/code&gt; to repeat the same text.&lt;/p&gt;
&lt;p&gt;Although formatting cannot be applied afterwards (i.e. &lt;code&gt;**(ref:foo)**&lt;/code&gt;) it is handy to just write once and avoid repetition (And also if to keep backwards compatibility you can’t use the new special comment &lt;code&gt;#|&lt;/code&gt; to specify chunk options).&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;placing-options&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Placing options&lt;/h3&gt;
&lt;p&gt;Many latex instructions go to the &lt;code&gt;index.Rmd&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;The once I included are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;split_by: chapter
link-citations: true 
always_allow_html: true
colorlinks: yes
# https://bookdown.org/yihui/rmarkdown-cookbook/latex-variables.html
# links-as-notes: true # Only activate for actual printing
fontfamily: libertine
fontsize: 12pt
papersize: a4 # The printed size of the thesis
acronyms:
  loa_title: &amp;quot;&amp;quot;
  insert_loa: false
  sorting: usage
  include_unused: false
  fromfile: ./style/acronyms.yml
geometry:
 - top=25.4mm
 - bottom=25.4mm
 - left=25.4mm
 - right=25.4mm
 - bindingoffset=6.4mm
 - asymmetric
classoption: 
  - twoside
  - openright
lot: yes
lof: yes&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;split_by&lt;/code&gt; in the html format how to move to the next section.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;link-citations&lt;/code&gt; Add a link to the citation?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;colorlinks&lt;/code&gt; If links should have a color&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;links-as-notes&lt;/code&gt; Instead of having hyperlinks have them included as notes.
It is useful for printing where the reader doesn’t have the option to click a link but might be interested in knowing more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;fontfamily&lt;/code&gt; and &lt;code&gt;fontsize&lt;/code&gt; decide which font and size will be used.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;papersize&lt;/code&gt; this chooses the available space and greatly affects the position of figures and tables, which can float on the text according to LaTeX algorithm.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;acronyms&lt;/code&gt; Configuration of the &lt;a href=&#34;#acronyms&#34;&gt;acronyms&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;geometry&lt;/code&gt; Defines the margins, consider that on books the central zone will not be readable.
The &lt;code&gt;bindingoffset&lt;/code&gt; adds some space to make it easier reading.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;classoption&lt;/code&gt; Options for the book format&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;lot&lt;/code&gt; and &lt;code&gt;lof&lt;/code&gt; indicate if list of tables (lot) and list of figures (lof) should be included on the pdf output.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;book_filename&lt;/code&gt; if present on index.Rmd is overwritten by what is on &lt;code&gt;_bookdown.yml&lt;/code&gt; but be careful also on what goes to &lt;code&gt;_bookdown.yml&lt;/code&gt; and on the specific format on &lt;code&gt;_output.yml&lt;/code&gt; .&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;nice-little-tricks&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Nice little tricks&lt;/h2&gt;
&lt;div id=&#34;dedication&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Dedication&lt;/h3&gt;
&lt;p&gt;Looking at the source code of the &lt;a href=&#34;https://github.com/rstudio/bookdown/blob/main/inst/examples/latex/before_body.tex&#34;&gt;bookdown book&lt;/a&gt; I found that the correct way was to use before_body option.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;chapter-thumb&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Chapter thumb&lt;/h3&gt;
&lt;p&gt;One thing I liked from other thesis is the ability to have on the printed edition a little mark on the side of the page to find a section.&lt;/p&gt;
&lt;p&gt;My first search showed that it &lt;a href=&#34;https://tex.stackexchange.com/questions/113323/how-can-one-put-a-marker-to-every-page-in-a-chapter&#34;&gt;was possible&lt;/a&gt;, but I didn’t want to load the &lt;code&gt;tikz&lt;/code&gt; package.
I ended up using &lt;a href=&#34;https://tex.stackexchange.com/questions/262950/modify-chapter-thumb-for-appendix&#34;&gt;this solution&lt;/a&gt; after adding and modifying the colors, changing the size and position.&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage[scale=1,angle=0,opacity=1,contents={}]{background}
\usetikzlibrary{calc}
\usepackage{ifthen}
\usepackage{lipsum}
% auxiliary counter
\newcounter{chapshift}
% the list of colors to be used (add more if needed)
\newcommand\BoxColor{%
  \ifcase\thechapshift blue!30\or red!30\or olive!30\or magenta!30\or teal!30\or lime!30\or orange!30\or violet!30\or brown!30\else yellow!30\fi}
% the main command; the mandatory argument sets the color of the vertical box
\newcommand\ChapFrame{%
  \def\TitleText{\leftmark}%
  \AddEverypageHook{%
    \ifthenelse{\isodd{\value{page}}}
      {\backgroundsetup{
        contents={%
          \begin{tikzpicture}[overlay,remember picture]
          \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
            text height=3cm,align=center,anchor=north east]
          at ($ (current page.north east) + (-0cm,- 3*\thechapshift cm) $)
          % {\rotatebox{90}{\parbox{4cm}{%
          %   \centering\textcolor{black}{\scshape\thechapshift}}}};
          {};
          \end{tikzpicture}
        }%
      }
    }
    {\backgroundsetup{
      contents={%
        \begin{tikzpicture}[overlay,remember picture]
        \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
          text height=3cm,align=center,anchor=north west]
        at ($ (current page.north west) + (-0cm,-3*\thechapshift cm) $)
        % {\rotatebox{90}{\parbox{4cm}{%
        %   \centering\textcolor{black}{\scshape\thechapshift}}}};
        {};
        \end{tikzpicture}
      }
    }
  }
\BgMaterial}%
\stepcounter{chapshift}
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This code basically means that I need to add &lt;code&gt;\ChapFrame&lt;/code&gt; when I want the chapter thumb (I didn’t know the name before searching this).
Once started it changes colors according to &lt;code&gt;\chapshift&lt;/code&gt; which is automatically incremented by &lt;code&gt;\ChapFrame&lt;/code&gt;.
I also set to change position according to &lt;code&gt;\thechapshift&lt;/code&gt; so that they make a stair.&lt;/p&gt;
&lt;p&gt;The code basically changes the position of the mark if the page is even or odd, so that it is always on the outer side of the booklet.
The size is &lt;code&gt;width=1cm, height=3cm&lt;/code&gt; with text inside it.
If you want text I recommend either short titles or the chapter number &lt;code&gt;\chapter&lt;/code&gt; to ensure it is readable.&lt;/p&gt;
&lt;p&gt;A tiny trick I learned was to reset the counter with &lt;code&gt;\afterpage{\setcounter{chapshift}{0}}&lt;/code&gt; after the bibliography so that the appendix would use the same mark from the beginning.
If you want different colors for the appendix you could just create a new counter and a new &lt;code&gt;\BoxColor&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;index&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Index with index on it&lt;/h3&gt;
&lt;p&gt;I wanted to have the table of contents to show were it began, simply because with all the added page on the front and white pages it might be hard to find it.
It is also handy when using the outline of the pdf version to go back the the index to then move to another section.&lt;/p&gt;
&lt;p&gt;Simply loading the &lt;code&gt;\tocbibind&lt;/code&gt; packages was enough:&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{tocbibind}&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/screenshot_index.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Screenshot of the outline and the real index.
The outline has the same content as the real index.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Note: I found a “bug” were the appendix link goes to the bibliography (the previous chapter) instead of the correctly displayed page.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;toft&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Table of figures and tables&lt;/h3&gt;
&lt;p&gt;It was not required but I wanted a table of tables and a table of figures, to make it easier go to results of the thesis.
To add them I used the &lt;code&gt;tocbibind&lt;/code&gt; package that automatically adds it (and the options on &lt;code&gt;index.Rmd&lt;/code&gt; wasn’t sure from the &lt;a href=&#34;https://tex.stackexchange.com/a/48512/178206&#34;&gt;answer&lt;/a&gt; I found online).&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{tocbibind}&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/lof.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Screenshot of the first lines of the list of figures, with a short caption for each figure&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;acronyms&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Acronyms&lt;/h3&gt;
&lt;p&gt;I repeat many acronyms on the thesis and I wanted to have a brief table with them.
I used the &lt;a href=&#34;https://github.com/rchaput/acronymsdown&#34;&gt;package acronymsdown&lt;/a&gt; which is simple, easy and works well for web and pdf.&lt;br /&gt;
My only wish is that it had a way to go back to were the reader was.&lt;/p&gt;
&lt;p&gt;To place the acronyms were I wanted I had to remove the automatic title and use the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Glossary {-}

\printacronyms&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I add them to the beginning after the summaries of the thesis and the preface, right before the body of the thesis.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;placing-floats&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Placing floats&lt;/h3&gt;
&lt;p&gt;I included many figures and tables which makes it hard to have all of them near where they are added on the text.
While it can be forced, I didn’t want that but neither I wanted them too far away.&lt;/p&gt;
&lt;p&gt;To avoid them going after the subsection I added this command before the title of the next subsection:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;\FloatBarrier&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Probably it could be done automatically renewing the subsection title format, but as I only had to do this 5 times is manageable.&lt;/p&gt;
&lt;p&gt;Following an &lt;a href=&#34;https://stackoverflow.com/a/33801326/2886003&#34;&gt;answer&lt;/a&gt;, the figure floating algorithm was set with these preferences:&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{float}
\usepackage{colortbl}
\let\origfigure\figure
\let\endorigfigure\endfigure
\renewenvironment{figure}[1][2] {
    \expandafter\origfigure\expandafter[!htbp]
} {
    \endorigfigure
}&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/figure_table_thumb.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;A figure and a table on the same page, the label is in bold and the text in italics, on the right side (the page is odd) the blue chapter thumb&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;github-actions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Github actions&lt;/h3&gt;
&lt;p&gt;To render I initially used my &lt;a href=&#34;htts://github.com/r-lib/actions&#34;&gt;r-lib/actions&lt;/a&gt; but without using any package structure.
However, once I set a DESCRIPTION file with all the package dependencies it was much faster, as I could use the &lt;a href=&#34;https://github.com/r-lib/actions/tree/v2/setup-r-dependencies&#34;&gt;setup-r-dependencies&lt;/a&gt; action.&lt;/p&gt;
&lt;p&gt;Probably there is also a faster way directly installing binaries with the help of &lt;code&gt;bspm&lt;/code&gt; or the system package manager, but this was convenient enough.&lt;/p&gt;
&lt;p&gt;Also the action to install &lt;a href=&#34;https://github.com/r-lib/actions/tree/v2/setup-tinytex&#34;&gt;tinytex&lt;/a&gt; made my job for the pdf to render much faster (from 15 minutes to 5 minutes).&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/gha.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Screenshot of the github actions (on push) were bookdown-web takes ~3 minutes, bookdown-epub ~2 minutes and bookdown-pdf ~5 minutes.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;empty-pages&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Empty pages&lt;/h3&gt;
&lt;p&gt;The chapters are on the right side of the book so they must end or have a blank page before.
To have a completely blank page I &lt;a href=&#34;https://tex.stackexchange.com/a/1684/178206&#34;&gt;found&lt;/a&gt; a simple solution, simply load a latex package &lt;code&gt;emptypage&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{emptypage}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;title-pages&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Title pages&lt;/h3&gt;
&lt;p&gt;Where to place titles, format it with &lt;code&gt;titlesec&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{titlesec}
\titleformat{\chapter}[display]{\fontsize{32pt}{48pt}\bfseries\sffamily\filcenter}{
    \fontsize{72pt}{72pt} \thechapter \ChapFrame
} % Content on the chapter title page
{20pt}{\lsstyle}[\thispagestyle{empty} \cleardoublepage]% https://tex.stackexchange.com/a/347162/178206
\titleformat{name=\chapter, numberless}{\normalfont\huge\bfseries\filcenter}{}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{100pt}{40pt}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first line load the package.
Then we set the format of the chapters option display and the format of text and what appears on that page.
&lt;code&gt;\thechapter&lt;/code&gt; is the title of the chapter (while &lt;code&gt;\chatper&lt;/code&gt; is the number).
&lt;code&gt;\chapFrame&lt;/code&gt; is the new command defined to set &lt;a href=&#34;#chapter-thumb&#34;&gt;chapter thumb&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The other benefit this had was that the title page had no page number.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/chapter.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;A screenshot of the introduction title page.
There is a number 1 and Introduction a couple of lines below.
On the right side a red box 3 cm below the top.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;page-numbers&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Page numbers&lt;/h3&gt;
&lt;p&gt;I decided to use different style for page numbers&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage[automark,headsepline]{scrlayer-scrpage}% sets page style scrheadings automatically
\clearpairofpagestyles
\ihead{\leftmark}
\ohead*{\pagemark}
\setkomafont{pagenumber}{}% default is \normalfont\normalcolor&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;include-pdfs&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Include pdfs&lt;/h3&gt;
&lt;p&gt;As part of the appendix I added my publications on their pdf format.
To do so I used the following code modified from the &lt;a href=&#34;https://stackoverflow.com/questions/2739159/inserting-a-pdf-file-in-latex&#34;&gt;original answer&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&#34;latex&#34;&gt;&lt;code&gt;\usepackage{pdfpages} 
\includepdf[pages=-, pagecommand={}, templatesize={\textwidth}{\textheight  - 25pt}, trim=0 0 0 20pt,]{pdf/paper.pdf}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I had to tweak the size were it was placed to keep the page numbers and running titles.
The last curly brackets indicate the location of the pdf to include.&lt;/p&gt;
&lt;p&gt;The benefit of this is that these pages now are also numbered with the thesis style and the title.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/pdf_included.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Screenshot of the pdf included showing the page number of the thesis and the content of the article “Multi-omic modelling of inflammatory bowel disease with regularized canonical correlation analysis”&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;running-titles&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Running titles&lt;/h3&gt;
&lt;p&gt;If you have a long title such as you are probably interested on having a shorter version for it on the thesis pages.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;## experDesign: stratifying samples into batches with minimal bias

\sectionmark{experDesign: paper}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I don’t think it actually made a big difference but it might we important for chapters.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;merging-pdfs&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Merging pdfs&lt;/h3&gt;
&lt;p&gt;As I said I needed some pages at the beginning of the thesis.
But I wanted to keep the outline of the pdf, and I found an &lt;a href=&#34;https://stackoverflow.com/a/19358402/2886003&#34;&gt;solution online&lt;/a&gt; explaining how to do it.&lt;/p&gt;
&lt;p&gt;To add multiple pdf I did this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gs -q -SDEVICE=pdfwrite -DPDFSETTINGS=/prepress -o merged.pdf page1.pdf page2.pdf thesis.pdf&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;reducing-pdf-size&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Reducing pdf size&lt;/h3&gt;
&lt;p&gt;At the end the pdf was bigger than what I could send over email.&lt;/p&gt;
&lt;p&gt;I found &lt;a href=&#34;https://askubuntu.com/a/256449/270501&#34;&gt;this answer&lt;/a&gt; that helped me to reduce the size and send it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;conclusion&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The process of writing the thesis is usually one of the last steps on a PhD.
I recommend to write something and avoid having a blank page.
But once written you must take care of the presentation and style, this is a complete different skill than writing or research, so it can be specially exhausting.&lt;/p&gt;
&lt;p&gt;Bookdown through the preamble and body options is great for setting your style.
But if you are short of time, are tired you might benefit from working and using some of these already created solutions and just modify what you need (as I did).&lt;/p&gt;
&lt;p&gt;To finish, so that you can see the final format it is &lt;a href=&#34;https://thesis.llrs.dev/&#34;&gt;here&lt;/a&gt;.
There you can download it in pdf too to see most of these commands in action.&lt;/p&gt;
&lt;p&gt;If you are writing your thesis, enjoy, keep calm and reuse other solutions!&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
