latex: latex

Description Usage Arguments Examples

View source: R/latex.R

Description

The function returns the LaTeX code to create an article containing a figure that represents the Hasse diagram obtained form a set of profiles (prof), an incidence matrix (Z) or a cover matrix (C). The code can be copied and pasted to a tex file. The tex source requires the tikz package,

Usage

1
2
3
4
5
6
7
latex(y, ...)
## S3 method for class 'wprof'
latex(y, label = "", caption = "", scale = c(1, 1), ...)
## S3 method for class 'incidence'
latex(y, label = "", caption = "", scale = c(1, 1), ...)
## S3 method for class 'cover'
latex(y, label = "", caption = "", scale = c(1, 1), ...)

Arguments

y

an object of S3 class wprof, an object of S3 class incidence or an object of S3 class cover.

label

the label of the LaTeX figure.

caption

the caption of the LaTeX figure.

scale

a vector of two elements to control the scale of the X-axis and the scale of the Y-axis in the LaTeX output.

...

any of above.

Examples

1
2
prof <- var2prof(varlen = c(2, 3))
latex(prof, label="fg:hasse", caption="Hasse diagram", scale = c(2, 2))

Example output

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

Loading required package: netrankr

Attaching package: 'parsec'

The following objects are masked from 'package:igraph':

    transitivity, vertices

\documentclass{article}
\usepackage{tikz}
\tikzstyle{node}=[circle, draw, fill=white, inner sep=1pt, minimum width=1pt]
\begin{document}

\begin{figure}[!h]
\label{fg:hasse}
\centering
\begin{tikzpicture}[scale=1.2]

\node(1) at (0,-2)[node]{11};

\node(2) at (1.33333333333333,-0.666666666666667)[node]{21};

\node(3) at (-1.33333333333333,-0.666666666666667)[node]{12};

\node(4) at (1.33333333333333,0.666666666666667)[node]{22};

\node(5) at (-1.33333333333333,0.666666666666667)[node]{13};

\node(6) at (0,2)[node]{23};

\draw[-, very thin] (1) to (2);

\draw[-, very thin] (1) to (3);

\draw[-, very thin] (2) to (4);

\draw[-, very thin] (3) to (4);

\draw[-, very thin] (3) to (5);

\draw[-, very thin] (4) to (6);

\draw[-, very thin] (5) to (6);

\end{tikzpicture}
\caption{Hasse diagram}
\end{figure}
\end{document}

parsec documentation built on May 2, 2019, 6:08 p.m.