position of table of contens and searchable files with Quarto (PDF output) - latex

is there a Quarto way to
place the table of contens (TOC) where I like it. Like for references (Bibliography Generation)
::: {#refs}
:::
(for LaTeX please see answer in comment from #shafee for further information)
toc: false
```{=latex}
\tableofcontents
```
create Copy-paste-able/searchable PDF files TeX FAQ
header-includes:
- \usepackage{mmap}
replace default title page, is there something like toc: false? https://en.wikibooks.org/wiki/LaTeX/Title_Creation
\begin{titlepage}
\end{titlepage}

Related

Latex in document referencing via Varioref is not working in Rmarkdown

I've been using vanilla latex documents for a long time and have recently switched over to Rmarkdown. I'm struggling to get varioref to work, or any in-document referencing for that matter. See below example Rmarkdown file contents. I've tried to make it a minimally reproducible example.
---
title: "vref"
output:
pdf_document:
keep_tex: true
latex_engine: pdflatex
header-includes: \usepackage{varioref}
---
Please see \vref{section}
\newpage
\section{This is a section} \label{section}
It seems like the reference is being created with a clickable link, but there is no reference to the section being created..
Rmarkdown producing unnumbered sections has nothing to do with varioref. You can make them numbered like this:
---
title: "vref"
output:
pdf_document:
keep_tex: true
latex_engine: pdflatex
header-includes:
- \usepackage{varioref}
- \setcounter{secnumdepth}{4}
---
Please see \vref{section}
\newpage
\section{This is a section} \label{section}

Fancyhead for unnumbered appendix in R Markdown knit to pdf

A question about fancyhdr in R Markdown knitting to pdf.
Can anyone help me to fix the header for the appendix? I have numbered sections in the document, and the fancyhead for pages with the numbered sections is oke. But for the unnumbered appendix, it keeps showing the last numbered section, where I just want the title of the current unnumbered appendix to be shown. Code example below. Thanks!
---
title: "Example"
output:
pdf_document:
number_sections: true
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
---
\newpage
# Chapter
\newpage
# Appendix {-}
You can adjust the header like this:
---
title: "Example"
output:
pdf_document:
number_sections: true
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
---
\newpage
# Chapter
\newpage
# Appendix {-}
\markboth{something here}{something there}

bookdown chapter heading not correct

I am using the bookdown to write a book. I've defined the documentclass as book. Everything seems to be working correctly - the Table of Contents, List of Tables and List of Figures along with an Appendix, Bibliography and Index. However, in my index.Rmd file I lead off with a Preface section that is not numbered. So, this first "Preface chapter" is marked with a level-1 heading # Preface {-}. The Preface is listed correctly in the Table of Contents as an unnumbered Chapter. However, on the page following the "Preface chapter" the heading at the top of the page still says "List of Figures". So, somehow the chapter heading is being held over and repeated from the List of Figures and not being updated with the "Preface chapter" heading. This "List of Figures" heading stays the same until I get to the next chapter (technically the second chapter) which is numbered, then the rest of the page headings are correct for the rest of the book.
I'm a bit of a LaTeX newbie, so I'm sure there is some option or setting I'm missing. Do I need to add some special LaTeX command or Pandoc argument to make sure that the page headings are aligned with every chapter - both numbered and unnumbered?
Any suggestions are much appreciated. My relevant YAML settings and TEX commands are listed below.
_output.yml
bookdown::pdf_book:
includes:
in_header: preamble.tex
after_body: after_body.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
preamble.tex
\usepackage{booktabs}
\usepackage{makeidx}
\makeindex
\usepackage[nottoc]{tocbibind}
index.Rmd - relevant section of YAML
documentclass: book
bibliography: [manual.bib, packages.bib]
biblio-style: apalike
link-citations: yes
lot: true
lof: true
Since pandoc passes LaTeX commands through you could use
# Preface {-}
\markboth{Preface}{}
(c.f. https://tex.stackexchange.com/questions/89914/chapter-name-in-the-header-with-chapter)

how to include pdfpages in rmarkdown for beamer output

I am creating pdf slides using rmarkdown and beamer. When using latex instead of rmarkdown, I can include arbitrary pages from pdf files into my slides with
\usepackage{pdfpages}
...
\includepdf[pages={1-10}]{another_file.pdf}
Is it possible to achieve this with rmarkdown? Note that when just issuing the \includepdf command, intended to be located between slides, pandoc wraps it between \begin{frame} and \end{frame}.
Not a perfect solution but it works (adapted from https://tex.stackexchange.com/questions/11458/error-when-inserting-a-pdf-page-into-a-beamer-presentation?newreg=10fd6a4a46c642118eb4ec905cf87303): use \includegraphics instead of includepdf. This works inside of frames but you have to manyally create a frame for each page you want to insert as it only allows to insert a single page at time.
---
title: "Foo"
output:
beamer_presentation:
---
# Stolen image
---
\includegraphics[page=1,width=\paperwidth]{lecture-1-terminal.pdf}
# My own work
## My slide 1
Great stuff!
In rmarkdown you can use pdfpages like this:
---
output:
beamer_presentation:
keep_tex: true
header-includes:
- \usepackage{pdfpages}
- \setbeamercolor{background canvas}{bg=}
- \makeatletter\beamer#ignorenonframefalse\makeatother
---
test
``` {=latex}
\end{frame}
\includepdf[pages=1-10]{example-image-duck}
\begin{frame}
```
test
(the line \setbeamercolor{background canvas}{bg=} is necessary for beamer versions < 3.64, a patch has been added in 9e3bb9)
As you mentioned, you can inlcude raw TeX in Pandoc Markdown. For me the following works:
$ pandoc -t beamer
foo
\includepdf[pages={1-10}]{another_file.pdf}
bar
^D
which results in:
\begin{frame}
foo
\includepdf[pages={1-10}]{another_file.pdf}
bar
\end{frame}
Maybe you need to update your pandoc version? (I'm currenlty using 2.0 from pandoc nightlies)

Remove unwanted latex code from final document.

I made a file in rmarkdown to submit to a journal, but when I went to actually upload the file, they want raw latex. Okay, part of my YAML is.
output:
pdf_document:
keep_tex: true
header-includes:
- \usepackage{color}
- \usepackage{lineno}
- \linenumbers
The preview of the document looks great, except it starts out like this (just text not, in code format:
[]article lmodern amssymb,amsmath ifxetex,ifluatex fixltx2e =0 [T1]fontenc
[utf8]inputenc fontspec Ligatures=TeX,Scale=MatchLowercase upquote microtype
[protrusion]basicmath [margin=1in]geometry hyperref graphicx,grffile parskip
titling
color lineno
followed by everything I want. Where do I look to get rid of this?

Resources