Debian Codegraph @

texmf-dist/doc/latex/ocg-p/examples/ocg-p_example_3.tex

raw
1 \documentclass[a4paper]{ltxdoc}
2
3 \usepackage{ocg-p}
4 \usepackage{tikz}
5 \usetikzlibrary{arrows,automata}
6 \usepackage{color}
7
8 \newcommand*{\pkg}[1]{\textsf{#1}}
9
10 \title{\pkg{OCG-P} package, example 3}
11
12 \begin{document}
13
14 \maketitle
15
16 \section{Text layers changed by clicking on a link element}
17 The following text can be toggled:
18 \begin{tikzpicture}[baseline=0]
19 \tikzstyle{nome}=[anchor=base,outer sep=0,inner sep=0,minimum height=.45cm,minimum width=4.4cm]
20 \begin{ocg}{blue text}{ocblueid}{1}
21 \node[nome,blue] (p1) {\parbox[b][][t]{4.4cm}{This text is written in blue.}};
22 \end{ocg}
23 \begin{ocg}{red text}{ocredid}{0}
24 \node[overlay,nome,red] (p2) {\parbox[b][][t]{4.4cm}{This text is written in red.}};
25 \end{ocg}
26 \end{tikzpicture}
27 And now the text is black again.\\
28
29 \toggleocgs{ocblueid ocredid}{Click here to toggle the text!}
30
31
32
33 \section{Mouseover example}
34
35 Make the text visible by moving the mouse in the box around.
36
37 \fbox{
38 \begin{ocg}{This}{octhis}{0}
39 \toggleocgs[triggerocg=allactions]{octhis, octhis}{This}
40 \end{ocg}
41 \begin{ocg}{text}{octext}{0}
42 \toggleocgs[triggerocg=allactions]{octext, octext}{text}
43 \end{ocg}
44 \begin{ocg}{is}{ocis}{0}
45 \toggleocgs[triggerocg=allactions]{ocis,ocis}{is}
46 \end{ocg}
47 \begin{ocg}{not}{ocnot}{0}
48 \toggleocgs[triggerocg=allactions]{ocnot, ocnot}{not}
49 \end{ocg}
50 \begin{ocg}{visible}{ocvisible}{0}
51 \toggleocgs[triggerocg=allactions]{ocvisible, ocvisible}{visible.}
52 \end{ocg}
53 }
54
55
56
57 \end{document}