Skip to content

Instantly share code, notes, and snippets.

\documentclass{scrartcl}
\usepackage{chngcntr}
\usepackage[hypertexnames=false]{hyperref}
\counterwithin*{section}{part}
\begin{document}
\part{First Part}
\documentclass{scrartcl}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{filecontents}{doc1_body-Star.tex}
\section{About Foo} \label{sec:foo}
\ref*{sec:foo}
\end{filecontents}
\begin{filecontents}{doc2_body-Star.tex}
\documentclass{scrartcl}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{filecontents}{doc1_body-Star.tex}
\section{About Foo} \label{sec:foo}
\ref*{sec:foo}
\end{filecontents}
\begin{filecontents}{doc2_body-Star.tex}
dat <- cars # example
myfile <- tempfile(fileext = ".Rmd")
cat("---
output: pdf_document
params:
dat: NA
---
@ClaudiusL
ClaudiusL / SO_Q33922757_reloaded.Rmd
Created August 12, 2020 09:19
Modify https://stackoverflow.com/a/34132011/2706569 to dynamically print figure environments.
---
output: pdf_document
---
```{r,fig.align='center', echo=FALSE, results='asis'}
library(ggplot2)
for (i in 1:3) {
---
title: "Test"
output:
html_document:
self_contained: false
---
```{r}
knitr::opts_knit$set(eval.after = "fig.link")
```
---
title: "MWD"
output: bookdown::word_document2
---
\@ref(fig:fig1) \@ref(fig:fig2)
```{r fig1, fig.cap="Figure Main"}
plot(1)
```
@ClaudiusL
ClaudiusL / titlesecissue.Rmd
Created October 22, 2018 09:57
SO Q 52904447
\documentclass[]{article}
\usepackage{hyperref}
\setcounter{secnumdepth}{0}
\usepackage{lipsum}
\usepackage[sf,bf]{titlesec}
\begin{document}
---
title: "Toggle Chuck Output Using details Tag"
output: html_document
---
```{r setup, include=FALSE}
library(knitr)
knit_hooks$set(showDetails = function(before, options, envir) {
if (before) {
```{r}
# Idea based on http://r.789695.n4.nabble.com/Modify-base-R-functions-in-Rprofile-site-td905121.html
interactiveOld <- base::interactive
unlockBinding("interactive", as.environment("package:base"))
assignInNamespace("interactive", function() { TRUE }, ns = "base")
library(data.table)
assignInNamespace("interactive", interactiveOld, ns = "base")
```