Change table of contents colour R markdown to pdf - r

My problem is very similar to this question - originally I wanted to just separate the table of contents from the title page with R markdown.
I used the latex workaround proposed there to achieve this, but when i add a table of contents to R markdown and knit it as .pdf the table of contents has a bright pink coloured font. All the help I found so far was using something like
<span style="color:green">WORD_WITH_DIFF_COLOUR</span>
or
<font color='green'>WORD_WITH_DIFF_COLOUR</font>
to change the colour of some words, but it doesnt work when do something like
<font color='green'>'\tableofcontents</font>
I guess there is a way to change this, but I wasn't able to find anything till now...
Any help would be appreciated!
EDIT!
Using #Tad Dallas's tip i was able to get this far

See the LaTeX Options section of the R Markdown documentation
All you have to do is add linkcolor: 'black' to the YAML.

In an attempt to apply #mrp's solution, it seems like the current solution is to add toccolor: 'blue'.
Found it in the Pandoc manual, as suggested in the R Markdown documentation.

Related

Fractions and Superscript in a table while knitting to docx (RMarkdown)

I have been using officedown for some time now to knit to docx. I encountered an issue where a table I had to create required superscripts in the table as shown below
This led me to go over all the methods for creating a table. Rather than typing it all out here I created an Rmd document below which goes through all the issues. I would be interested in knowing if anyone has any comments or suggestions. My goal is simple. We want a table that exports to docx that
Shows up in the list of tables
Has a caption
In-text reference
Shows the fractions correctly
Please find the detailed Rmd with examples HERE
I apologize for the length of the Rmd document but I wanted to showcase in detail what I have attempted to do to facilitate answers and suggestions
Update: Got a little roasted on the officer GitHub but it seems that fractions are not possible at the moment but subscripts are using ftExtra

Changing keywords to highlight in an RMarkdown document

I have been writing a document in bookdown where within the *.Rmd file I call a figure by using the following syntax
\#ref(fig:MyFigureName)
This differs slightly from the notation that you would use in a normal RMarkdown file exporting to latex which would be
\ref{fig:MyFigureName}
The issue I am running into is that when I write something in bookdown the function calling the Figure is not being highlighted properly (see image below).
I have imported my own rsTheme (which is from my understanding, basically a .css file) but I don't see an option to add keywords to highlight.
But I would like for the entire function to be colored differently from the inline text (Photoshop version of desired output shown below)
Does anyone know how I would edit my *rsTheme file in order to accomplish this?
Thanks!

Markdown and outline an R script

I am using Emacs for an R-script with markdown using oxygen comments. With rmarkdown::render() I produce either a HTML or pdf file. Works great.
However, it would be great if I could use outline mode for headings in this file (coloured differently and collapsing or showing stuff). I have searched the internet but haven't found a solution, how to make this work.
An example would be (R-File):
#' # Heading 1
#' some test
t <- c(1,2)
#' ## Heading 2
#' some more text
s <- c(1,2)
It would be nice, if I could collapse it and have different colors for the heading levels.
HTML
One possibility is to use knitr package to render the R markdown.
In addition it is possible to feed it a CSS file that will allow you to style headings (like colors). This answer Custom CSS with knitr and markdown in R may be useful to help you achieving this.
If you are familiar with css, you can always add the collapsing effect. If you aren't I suggest to have a look at this: http://www.webdeveloper.com/forum/showthread.php?77389-Expand-Collapse-Paragraph
Twisting the idea around would be to use Shinypackage to create an interactive page with R code, however it is a bit far-fetched considering that it started from a Markdown.

How to specify column widths in RMarkdown to Word?

I've been struggling with this for a while and I was hoping someone might be able to help me out. I'm using Rmarkdown and Knitr in RStudio to produce a word document (.docx), which I am populating with data. The only issue is no matter what I do, I can't seem to create consistent column widths. I've tried using a reference .docx, with no luck, and I've tried using pandoc.table with "split.cells", which changes the result printed to R console, but the formatting goes away when Knitr puts it into word:
panderOptions("table.split.cells",c(10,1,10,1,1))
pandoc.table(function_to_create_table(x))
Any suggestions? I feel like there's an obvious answer that's been eluding me.

PDF page number clashes with LaTeX page number when included

Another day, another question!
I have created a documentation of an R package using R CMD Rd2pdf workdir/.
The documentation is done in roxygen2 comments.
I now wanted to include this pdf into my LaTeX script, which I have managed as follows:
\usepackage{pdfpages}
\includepdf[pages=-,pagecommand={\thispagestyle{plain}}]{docu.pdf}
which means that I included all pdf pages and used the pagecommand option to make the LaTeX page numbering visible again.
Which worked quiet well so far. Scrolling through the pages I liked the outcome very much - this was until I reached the last page of the included pdf, which is the Index page.
Sadly, the page numbering of both, LaTeX and included pdf, are both at the bottom - only for this very last page. I don't like this and maybe you can relate (see image).
I can think of three possibilities:
1) somehow remove the Index page
2) remove the pdf numbering for the Index page or at least move it.
3) remove the LaTeX page number for this page.
Which would you do? I think option 3) is the easiest, but maybe I am missing something.
Thank you!
Without a working example I can't confirm it but is this the answer? tex.stackexchange-includepdf-pages-with-page-numbering-of-new-document-and-remove-blank-page-after
Does the following work?
\usepackage{pdfpages}
\includepdf[pages=-,pagecommand={}]{docu.pdf}

Resources