\newcommand{\indep}{\perp!!!\perp} \newcommand{\covprob}{\overset{p}{\rightarrow}} \newcommand{\covdist}{\overset{d}{\rightarrow}}

knitr::opts_chunk$set(message=FALSE, warning=FALSE, fig.width=6, fig.height=3, fig.align="center", size = "footnotesize")
library(FinMetric)
gof <- tibble::tribble(
  ~raw,        ~clean,          ~fmt,
  "nobs",      "N",             0,
  "r.squared", "$R^2$", 2)
def.chunk.hook  <- knitr::knit_hooks$get("chunk")
knitr::knit_hooks$set(chunk = function(x, options) {
  x <- def.chunk.hook(x, options)
  ifelse(options$size != "normalsize", paste0("\n \\", options$size,"\n\n", x, "\n\n \\normalsize"), x)
})
# define figure template
plot_task <- function(...){
    ggplot(...) +
        theme_bw() +
        ggthemes::scale_colour_stata("s2color") +
        ggthemes::scale_fill_stata("s2color") +
        theme(legend.position = "bottom") +
        scale_linetype_manual(values = c("solid", "longdash", "dotted"))
}
# define table template
table_task <- function(...){
    knitr::kable(..., booktab = T,
          format = "latex",
          linesep = "") %>% 
        kableExtra::kable_styling(position = 'center',
                  latex_options = "HOLD_position")
}

Introduction

Lorem ipsum dolor sit amet.

Algorithm

\begin{algorithm} \caption{An algorithm with caption}\label{alg:cap} \begin{algorithmic} \Require $n \geq 0$ \Ensure $y = x^n$ \State $y \gets 1$ \State $X \gets x$ \State $N \gets n$ \While{$N \neq 0$} \If{$N$ is even} \State $X \gets X \times X$ \State $N \gets \frac{N}{2}$ \Comment{This is a comment} \ElsIf{$N$ is odd} \State $y \gets y \times X$ \State $N \gets N - 1$ \EndIf \EndWhile \end{algorithmic} \end{algorithm}

Table

\begin{table}[H] \centering \caption{"Caption"} \resizebox{0.8\textwidth}{0.4\textheight}{\input{"table.tex"}} \end{table}

Figure

\begin{figure} \caption{"Caption"} \begin{center}\includegraphics[width=0.8\textwidth]{Figure1.pdf} \end{center}

{\footnotesize \textit{Notes}: Figure notes ........................} \end{figure}

Reference

::: {#refs} :::

\newpage

Appendix A: R Code

labs = knitr::all_labels()
labs = setdiff(labs, c("setup", "get-labels"))



WayneLockon/FinMetric documentation built on July 17, 2025, 12:10 a.m.