'How can I show affiliation in title page of bookdown pdf book while using authblk latex package?
I am using bookdown package in R to compile a bookdown::pdf_book. But I am unable to knit it when I use authblk latex package. The strange thing is that I can compile the same thing outside of RStudio, even when I am using authblk latex package. Let me share a minimal example here. Preamble taken from TeXStudio
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{authblk}
\begin{document}
\author[1]{First Author Name}
\author[2]{Second Author Name}
\affil[1]{College1}
\affil[2]{College2}
\title{Simple Book Example}
\date{January 2013}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\include{./TeX_files/chapter01}
\include{./TeX_files/chapter02}
\backmatter
% bibliography, glossary and index would go here.
\end{document}
YAML Header from Index.Rmd page
title: "A Minimal Book Example"
author: "Author Name"
affil: "College 1"
date: "`r Sys.Date()`"
output: pdf_document
documentclass: book
bibliography:
- book.bib
- packages.bib
description: |
This is a minimal example of using the bookdown package to write a book.
set in the _output.yml file.
The HTML output format for this example is bookdown::bs4_book,
site: bookdown::bookdown_site
---
YAML header from _output.yml file
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: pdflatex
citation_package: biblatex
keep_tex: yes
Latex code in preamble.tex
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{authblk}
The problem is that when I knit (or Build pdf_book) from RStudio, the college name is not seen in the title page of the PDF book. I have tried various ways, but I am getting one or the other errors. I want to show two authors (along with their respective affiliation) on the title page of the book. But here, I can't display it even for one author when I compile it through TinyTeX in RStudio. However, when I compile the TexStudio code in TeXStudio using TinyTeX, it displays two authors and their affiliations correctly. How can I solve this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
