diff options
author | Karl Berry <karl@freefriends.org> | 2013-01-12 00:01:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-01-12 00:01:08 +0000 |
commit | 84897d5d7dcc5750e11a40c7a1f4d2d2f6154bc7 (patch) | |
tree | 742c7306284bd37fbe8a1b6360822cb50552c49d /Master/texmf-dist/tex | |
parent | 55bb654df2d5a76f479c4f654bb95c2612c96a38 (diff) |
ocg-p (11jan13)
git-svn-id: svn://tug.org/texlive/trunk@28803 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/ocg-p/ocg-p.sty | 468 |
1 files changed, 338 insertions, 130 deletions
diff --git a/Master/texmf-dist/tex/latex/ocg-p/ocg-p.sty b/Master/texmf-dist/tex/latex/ocg-p/ocg-p.sty index 9354753ab0c..b0e0172d9e6 100644 --- a/Master/texmf-dist/tex/latex/ocg-p/ocg-p.sty +++ b/Master/texmf-dist/tex/latex/ocg-p/ocg-p.sty @@ -5,15 +5,24 @@ % This file may be distributed and/or modified under the LaTeX Project Public License \NeedsTeXFormat{LaTeX2e} -\def\ocgpversion{0.3} -\ProvidesPackage{ocg-p}[2012/12/01 v\ocgpversion\space Optional Content Group in a PDF document] - +\def\ocgpversion{0.4} +\ProvidesPackage{ocg-p}[2013/01/10 v\ocgpversion\space Optional Content Group in a PDF document] +% v0.1: 2012/11/01; v0.2: 2012/11/23; v0.3: 2012/12/01; v0.4: 2013/01/10 \RequirePackage{eso-pic} \RequirePackage{ifpdf} \RequirePackage{ifxetex} +\RequirePackage{xkeyval} -\DeclareOption*{}\ProcessOptions*\relax %allow anything as option for the moment +\newif\ifocgtabular +\DeclareOptionX[ocgp]{ocgtabular}{\ocgtabulartrue} +\DeclareOptionX*{\PackageWarning{ocg-p}{Option unknown: \CurrentOption}} +\ProcessOptionsX[ocgp]\relax +\ifocgtabular + \RequirePackage{datatool} + \RequirePackage{tikz} + \RequirePackage{listings} +\fi \newif\if@ocgp@ifps @@ -32,12 +41,13 @@ % dvips \@ocgp@ifpstrue \PackageWarningNoLine{ocg-p}{% - Only xelatex and pdflatex are supported% + Only XeLaTeX and pdfLaTeX are supported% }% \fi \fi \def\@ocgp@ocgHandle{\@auxout} +\newif\if@ocgp@iffirstrun\@ocgp@iffirstruntrue \newif\if@ocgp@isnestedB\@ocgp@isnestedBfalse % nested OCG begin \newif\if@ocgp@isnestedE\@ocgp@isnestedEfalse % nested OCG end @@ -53,24 +63,25 @@ \providecommand\ocg[3]{} % if running with ocgtools \renewenvironment{ocg}[4][]{% \if@ocgp@isnestedB% begin of nested ocg detected - \immediate\write\@ocgp@ocgHandle{% + \immediate\write\@ocgp@ocgHandle{% \string\@ocgp@nestedB{}% } - \fi - \global\@ocgp@isnestedBtrue % ocg begin - \global\@ocgp@isnestedEfalse % ocg end - + \fi + \global\@ocgp@isnestedBtrue % ocg begin + \global\@ocgp@isnestedEfalse % ocg end \if@filesw% \immediate\write\@ocgp@ocgHandle{% \string\@ocgp@newocg{#2}{#3}{#4}{#1}% - } + }% \fi \gdef\@ocgp@curnum{#3}% \ifpdf \pdfliteral{/OC /OC\@ocgp@curnum\space BDC}% \else \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT - \special{ps: mark /OC /OC\@ocgp@curnum\space /BDC pdfmark}% + \special{ps: mark /_objdef {psocgobj\@ocgp@curnum} /type/stream /OBJ pdfmark} + \special{ps: mark {psocgobj\@ocgp@curnum} (/OC /OC\@ocgp@curnum\space BDC) /PUT pdfmark} + %\special{ps: mark /OC /OC\@ocgp@curnum\space /BDC pdfmark}% \else \special{pdf: content /OC /OC\@ocgp@curnum\space BDC}% \fi @@ -82,12 +93,13 @@ \pdfliteral{EMC}% \else \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT - \special{ps: mark /EMC pdfmark}% + %\special{ps: mark /EMC pdfmark}% + \special{ps: mark {psocgobj\@ocgp@curnum} (EMC) /PUT pdfmark} \else \special{pdf: content EMC}% \fi \fi - \if@ocgp@isnestedE% end of nested ocg detected + \if@ocgp@isnestedE% end of nested ocg detected \immediate\write\@ocgp@ocgHandle{% \string\@ocgp@nestedE{}% } @@ -104,96 +116,141 @@ \gdef\@ocgp@ocgmaplist{} \def\@ocgp@ocgorderlist{} % ocgs in first-defined order + hierarchy -% FUTURE PARAMETERS -% notprintable -> PrintState=OFF -% alwaysprinted -> Printstate=ON -% notinlayertoolbar (visiblity not changeable) -> not listed in /Order -% notexportable -> ExportState=OFF -% alwaysexported -> Exportstate=ON -% visible (same as bool-argument visible) -> ViewState=ON -% not visible (same as bool-argument visible) -> ViewState=ON +\define@choicekey*[ocgp]{ocg}{printocg}[\@ocgp@printbin\@ocgp@printno]{always,never,ifvisible}[ifvisible]{% + \ifcase\@ocgp@printno\relax + \def\@ocgp@print{/Print<</PrintState /ON>>}% + \or% + \def\@ocgp@print{/Print<</PrintState /OFF>>}% + \or% + \def\@ocgp@print{}% + \fi% +} +\define@choicekey*[ocgp]{ocg}{exportocg}[\@ocgp@exportbin\@ocgp@exportno]{always,never,ifvisible}[ifvisible]{% + \ifcase\@ocgp@exportno\relax + \def\@ocgp@export{/Export<</ExportState /ON>>}% + \or% + \def\@ocgp@export{/Export<</ExportState /OFF>>}% + \or% + \def\@ocgp@export{}% + \fi% +} +\define@choicekey*[ocgp]{ocg}{listintoolbar}[\@ocgp@listbin\@ocgp@listno]{always,never,iffirstuse}[iffirstuse]{} + +\define@choicekey*[ocgp]{ocgaction}{triggerocg}[\@ocgp@actionbin\@ocgp@actionno]{onareaenter,onareaexit,onmousedown,onmouseup,allactions}[onmouseup]{% + \ifcase\@ocgp@actionno\relax + \def\@ocgp@trigger{/E}% + \or% + \def\@ocgp@trigger{/X}% + \or% + \def\@ocgp@trigger{/D}% + \or% + \def\@ocgp@trigger{/U}% + \or% + \def\@ocgp@trigger{}% + \fi% +} + +\presetkeys[ocgp]{ocg}{printocg=ifvisible,exportocg=ifvisible,listintoolbar=iffirstuse}{} +\presetkeys[ocgp]{ocgaction}{triggerocg=onmouseup}{} -% -> -% not visible AND alwaysprinted -> only on print \newcount\@ocgp@num\@ocgp@num=0 +\newcount\@ocgp@tonum\@ocgp@tonum=0 +\newcount\@ocgp@sonum\@ocgp@sonum=0 -\def\@ocgp@newocg#1#2#3#4{% #1: OCG name, #2: OC id num, #3: visiblity on/off - \expandafter\ifx\csname OCG#2\endcsname\relax - \expandafter\gdef\csname OCG#2\endcsname{#1}% - \global\advance\@ocgp@num by 1 - \ifpdf% PDFLATEX - \immediate\pdfobj{<< /Type /OCG /Name (#1) /Usage <<% - %/Print<</PrintState /ON>> % - %/View<</ViewState /OFF>> % - % /Export<</ExportState /OFF>>% - >> >>}% new ocg - \xdef\@ocgp@curocg{\the\pdflastobj\space 0 R}% reference to current ocg id - \else - \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT - \xdef\@ocgp@curocg{{@ocg\the\@ocgp@num}}% reference to current ocg id - \special{ps: mark /_objdef \@ocgp@curocg /type/dict /OBJ pdfmark} - \special{ps: mark \@ocgp@curocg << /Type /OCG /Name (#1) - >> /PUT pdfmark}% new ocg - \else % XELATEX - \xdef\@ocgp@curocg{@ocg\the\@ocgp@num}% reference to current ocg id - \special{pdf:obj \@ocgp@curocg\space <</Type/OCG /Name (#1) /Usage << - %/Print<</PrintState /ON>> % +\def\@ocgp@newocg#1#2#3#4{% #1: OCG name, #2: OC id num, #3: visiblity on/off + \if@ocgp@iffirstrun + \expandafter\ifx\csname OCG#2\endcsname\relax + \expandafter\gdef\csname OCG#2\endcsname{#1}% + \global\advance\@ocgp@num by 1 + \begingroup + \setkeys[ocgp]{ocg}{#4} + \ifpdf% PDFLATEX + \immediate\pdfobj{<< /Type /OCG /Name (#1) /Usage <<% + \@ocgp@print% %/View<</ViewState /OFF>> % - %/Export<</ExportState /OFF>>% - >> >>}% new ocg - \fi - \fi - \expandafter\xdef\csname OCGpdfobj#2\endcsname{\@ocgp@curocg} % for ogcx-package - \xdef\@ocgp@ocglist{\@ocgp@ocglist\space\@ocgp@curocg}% list of all OCGs in "first defined" order - \xdef\@ocgp@ocgorderlist{\@ocgp@ocgorderlist\space\@ocgp@curocg} % all OCGs in "first defined" order + hierarchy - \xdef\@ocgp@ocgmaplist{\@ocgp@ocgmaplist\space/OC#2\space\@ocgp@curocg\space ^^J} % name-to-id mapping - \ifnum#3=1 %on - % no list of all default-on OCGs needed, because of basestate on - \else% - \xdef\@ocgp@ocgofflist{\@ocgp@ocgofflist\space\@ocgp@curocg}% list of all default-off OCGs - \fi% - \else - % layer reopened + \@ocgp@export% + >> >>}% new ocg + \xdef\@ocgp@curocg{\the\pdflastobj\space 0 R}% reference to current ocg id + \else + \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT + \xdef\@ocgp@curocg{{@ocg\the\@ocgp@num}}% reference to current ocg id + \special{ps: mark /_objdef \@ocgp@curocg /type/dict /OBJ pdfmark} + \special{ps: mark \@ocgp@curocg << /Type /OCG /Name (#1) + >> /PUT pdfmark}% new ocg + \else % XELATEX + \xdef\@ocgp@curocg{@ocg\the\@ocgp@num}% reference to current ocg id + \special{pdf:obj \@ocgp@curocg\space <</Type/OCG /Name (#1) /Usage << + \@ocgp@print% + %/View<</ViewState /OFF>> % + \@ocgp@export% + >> >>}% new ocg + \fi + \fi + + \expandafter\xdef\csname OCGpdfobj#2\endcsname{\@ocgp@curocg} % for ogcx-package + \xdef\@ocgp@ocglist{\@ocgp@ocglist\space\@ocgp@curocg}% list of all OCGs in "first defined" order + \ifnum\@ocgp@listno=1\else + \xdef\@ocgp@ocgorderlist{\@ocgp@ocgorderlist\space\@ocgp@curocg} % all OCGs in "first defined" order + hierarchy + \fi + \endgroup + \xdef\@ocgp@ocgmaplist{\@ocgp@ocgmaplist\space/OC#2\space\@ocgp@curocg\space ^^J} % name-to-id mapping + \ifnum#3=1 %on + % no list of all default-on OCGs needed, because of basestate on + \else% + \xdef\@ocgp@ocgofflist{\@ocgp@ocgofflist\space\@ocgp@curocg}% list of all default-off OCGs + \fi% + \else + \message{OCG#2 reopened}% layer reopened + \begingroup + \setkeys[ocgp]{ocg}{#4} + \ifnum\@ocgp@listno=0 + \xdef\@ocgp@ocgobjlist{}% + \@ocgp@parseSpaceSeperatedList{#2}% + \xdef\@ocgp@ocgorderlist{\@ocgp@ocgorderlist\space\@ocgp@ocgobjlist} + \fi + \endgroup + \fi \fi } - \AtEndDocument{% - %\message{... \@ocgp@ocgorderlist ...} - \ifpdf % PDFLATEX - \pdfcatalog{% - /OCProperties << - /OCGs [\@ocgp@ocglist] - /D <</BaseState/ON /Order [\@ocgp@ocgorderlist] /OFF [\@ocgp@ocgofflist] /AS [% - <</Event/View /OCGs [\@ocgp@ocglist] /Category[/View]>>% - <</Event/Print /OCGs [\@ocgp@ocglist] /Category[/Print]>>% - <</Event/Export /OCGs [\@ocgp@ocglist] /Category[/Export]>>% - ]>>% - >>% - } - \else - \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT - %\special{ps: mark {Catalog} << - % /OCProperties << - % /OCGs [\@ocgp@ocglist] - % /D <</BaseState/ON /Order [\@ocgp@ocgorderlist] /OFF [\@ocgp@ocgofflist]>> - % >> - %>> /PUT pdfmark}% - \else % XELATEX - \special{pdf:put @catalog << - /OCProperties << - /OCGs [\@ocgp@ocglist] - /D <</BaseState/ON /Order [\@ocgp@ocgorderlist] /OFF [\@ocgp@ocgofflist] /AS [% - <</Event/View /OCGs [\@ocgp@ocglist] /Category[/View]>>% - <</Event/Print /OCGs [\@ocgp@ocglist] /Category[/Print]>>% - <</Event/Export /OCGs [\@ocgp@ocglist] /Category[/Export]>>% - ]>>% - >>% - >>}% - \fi - \fi - } +\AtBeginDocument{% AtEndDocument{% changed because of xetex problem in beamer class + \@ocgp@iffirstrunfalse + %\message{... \@ocgp@ocgorderlist ...} + \ifpdf % PDFLATEX + \pdfcatalog{% + /OCProperties << + /OCGs [\@ocgp@ocglist] + /D <</BaseState/ON /Order [\@ocgp@ocgorderlist] /OFF [\@ocgp@ocgofflist] /AS [% + <</Event/View /OCGs [\@ocgp@ocglist] /Category[/View]>>% + <</Event/Print /OCGs [\@ocgp@ocglist] /Category[/Print]>>% + <</Event/Export /OCGs [\@ocgp@ocglist] /Category[/Export]>>% + ]>>% + >>% + } + \else + \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT + \special{ps: mark {Catalog} << + /OCProperties << + /OCGs [\@ocgp@ocglist] + /D <</BaseState/ON /Order [\@ocgp@ocgorderlist] /OFF [\@ocgp@ocgofflist]>> + >> + >> /PUT pdfmark}% + \else % XELATEX + \special{pdf:put @catalog << + /OCProperties << + /OCGs [\@ocgp@ocglist] + /D <</BaseState/ON /Order [\@ocgp@ocgorderlist] /OFF [\@ocgp@ocgofflist] /AS [% + <</Event/View /OCGs [\@ocgp@ocglist] /Category[/View]>>% + <</Event/Print /OCGs [\@ocgp@ocglist] /Category[/Print]>>% + <</Event/Export /OCGs [\@ocgp@ocglist] /Category[/Export]>>% + ]>>% + >>% + >>}% + \fi + \fi +} \AtBeginDocument{% \ifpdf % PDFLATEX @@ -210,12 +267,15 @@ \x \else \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT - %\AddToShipoutPicture{ - %\special{ps: mark {Resources} << - % /Properties << ^^J% - % \@ocgp@ocgmaplist + \AddToShipoutPicture{ + \special{ps: mark /_objdef {Resources} /type/stream /OBJ pdfmark} + \special{ps: mark {Resources} << % it is something wrong here + % /Resources << + /Properties << ^^J% + \@ocgp@ocgmaplist %>> - %>> /PUT pdfmark}}% + >> + >> /PUT pdfmark}}% \else % XELATEX \AddToShipoutPicture{ \special{pdf: put @resources << @@ -227,44 +287,192 @@ \fi } + % parsing a space-delimited ocgid-list to a space-delimited list of ocg-objects -\makeatletter -\def\@ocgp@parseSpaceSeperatedList#1{ \@ocgp@doparseSpaceSeperatedList#1 \@empty } +\def\@ocgp@parseSpaceSeperatedList#1{\@ocgp@doparseSpaceSeperatedList#1 \relax} \def\@ocgp@doparseSpaceSeperatedList#1 #2{% - \ifcsname OCGpdfobj#1\endcsname - \xdef\@ocgp@ocgobjlist{\@ocgp@ocgobjlist\space\csname OCGpdfobj#1\endcsname} + \ifcsname OCGpdfobj#1\endcsname% + \xdef\@ocgp@ocgobjlist{\@ocgp@ocgobjlist\space\csname OCGpdfobj#1\endcsname}% \fi - \ifx #2\@empty + \ifx#2\relax %\@ocgp@ocgobjlist % only for debugging reasons \else \expandafter\@ocgp@doparseSpaceSeperatedList \fi #2% } -\makeatother -% link to toggle a layer in a document without using the layer toolbar of the viewer -\makeatletter -\long\def\toggleocg#1#2{% - \xdef\@ocgp@ocgobjlist{}% - \@ocgp@parseSpaceSeperatedList{#1} - \leavevmode% - \ifpdf - \pdfstartlink user {% - /Subtype /Link - /A << /S/SetOCGState /State [/Toggle \@ocgp@ocgobjlist] >> - %/A << /Type /Action /S /GoTo /D [1 0 R] >> - /Border [0 0 0]% no border - }% - #2\pdfendlink% - \else - \special{pdf: bann - << /Type /Annot - /Subtype /Link - /Border [0 0 0]% no border - /A <</S/SetOCGState /State [/Toggle \@ocgp@ocgobjlist] >>% - >>}#2% - \special{pdf:eann}% - \fi +%get the n-th element from a comma separated list +\newcommand\@ocg@selectElementN[2]{% + \newcount\@ocgp@inum\@ocgp@inum=0% + \def\@ocgp@tempN{}% + \@for\@ocg@i:=#1\do{% + \advance\@ocgp@inum by 1\relax + \ifnum\@ocgp@inum=#2\relax + \edef\@ocgp@tempN{\@ocg@i}% + \fi + }% +} + +% link to toggle layers in a document without using the layer toolbar of the viewer +\newcommand\toggleocgs[3][]{% + \setocgs[#1]{#2}{}{}{#3}% +} +% link to show layers in a document without using the layer toolbar of the viewer +\newcommand\showocgs[3][]{% + \setocgs[#1]{}{#2}{}{#3}% +} +% link to hide layers in a document without using the layer toolbar of the viewer +\newcommand\hideocgs[3][]{% + \setocgs[#1]{}{}{#2}{#3}% +} +% link to set layers in a document without using the layer toolbar of the viewer +\newcommand\setocgs[5][]{% + \begingroup + \setkeys[ocgp]{ocgaction}{#1}% + \newcount\@ocgp@aanum\@ocgp@aanum=0 + \def\@ocgp@actionlist{}% + \loop\ifnum\@ocgp@aanum<4 + \xdef\@ocgp@ocgobjlist{}% + \advance\@ocgp@aanum by 1\relax + \ifx\\#2\else% + \expandafter\@ocg@selectElementN\expandafter{#2}{\@ocgp@aanum}% + \ifx\@ocgp@tempN\@empty\else + \xdef\@ocgp@ocgobjlist{/Toggle }% + \expandafter\@ocgp@parseSpaceSeperatedList\expandafter{\@ocgp@tempN}% + \fi + \fi + \ifx\\#3\else% + \expandafter\@ocg@selectElementN\expandafter{#3}{\@ocgp@aanum}% + \ifx\@ocgp@tempN\@empty\else + \xdef\@ocgp@ocgobjlist{\@ocgp@ocgobjlist /ON }% + \expandafter\@ocgp@parseSpaceSeperatedList\expandafter{\@ocgp@tempN}% + \fi + \fi + \ifx\\#4\else% + \expandafter\@ocg@selectElementN\expandafter{#4}{\@ocgp@aanum}% + \ifx\@ocgp@tempN\@empty\else + \xdef\@ocgp@ocgobjlist{\@ocgp@ocgobjlist /OFF }% + \expandafter\@ocgp@parseSpaceSeperatedList\expandafter{\@ocgp@tempN}% + \fi + \fi + \ifnum\@ocgp@actionno<4\relax% only one action + \def\@ocgp@actionlist{\@ocgp@trigger << /S /SetOCGState /State [\@ocgp@ocgobjlist]>>}% + \advance\@ocgp@aanum by 10\relax + \else% allactions + \ifcase\@ocgp@aanum\relax\or% + \def\@ocgp@trigger{/E}% + \or% + \def\@ocgp@trigger{/X}% + \or% + \def\@ocgp@trigger{/D}% + \or% + \def\@ocgp@trigger{/U}% + \fi + \ifx\@ocgp@ocgobjlist\@empty\else + \edef\@ocgp@actionlist{\@ocgp@actionlist\space\@ocgp@trigger << /S /SetOCGState /State [\@ocgp@ocgobjlist]>> }% + \fi + \fi + \repeat + \global\advance\@ocgp@sonum by 1\relax + \leavevmode% + \ifpdf% + \pdfstartlink user {% + %/Subtype /Link + /Subtype /Widget + /FT/Btn /Ff 65536 + /T(setocg\the\@ocgp@sonum) + /H/N %Highlightning Mode: N=No;I=Invert;O=Outline;P=Push + %/A <</S/SetOCGState /State [\@ocgp@ocgobjlist]>> + /AA << + \@ocgp@actionlist + >> + %/Border [0 0 0]% no border + }% + #5\pdfendlink% + \else% + \if@ocgp@ifps % soon (not implemented yet) POSTSCRIPT + \special{ps: bann + << /Type /Annot + %/Subtype /Link + /Subtype /Widget + /FT/Btn/Ff 65536 + /T(setocg\the\@ocgp@sonum) + /H/N + %/Border [0 0 0]% no border + %/A <</S/SetOCGState /State [\@ocgp@ocgobjlist]>>% + /AA << + \@ocgp@actionlist + >> + >>}#5% + \special{ps:eann}% + \else% XELATEX + \special{pdf: bann + << /Type /Annot + %/Subtype /Link + /Subtype /Widget + /FT/Btn/Ff 65536 + /T(setocg\the\@ocgp@sonum) + /H/N + %/Border [0 0 0]% no border + %/A <</S/SetOCGState /State [\@ocgp@ocgobjlist] >>% + /AA << + \@ocgp@actionlist + >> + >>}#5% + \special{pdf:eann}% + \fi% + \fi% + \endgroup } -\makeatother + + + +% environment for a table which can be sorted by clicking on the header +% IMPLEMENTATION NOT FINISHED (last argument for options) +\ifocgtabular + \lst@RequireAspects{writefile} + \lstnewenvironment{ocgtabular}[4][]{ + \lstset{aboveskip=0pt,belowskip=0pt} + \global\advance\@ocgp@tonum by 1\relax + \newcommand\setocgtabularheader[2]{% + \newcount\@ocgp@thnum\@ocgp@thnum=0% + \xdef\@ocgp@ocgobjtlist{}% + %\newcount\@ocgp@colindex% + \DTLgetcolumnindex{\@ocgp@colindex}{#3}{##1}% + \loop\ifnum\@ocgp@thnum<\DTLcolumncount{#3}% + \advance\@ocgp@thnum by 1\relax + \ifnum\@ocgp@thnum=\@ocgp@colindex\relax\else% + \edef\@ocgp@ocgobjtlist{\@ocgp@ocgobjtlist\space ocgtabular\the\@ocgp@tonum o\the\@ocgp@thnum}% + \fi% + \repeat% + \setocgs{}{ocgtabular\the\@ocgp@tonum o\@ocgp@colindex}{\@ocgp@ocgobjtlist}{##2}% + } + \newcount\@ocgp@tcnum\@ocgp@tcnum=0% + \setbox\@tempboxa\hbox\bgroup + \lst@BeginWriteFile{\jobname.oct}% + }{ + \lst@EndWriteFile% closes output file + \egroup + %\vspace{-\baselineskip}%remove line from write-op + \begin{tikzpicture} + \loop\ifnum\@ocgp@tcnum<\DTLcolumncount{#3} + \advance\@ocgp@tcnum by 1\relax + \DTLgetkeyforcolumn{\@ocgp@theader}{#3}{\the\@ocgp@tcnum} + \message{+++ocgtabular\the\@ocgp@tonum o\the\@ocgp@tcnum +++} + \begin{ocg}[listintoolbar=never]{ocgtabular\the\@ocgp@tcnum}{ocgtabular\the\@ocgp@tonum o\the\@ocgp@tcnum}{\ifnum\@ocgp@tcnum=1 1\else 0\fi} + \node[] (ocgnode\the\@ocgp@tcnum) { + \DTLsort*{\@ocgp@theader}{#3}% + \begin{tabular}[#1]{#2} + \@@input\jobname.oct% + %\input{\jobname.oct}%problems with some commands + \end{tabular} + }; + \end{ocg} + \repeat + \end{tikzpicture} + } +\fi + + + |