I'm working on an introductory course for the R-language in LaTeX, so I'm trying to write a function that displays the R-function. This is what I've got:
Code: Select all
\makeatletter
\newcommand{\fun}[3]{
\begin{tcolorbox}[top = 0mm, bottom = 0mm, left = 0mm, right = 0mm, colback=green!5,colframe=vubgreen,title=#3]
\begin{tabular}{p{.2\textwidth}p{.04\textwidth}p{.68\textwidth}}
{\tt#1(}\\\@for\x:=#2\do{\x\\}{\tt$\quad$)}
\end{tabular}
\end{tcolorbox}}
\makeatother
Code: Select all
\renewcommand{\arg}[3][]{
{\tt$\quad$#2}&}
Code: Select all
\fun{hist}
{
\arg{x}{Vector.},
\arg{freq = TRUE}{Use absolute frequencies.}
}
{Draw a histogram.}
- The opening round bracket has to be on the same line as the first parameter (so the line under the first function.
- The closing round bracket has to be right behind the last parameter (NOT behind the description of the parameter).
- Behind each parameter there has to be a comma, except after the last one.
- However: if a function has no parameters, opening and closing round bracket have to be on the same line as the name of the function.
Code: Select all
\usepackage{array}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{answers}
\usepackage{graphicx}
\usepackage{tcolorbox}
\usepackage{color}
\usepackage{xcolor}
\usepackage{epstopdf}
\usepackage[dutch]{babel}
\usepackage{anysize}
\usepackage[parfill]{parskip}
\usepackage{hyperref}
\usepackage{longtable}
Also posted to {TeX} SX