animations on pdf using lua and latex
DESCRIPTION
TRANSCRIPT
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Algorithm Animation in PDF Documents
Manthosh Kumar T, Mukund M, Prakash E
Supervisor: R S MiltonProfessor
Department of CSE
January 17, 2013
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Table of contents1 Recap2 Proposed System
Interface DiagramUser ClassificationInterface
3 LATEXTikZ Sample Codeanimate.sty Sample Code
4 ConTEXtMetapost Sample Codet-animation Sample Code
5 Laying out Data Structure Diagrams6 Implementation Example7 References
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Abstract
The objective is to incorporate animated diagrams in PDFdocuments for educational use.
TEXto generate the PDF documents.
Sequence of layers with capabilities to play, pause, resume andrewind.
To animate algorithms for data structures.
Automatic layout of diagrams for lists and trees and a modulefor animation in TEXwith LuaTEXand JavaScript.
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Literature Survey
Diagrams
Metapost
Asymptote
PGF/Tikz
Animations
Animate.sty
t-animation module
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Interface DiagramUser ClassificationInterface
Proposed System
Develop an interface for animating data strcutures and algorithms
TEX, TikZ/PGF, orMetaPost and Lua
TEX
LuaLATEX ConTEXt
animate.styTikz/PGF or MetaPost
t-animation moduleTikz/PGF or MetaPost
Figure: Interface organization
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Interface DiagramUser ClassificationInterface
Interface Diagram
Creating animations using a high-level API (in TEX)
Higher level API (in Lua)
Low level APIWraps TEXcommands for animation, drawinginto Lua functions for use in high level API
Figure: Layers in the Interface
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Interface DiagramUser ClassificationInterface
User Classification
Interface must follow sound human engineering, and make simplethings easy and complex things possible
User
End User uses high level API to create animations
Pro User
uses low Level API to create algorithmsand
package them into a high level API
Figure: End users and Expert users
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Interface DiagramUser ClassificationInterface
Interface
Wrapper Class
The interface is a set of Lua functions
Implement necessary new TEX commands
Pro-user uses the interface to create a high-level API
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
TikZ Sample Codeanimate.sty Sample Code
Using LATEX
TikZ/PGF: drawing
Easy to place the nodes in diagrams
Provides a lot of functionalities for positioning andcustomization of diagrams.
animate.sty package helps create animations in LATEX-frames
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
TikZ Sample Codeanimate.sty Sample Code
Tikz Sample Code
\newcommand{\drawElement}[4]{
\draw (#2,0) node[draw,rectangle,color=#3,
minimum width=#4] {#1};
}
function beginPicture()
tex.sprint([[\noexpand\begin{tikzpicture}]])
end
function drawElement(val,pos,color,spacing)
tex.sprint([[\noexpand\drawElement{]],val,"
}{",pos,"}{",color,"}{",spacing,"};")
end
function endPicture()
tex.sprint([[\noexpand\end{tikzpicture}]])
end Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
TikZ Sample Codeanimate.sty Sample Code
Sample Code - Explained
beginPicture() wraps the begin Picture TEXcommand
drawElement() takes necessary arguments and draws arrayelement
endPicture() wraps the end Picture TEXcommand
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
TikZ Sample Codeanimate.sty Sample Code
animate.sty Sample Code
function beginAnimation()
tex.sprint([[\noexpand\begin{animateinline}[controls,width=400pt]{2};")
end
function newFrame()
tex.sprint([[\noexpand\newframe]])
end
function endAnimation()
tex.sprint([[\noexpand\end{animateinline}]])
end
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
TikZ Sample Codeanimate.sty Sample Code
Sample Code - Explained
beginAnimation() wraps the TEX code for animation
newFrame() creates a new frame
endAnimation() ends the animation
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Metapost Sample Codet-animation Sample Code
Using ConTEXt
Metapost: mainline syntax and hence can be programmedeasily
ConTEXt can use it directly with PDF
With t-animation module easy to use interface for creatinganimations
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Metapost Sample Codet-animation Sample Code
Metapost Sample Code
\def\drawElement[#1][#2]{
draw unitsquare scaled 1cm with color #2;
dotlabel.bot(#1, origin);
}
function beginPicture()
tex.sprint([[\noexpand\startMPcode]])
end
function drawElement(val,pos,color,spacing)
tex.sprint([[\noexpand\drawElement{]],val,"}{",color,"};")
end
function endPicture()
tex.sprint([[\noexpand\stopMPcode]])
endManthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Metapost Sample Codet-animation Sample Code
Sample Code - Explained
beginPicture() wraps the \startMPcode conTEXtcommand
drawElement() takes necessary arguments and draws arrayelement
endPicture() wraps the \stopMPcode conTEXt command
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Metapost Sample Codet-animation Sample Code
t-animation Sample Code
function beginAnimation()
tex.sprint([[\noexpand{\startanimation[menu=yes]]])
end
function newFrame()
tex.sprint([[\noexpand\frame]])
end
function endAnimation()
tex.sprint([[\noexpand\stopanimation}]])
end
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Metapost Sample Codet-animation Sample Code
Sample Code Explained
\startanimation[menu=yes] analogous to\begin{animateinline} in animate.sty package.
\frame analogous to \begin{newframe in animate.sty
package.
\stopanimation analogous to \end{animateinline} inanimate.sty package.
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Laying out Data Structure Diagrams
Higher level API implemented using the Interface
Algorithms for an illustrative set of data structures
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Linear Array Search
Function call :\linearArraySearch{21,42,24,76,46,81,69,72,83,93,14,97}{69}
Element to be Found : 69Linear Search Animation :
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
0s and 1s Separation
Function call : \digitSep{0,1,0,1,0,0,0,1,1,1,1,1}
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
RecapProposed System
LATEXConTEXt
Laying out Data Structure DiagramsImplementation Example
References
Alexander Grahn. The animate Package.http://www.ctan.org/tex-archive/macros/latex/
contrib/animate/
Jannis Pohlmann. Configurable Graph Drawing Algorithms forthe TikZ Graphics Description Language. IInstitute forTheoretical computer science, University of lbeck
Konstantin Skodinis. Construction of linear tree-layouts whichare optimal with respect to vertex separation in linear time.Journal of Algorithms, Volume 47, Issue 1, April 2003
John D. Hobby. Drawing Graphs with MetaPost. AT&T BellLaboratories, 1992.
ConTEXt Wikihttp://wiki.contextgarden.net
Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents